Prevent showing immersive confirmation unexpectedly

By design, if the user presses the power key twice within 5 seconds
(panic), it will show immersive confirmation again at the next time
entering immersive mode.

But there is a bug on calculating the time between pressing the power
key. The time get from event.getDownTime() will stop when the device
is sleeping without being charged.

So here uses SystemClock.elapsedRealtime() instead.

https://code.google.com/p/android/issues/detail?id=80772

Change-Id: I4dca9dc260904f1c5b60464834781e2a82a9bcf4
This commit is contained in:
tiger_huang
2014-10-14 14:48:00 +08:00
committed by Tiger Huang
parent 71f83672f2
commit 1b33b49723

View File

@@ -4389,7 +4389,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
result &= ~ACTION_PASS_TO_USER;
if (down) {
boolean panic = mImmersiveModeConfirmation.onPowerKeyDown(interactive,
event.getDownTime(), isImmersiveMode(mLastSystemUiFlags));
SystemClock.elapsedRealtime(), isImmersiveMode(mLastSystemUiFlags));
if (panic) {
mHandler.post(mRequestTransientNav);
}