summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/PowerManagerService.java
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-11-18 15:37:10 -0500
committerMike Lockwood <lockwood@android.com>2009-11-18 18:45:59 -0500
commit0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f (patch)
treea4ef4b0b89816adc34b10618889aa4021867c58f /services/java/com/android/server/PowerManagerService.java
parent30998a59aced3248b3a6f5e507dba0394fb54cad (diff)
downloadframeworks_base-0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f.zip
frameworks_base-0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f.tar.gz
frameworks_base-0e39ea83c5578e0d55e120c91ff7cfeeb0c1cb2f.tar.bz2
Fixes for proximity sensor behavior:
Add optional flag to Wakelock.release() to specify whether we should wait for proximity sensor to go negative before turning on the screen. Clear the "waiting for proximity sensor to go negative" state when the power key is pressed. Part of the fix for b/2243198 (Black screen lockup after ending call) Change-Id: I813fdb7aa4192cd3384a25be9e59d7d4b90da53a Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services/java/com/android/server/PowerManagerService.java')
-rw-r--r--services/java/com/android/server/PowerManagerService.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 94cf6d4..444c8de 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -309,7 +309,7 @@ class PowerManagerService extends IPowerManager.Stub
public void release() {
if (!mRefCounted || --mCount == 0) {
- PowerManagerService.this.releaseWakeLockLocked(mToken, false);
+ PowerManagerService.this.releaseWakeLockLocked(mToken, 0, false);
mHeld = false;
}
if (mCount < 0) {
@@ -556,7 +556,7 @@ class PowerManagerService extends IPowerManager.Stub
}
public void binderDied() {
synchronized (mLocks) {
- releaseWakeLockLocked(this.binder, true);
+ releaseWakeLockLocked(this.binder, 0, true);
}
}
final int flags;
@@ -701,18 +701,18 @@ class PowerManagerService extends IPowerManager.Stub
}
}
- public void releaseWakeLock(IBinder lock) {
+ public void releaseWakeLock(IBinder lock, int flags) {
int uid = Binder.getCallingUid();
if (uid != Process.myUid()) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.WAKE_LOCK, null);
}
synchronized (mLocks) {
- releaseWakeLockLocked(lock, false);
+ releaseWakeLockLocked(lock, flags, false);
}
}
- private void releaseWakeLockLocked(IBinder lock, boolean death) {
+ private void releaseWakeLockLocked(IBinder lock, int flags, boolean death) {
int releaseUid;
String releaseName;
int releaseType;
@@ -744,7 +744,8 @@ class PowerManagerService extends IPowerManager.Stub
} else if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
mProximityWakeLockCount--;
if (mProximityWakeLockCount == 0) {
- if (mProximitySensorActive) {
+ if (mProximitySensorActive &&
+ ((flags & PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE) != 0)) {
// wait for proximity sensor to go negative before disabling sensor
if (mDebugProximitySensor) {
Log.d(TAG, "waiting for proximity sensor to go negative");
@@ -1923,6 +1924,11 @@ class PowerManagerService extends IPowerManager.Stub
Log.d(TAG, "ignoring user activity while turning off screen");
return;
}
+ // Disable proximity sensor if if user presses power key while we are in the
+ // "waiting for proximity sensor to go negative" state.
+ if (mProximitySensorActive && mProximityWakeLockCount == 0) {
+ mProximitySensorActive = false;
+ }
if (mLastEventTime <= time || force) {
mLastEventTime = time;
if ((mUserActivityAllowed && !mProximitySensorActive) || force) {