diff options
author | Jim Miller <jaggies@google.com> | 2014-11-14 17:56:27 -0800 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2014-11-14 18:24:27 -0800 |
commit | 96afb6f03b87359c3bcb96c2bdb8aadc7b1c3c37 (patch) | |
tree | 47fb7e902b18f540b540551554cba7807ec9200e /packages/SystemUI/src/com/android/systemui/keyguard | |
parent | bba231d7a63b58a8c2b174722ed1487b0f7d8270 (diff) | |
download | frameworks_base-96afb6f03b87359c3bcb96c2bdb8aadc7b1c3c37.zip frameworks_base-96afb6f03b87359c3bcb96c2bdb8aadc7b1c3c37.tar.gz frameworks_base-96afb6f03b87359c3bcb96c2bdb8aadc7b1c3c37.tar.bz2 |
Fix deadlock caused by synchronous setOccluded() method in keyguard
This fixes a deadlock where WindowManagerService can call into
KeyguardService.setOccluded() while holding a lock. As soon as keyguard
receives the call, it immediately needs to check permission and calls
back into the system service which is waiting for the lock to be
released. Boom!
The fix does a quick check of the calling UID and allows the call
if coming from the System UID, thus bypassing the need for a
binder call to checkPermission().
Fixes bug 18362246
Change-Id: Iab4be8a885f330fb2a62ee7e3579966e1447f8b0
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/keyguard')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java index ee699d2..98d4112 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java @@ -22,6 +22,7 @@ import android.os.Binder; import android.os.Bundle; import android.os.Debug; import android.os.IBinder; +import android.os.Process; import android.util.Log; import android.view.MotionEvent; @@ -52,6 +53,10 @@ public class KeyguardService extends Service { } void checkPermission() { + // Avoid deadlock by avoiding calling back into the system process. + if (Binder.getCallingUid() == Process.SYSTEM_UID) return; + + // Otherwise,explicitly check for caller permission ... if (getBaseContext().checkCallingOrSelfPermission(PERMISSION) != PERMISSION_GRANTED) { Log.w(TAG, "Caller needs permission '" + PERMISSION + "' to call " + Debug.getCaller()); throw new SecurityException("Access denied to process: " + Binder.getCallingPid() |