am cd75f59f: Merge "Fix deadlock caused by synchronous setOccluded() method in keyguard" into lmp-mr1-dev

* commit 'cd75f59f8cdeda95a50155ad0c9f4abd559037ec':
  Fix deadlock caused by synchronous setOccluded() method in keyguard
This commit is contained in:
Jim Miller
2014-11-17 19:34:37 +00:00
committed by Android Git Automerger

View File

@@ -22,6 +22,7 @@ import android.os.Binder;
import android.os.Bundle; import android.os.Bundle;
import android.os.Debug; import android.os.Debug;
import android.os.IBinder; import android.os.IBinder;
import android.os.Process;
import android.util.Log; import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
@@ -52,6 +53,10 @@ public class KeyguardService extends Service {
} }
void checkPermission() { 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) { if (getBaseContext().checkCallingOrSelfPermission(PERMISSION) != PERMISSION_GRANTED) {
Log.w(TAG, "Caller needs permission '" + PERMISSION + "' to call " + Debug.getCaller()); Log.w(TAG, "Caller needs permission '" + PERMISSION + "' to call " + Debug.getCaller());
throw new SecurityException("Access denied to process: " + Binder.getCallingPid() throw new SecurityException("Access denied to process: " + Binder.getCallingPid()