From 1b33b497239d783ea25acd31764836818ebd65b5 Mon Sep 17 00:00:00 2001 From: tiger_huang Date: Tue, 14 Oct 2014 14:48:00 +0800 Subject: [PATCH] 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 --- .../com/android/internal/policy/impl/PhoneWindowManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 2699d13b9b9e8..ccc700daa9092 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -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); }