diff options
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index bc08f34..cb150dc 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -153,6 +153,7 @@ import static android.view.WindowManagerPolicy.WindowManagerFuncs.LID_CLOSED; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVER_ABSENT; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_UNCOVERED; import static android.view.WindowManagerPolicy.WindowManagerFuncs.CAMERA_LENS_COVERED; +import static org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD; /** * WindowManagerPolicy implementation for the Android phone UI. This @@ -274,6 +275,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // app shows again. If that doesn't happen for 30s we drop the gesture. private static final long PANIC_GESTURE_EXPIRATION = 30000; + private static final String DEPRECATED_THIRD_PARTY_KEYGUARD_PERMISSION = + "android.permission.THIRD_PARTY_KEYGUARD"; + /** * Keyguard stuff */ @@ -2306,8 +2310,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { outAppOp[0] = AppOpsManager.OP_SYSTEM_ALERT_WINDOW; break; case TYPE_KEYGUARD_PANEL: - permission = - org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD; + permission = THIRD_PARTY_KEYGUARD; break; default: permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW; @@ -2342,6 +2345,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { return WindowManagerGlobal.ADD_OKAY; } } + } else if (permission == THIRD_PARTY_KEYGUARD) { + // check if caller has the old permission and if so allow adding window + if (mContext.checkCallingOrSelfPermission( + DEPRECATED_THIRD_PARTY_KEYGUARD_PERMISSION) + == PackageManager.PERMISSION_GRANTED) { + return WindowManagerGlobal.ADD_OKAY; + } + // fall through to the normal check below } if (mContext.checkCallingOrSelfPermission(permission) @@ -2871,9 +2882,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { "PhoneWindowManager"); break; case TYPE_KEYGUARD_PANEL: - mContext.enforceCallingOrSelfPermission( - org.cyanogenmod.platform.internal.Manifest.permission.THIRD_PARTY_KEYGUARD, - "PhoneWindowManager"); + // check deprecated perm first and if not granted enforce the new permission name + if (mContext.checkCallingOrSelfPermission( + DEPRECATED_THIRD_PARTY_KEYGUARD_PERMISSION) + != PackageManager.PERMISSION_GRANTED) { + mContext.enforceCallingOrSelfPermission(THIRD_PARTY_KEYGUARD, + "PhoneWindowManager"); + } if (mKeyguardPanel != null) { return WindowManagerGlobal.ADD_MULTIPLE_SINGLETON; } |