diff options
author | Scott Mertz <scott@cyngn.com> | 2016-05-31 17:28:29 -0700 |
---|---|---|
committer | Scott Mertz <scott@cyngn.com> | 2016-05-31 17:41:40 -0700 |
commit | 44e91e0ed2b3056e30ccfbb009be5f19495061ce (patch) | |
tree | 4b1646abc97826072927489ae3e1eb87b9769fe4 /core | |
parent | 70d2082f7d7253f8cf5d578507f44fd6e28ce706 (diff) | |
download | frameworks_base-44e91e0ed2b3056e30ccfbb009be5f19495061ce.zip frameworks_base-44e91e0ed2b3056e30ccfbb009be5f19495061ce.tar.gz frameworks_base-44e91e0ed2b3056e30ccfbb009be5f19495061ce.tar.bz2 |
fw: reintroduce PRIVATE_FLAG_PREVENT_POWER_KEY
Switching the PREVENT_SYSTEM_KEYS forces the application to handle
every system key. Some apps may not want to handle every single key,
so allow them to just handle the power key.
CYNGNOS-2958
Change-Id: I43fd65e67b909e6d52548f110ff9997b829b3e15
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/Window.java | 5 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 5811ef9..65577f0 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -869,7 +869,10 @@ public abstract class Window { } private void setPrivateFlags(int flags, int mask) { - if ((flags & mask & WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS) != 0){ + int preventFlags = WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_POWER_KEY | + WindowManager.LayoutParams.PRIVATE_FLAG_PREVENT_SYSTEM_KEYS; + + if ((flags & mask & preventFlags) != 0) { mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_SYSTEM_KEYS", "No permission to prevent system key"); } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index c7a9650..36f593e 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1157,7 +1157,13 @@ public interface WindowManager extends ViewManager { * Window flag: Overrides default system key behavior. * {@hide} */ - public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x20000000; + public static final int PRIVATE_FLAG_PREVENT_SYSTEM_KEYS = 0x10000000; + + /** + * Window flag: Overrides default system key behavior. + * {@hide} + */ + public static final int PRIVATE_FLAG_PREVENT_POWER_KEY = 0x20000000; /** * Window flag: adding additional blur layer and set this as masking layer |