summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Lower <devvortex@gmail.com>2015-08-05 10:51:03 -0400
committerJan Altensen <info@stricted.net>2020-03-20 14:56:33 +0100
commitd3e7105606493098a74bc606f701c7d1e4e5ff85 (patch)
tree9f2707237b4b6df4a844a2f9b07ad1bb32427489
parent73c756d2b4c91b67895c2a11d658a8bf4a0bf25f (diff)
downloadandroid_hardware_samsung-d3e7105606493098a74bc606f701c7d1e4e5ff85.tar.gz
android_hardware_samsung-d3e7105606493098a74bc606f701c7d1e4e5ff85.tar.bz2
android_hardware_samsung-d3e7105606493098a74bc606f701c7d1e4e5ff85.zip
samsung: doze: properly fix future timestamp error
Previously attempted fix at review.cyanogenmod.org/#/c/104083/ The timestamp isn't in the future, that would be impossible. The real issue is the timestamp from the SensorEvent is a true timestamp, the System.nanoTime is nanoseconds since boot. So the previous patch would always return false and never pulse. I've simply changed it so that the wakeup call gets sent the current System.nanoTime in milliseconds since boot so it does not think the event came from the future since the wakeUp method expects uptimeMillis, not true world time. Change-Id: I78f5e9d61107caf9c3bf6c10fa7c5bb400082294
-rw-r--r--doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java7
1 files changed, 1 insertions, 6 deletions
diff --git a/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java b/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java
index f8a175e..149f84b 100644
--- a/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java
+++ b/doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java
@@ -88,17 +88,12 @@ 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) {
return true;
} else if (mProximityWakeEnabled && (delta < POCKET_DELTA_NS)) {
- mPowerManager.wakeUp(TimeUnit.NANOSECONDS.toMillis(timestamp));
+ mPowerManager.wakeUp(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
return false;
} else if (mHandwaveGestureEnabled && !mPocketGestureEnabled) {
return delta < POCKET_DELTA_NS;