From: Brandon McAnsh Date: Fri, 24 Jul 2015 19:40:45 +0000 (-0400) Subject: samsung: doze: Prevent a pm wakeup with a timestamp in the future X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=73c756d2b4c91b67895c2a11d658a8bf4a0bf25f;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git samsung: doze: Prevent a pm wakeup with a timestamp in the future Prevents: java.lang.IllegalArgumentException: event time must not be in the future at android.os.Parcel.readException(Parcel.java:1550) at android.os.Parcel.readException(Parcel.java:1499) at android.os.IPowerManager$Stub$Proxy.wakeUp(IPowerManager.java:550) at android.os.PowerManager.wakeUp(PowerManager.java:666) at com.cyanogenmod.settings.device.SamsungDozeService$SamsungProximitySensor.shouldPulse(SamsungDozeService.java:95) at com.cyanogenmod.settings.device.SamsungDozeService$SamsungProximitySensor.onSensorChanged(SamsungDozeService.java:75) at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent(SystemSensorManager.java:405) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:143) at android.os.Looper.loop(Looper.java:122) at android.app.ActivityThread.main(ActivityThread.java:5289) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) Change-Id: I8ed248271d67216e531b124bf27101fa538f1195 Signed-off-by: Brandon McAnsh --- diff --git a/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java b/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java index 424fbce..f8a175e 100644 --- a/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java +++ b/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java @@ -32,6 +32,7 @@ import android.preference.PreferenceManager; import android.provider.Settings; import android.util.Log; +import java.lang.System; import java.util.ArrayList; import java.util.concurrent.TimeUnit; import java.util.List; @@ -87,6 +88,11 @@ public class SamsungDozeService extends Service { } private boolean shouldPulse(long timestamp) { + // Never pulse if the timestamp is from the future + if (timestamp > System.nanoTime()) { + return false; + } + long delta = timestamp - mInPocketTime; if (mHandwaveGestureEnabled && mPocketGestureEnabled) {