From 734ab8e60b6a7df936955ceffae3ef75ec09825e Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 7 Oct 2014 16:42:28 -0700 Subject: [PATCH] Suppress redundant power key presses while turning screen on. Sometimes it can take a long time to turn the screen on. That's not good but what's worse is that the user will often get impatient and press the power button again which effectively cancels the process and makes the screen not come on at all. The user may then conclude that the device ignored the power key press. This change suppresses power key presses while we're already in the process of turning the screen on so that at least the screen comes on eventually, even if it's slower than we would like. Bug: 17753363 Change-Id: I23083873e35a3dcfa5c20b6f870f53c18e465582 --- .../android/internal/policy/impl/PhoneWindowManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 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 f7ed364002acf..99d5848cf5ab6 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -4421,7 +4421,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPowerKeyTriggered = false; cancelPendingScreenshotChordAction(); if (interceptPowerKeyUp(canceled || mPendingPowerKeyUpCanceled)) { - powerShortPress(event.getEventTime()); + if (mScreenOnEarly && !mScreenOnFully) { + Slog.i(TAG, "Suppressed redundant power key press while " + + "already in the process of turning the screen on."); + } else { + powerShortPress(event.getEventTime()); + } isWakeKey = false; } mPendingPowerKeyUpCanceled = false;