Fix race condition in WindowManagerService.disableKeyguard()

TokenWatcher.acquire() synchronizes on mTokens, not this,
so we need to synchronize on mKeyguardDisabled in disableKeyguard()
to synchronize properly with reenableKeyguard().

This should fix b/2180142 (Stuck in enable keyguard when receiving phone call)

Change-Id: Iad66a2748c7fbf2c516fdb8a00988696719ea80c
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2009-10-11 16:57:08 -04:00
parent 6dc3f4e553
commit dd8846886a

View File

@@ -3971,7 +3971,9 @@ public class WindowManagerService extends IWindowManager.Stub
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Requires DISABLE_KEYGUARD permission");
}
mKeyguardDisabled.acquire(token, tag);
synchronized (mKeyguardDisabled) {
mKeyguardDisabled.acquire(token, tag);
}
}
public void reenableKeyguard(IBinder token) {