Fix a race condition that could result in the screen being forced off indefinitely after a phone call.
This should fix a "black screen" bug that Motorola identified.
mProximitySensorActive was being set to true due to a proximity sensor change being posted
just after we disabled the proximity sensor.
Now we ignore proximity changes after the phone app releases the proximity lock after the call is done.
Change-Id: I417d423de3d43515389b1b7b008cdcb795cd10f6
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index a03ac6c..611a86e 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2349,11 +2349,9 @@
} finally {
Binder.restoreCallingIdentity(identity);
}
- synchronized (mLocks) {
- if (mProximitySensorActive) {
- mProximitySensorActive = false;
- forceUserActivityLocked();
- }
+ if (mProximitySensorActive) {
+ mProximitySensorActive = false;
+ forceUserActivityLocked();
}
}
@@ -2361,6 +2359,10 @@
if (mSpew) {
Log.d(TAG, "proximityChangedLocked, active: " + active);
}
+ if (mProximityCount <= 0) {
+ Log.d(TAG, "Ignoring proximity change after last proximity lock is released");
+ return;
+ }
if (active) {
goToSleepLocked(SystemClock.uptimeMillis());
mProximitySensorActive = true;