From dd8846886aa21980ecdca7ba42deac4f7ecd8ff0 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Sun, 11 Oct 2009 16:57:08 -0400 Subject: [PATCH] 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 --- services/java/com/android/server/WindowManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 00636c400ae52..20b01d2d745a7 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -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) {