summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@google.com>2015-04-22 19:16:43 -0700
committerJoe LaPenna <jlapenna@google.com>2015-04-29 02:54:27 +0000
commit018319a0242dfc46a73943b739b0a16b11d66e2b (patch)
treedc7ce56ef3d48a4ae1c38774f8823b75923246fb
parentd24cc19343073294b3376f825bdc0d54a8d692f1 (diff)
downloadframeworks_base-018319a0242dfc46a73943b739b0a16b11d66e2b.zip
frameworks_base-018319a0242dfc46a73943b739b0a16b11d66e2b.tar.gz
frameworks_base-018319a0242dfc46a73943b739b0a16b11d66e2b.tar.bz2
Wait for KEY_SLEEP UP event before calling goToSleep()
Calling goToSleep() on the KEY_SLEEP DOWN event causes a race condition with the touch driver when the KEY_SLEEP event is generated via a palm press if the touch controller is told to go into AMBIENT_ON mode (touch controller goes into suspend mode) while the user's palm is still on the touch panel. If touch controller gets into suspend mode before user removes their palm, the act of removing the palm from the screen will cause the touch controller to generate a wake event and the device will "wake back up" into interactive mode. Waiting for the KEY_SLEEP UP event before putting the device to sleep assures palm is off the panel and thus removes this race case. Bug: 19951365 Change-Id: Icf565177696769b8dbeeb645ac883ebe3e0acb45
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 634b57e..a509706 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1063,16 +1063,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
- private void sleepPress(KeyEvent event) {
+ private void sleepPress(long eventTime) {
+ if (mShortPressOnSleepBehavior == SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME) {
+ launchHomeFromHotKey(false /* awakenDreams */, true /*respectKeyguard*/);
+ }
+ }
+
+ private void sleepRelease(long eventTime) {
switch (mShortPressOnSleepBehavior) {
case SHORT_PRESS_SLEEP_GO_TO_SLEEP:
- mPowerManager.goToSleep(event.getEventTime(),
- PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0);
- break;
case SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME:
- launchHomeFromHotKey(false /* awakenDreams */, true /*respectKeyguard*/);
- mPowerManager.goToSleep(event.getEventTime(),
- PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0);
+ Slog.i(TAG, "sleepRelease() calling goToSleep(GO_TO_SLEEP_REASON_SLEEP_BUTTON)");
+ mPowerManager.goToSleep(eventTime,
+ PowerManager.GO_TO_SLEEP_REASON_SLEEP_BUTTON, 0);
break;
}
}
@@ -4779,7 +4782,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (!mPowerManager.isInteractive()) {
useHapticFeedback = false; // suppress feedback if already non-interactive
}
- sleepPress(event);
+ if (down) {
+ sleepPress(event.getEventTime());
+ } else {
+ sleepRelease(event.getEventTime());
+ }
break;
}