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
}
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;