summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/Window.java
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2012-11-29 22:26:21 -0500
committerSteve Kondik <steve@cyngn.com>2015-10-23 16:27:01 -0500
commit8611337102e48b61932bfae32d860807ee5ee2ac (patch)
treeca5dcbf906bcd381b59e26a2db58c7f0b86439c4 /core/java/android/view/Window.java
parent877e66164ac51a61a700d5adb66a64f187e54740 (diff)
downloadframeworks_base-8611337102e48b61932bfae32d860807ee5ee2ac.zip
frameworks_base-8611337102e48b61932bfae32d860807ee5ee2ac.tar.gz
frameworks_base-8611337102e48b61932bfae32d860807ee5ee2ac.tar.bz2
Camera : allow camera to use power key as shutter
Provides a way for an app to take control of the power key. Used by the camera to make the power key control the shutter. Change-Id: I85a1e1761199f4604672be42a3a5005227f5451a (cherry picked from commit 15661444ae1faea831218f0c936b756de2f0698b) Prevent power key capture when screen is off The ability for an activity to capture the power key, which was added to support power key as shutter in the camera, should only allow the capture when the screen is on. Otherwise, if an activity that captures the power key is to the front when the device turns off, the user will be unable to turn it back on. Change-Id: Ib119d6914ec72554b404c1cc17eef3a932d5d402
Diffstat (limited to 'core/java/android/view/Window.java')
-rw-r--r--core/java/android/view/Window.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 07984e9..284e12c 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -843,6 +843,10 @@ 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");
+ }
final WindowManager.LayoutParams attrs = getAttributes();
attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask);
dispatchWindowAttributesChanged(attrs);