diff options
Diffstat (limited to 'core/java/android/view/Window.java')
| -rw-r--r-- | core/java/android/view/Window.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 06974d3..fcf0924 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -740,6 +740,10 @@ public abstract class Window { * @see #clearFlags */ public void setFlags(int flags, int mask) { + if ((flags & mask & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0){ + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", + "No permission to prevent power key"); + } final WindowManager.LayoutParams attrs = getAttributes(); attrs.flags = (attrs.flags&~mask) | (flags&mask); if ((mask&WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0) { @@ -779,6 +783,10 @@ public abstract class Window { * current values. */ public void setAttributes(WindowManager.LayoutParams a) { + if ((a.flags & WindowManager.LayoutParams.PREVENT_POWER_KEY) != 0) { + mContext.enforceCallingOrSelfPermission("android.permission.PREVENT_POWER_KEY", + "No permission to prevent power key"); + } mWindowAttributes.copyFrom(a); if (mCallback != null) { mCallback.onWindowAttributesChanged(mWindowAttributes); |
