summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-09-02 11:59:08 -0400
committerMike Lockwood <lockwood@android.com>2011-09-02 11:59:08 -0400
commitdb97f60054b6011fbcc1baf29a68b940b53046c0 (patch)
tree6dfcc0110676e1990a348a17dc52029a8dfd1e32 /services
parentbffb83e96c2f3d01bf42490737201ab4de79c91b (diff)
downloadframeworks_base-db97f60054b6011fbcc1baf29a68b940b53046c0.zip
frameworks_base-db97f60054b6011fbcc1baf29a68b940b53046c0.tar.gz
frameworks_base-db97f60054b6011fbcc1baf29a68b940b53046c0.tar.bz2
Fix logic for power button overridding the "wait for prox negative state" after a call
When in a phone call, we keep the screen off while the prox sensor returns positive and the device is oriented in a vertical position. If the call is terminated on the other end, we keep the screen off until the proximity sensor returns negative. We do this to avoid having the screen turn on as soon as the other end hangs up while the phone is still next to your head. However, we allow the power button to wake the screen while waiting for the proximity sensor to go negative as a precaution in case there is a problem with the proximity sensor. But unfortunately that logic broke due to a change in the call path used to turn the screen on from the power button (it previously called userActivity, now it uses a wake lock). This change adds code to handle the new code path so the power button will wake the screen while we are waiting for the proximity sensor to go negative after a call. Bug: 5184524 Change-Id: I7d1e0f0d1f78680c552a05d68a392647823250ab Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index cbd986f..bbc26d6 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -853,6 +853,14 @@ public class PowerManagerService extends IPowerManager.Stub
if ((wl.flags & PowerManager.ACQUIRE_CAUSES_WAKEUP) != 0) {
int oldWakeLockState = mWakeLockState;
mWakeLockState = mLocks.reactivateScreenLocksLocked();
+
+ // Disable proximity sensor if if user presses power key while we are in the
+ // "waiting for proximity sensor to go negative" state.
+ if ((mWakeLockState & SCREEN_ON_BIT) != 0
+ && mProximitySensorActive && mProximityWakeLockCount == 0) {
+ mProximitySensorActive = false;
+ }
+
if (mSpew) {
Slog.d(TAG, "wakeup here mUserState=0x" + Integer.toHexString(mUserState)
+ " mWakeLockState=0x"