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>
This commit is contained in:
Mike Lockwood
2009-11-05 20:53:00 -05:00
parent 092f03418a
commit 0d72f7e9fc

View File

@ -2349,11 +2349,9 @@ class PowerManagerService extends IPowerManager.Stub
} finally {
Binder.restoreCallingIdentity(identity);
}
synchronized (mLocks) {
if (mProximitySensorActive) {
mProximitySensorActive = false;
forceUserActivityLocked();
}
if (mProximitySensorActive) {
mProximitySensorActive = false;
forceUserActivityLocked();
}
}
@ -2361,6 +2359,10 @@ class PowerManagerService extends IPowerManager.Stub
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;