From 936f7e26cff0c4893a75ef18757efda0bd8d91df Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Fri, 20 May 2016 12:57:43 -0700 Subject: fw: Repurpose PREVENT_POWER_KEY for preventing multiple system keys. Allows applications like camera, and various testing applications, to intercept certain system keys to verify behavior or leverage it in creative ways. Limited to signature/privileged. Change-Id: Iacd8735af2aabafbf1fc062d8c565b7102dc6865 TICKET: FEIJ-522 --- core/java/android/view/Window.java | 6 +++--- core/java/android/view/WindowManager.java | 4 ++-- core/res/AndroidManifest.xml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'core') diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 3616622..5811ef9 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -869,9 +869,9 @@ public abstract class Window { } private void setPrivateFlags(int flags, int mask) { - if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY) != 0){ - mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", - "No permission to prevent power key"); + if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0){ + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS", + "No permission to prevent system key"); } final WindowManager.LayoutParams attrs = getAttributes(); attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 1125b44..c7a9650 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1154,10 +1154,10 @@ public interface WindowManager extends ViewManager { public static final int PRIVATE_FLAG_WAS_NOT_FULLSCREEN = 0x02000000; /** - * Window flag: Overrides default power key behavior + * Window flag: Overrides default system key behavior. * {@hide} */ - public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000; + public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x20000000; /** * Window flag: adding additional blur layer and set this as masking layer diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index a6de699..ea0e39c 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1239,10 +1239,10 @@ - - -- cgit v1.1