diff options
| author | Danesh M <daneshm90@gmail.com> | 2012-11-29 22:26:21 -0500 |
|---|---|---|
| committer | Danesh Mondegarian <daneshm90@gmail.com> | 2012-12-01 12:11:11 -0500 |
| commit | 15661444ae1faea831218f0c936b756de2f0698b (patch) | |
| tree | 4d48a05744611ee7290ab2a066cf378252243496 /core/java | |
| parent | bf79e387e59813060b2b0b36d954c110c91c790c (diff) | |
| download | frameworks_base-15661444ae1faea831218f0c936b756de2f0698b.zip frameworks_base-15661444ae1faea831218f0c936b756de2f0698b.tar.gz frameworks_base-15661444ae1faea831218f0c936b756de2f0698b.tar.bz2 | |
Camera : Powerkey shutter (1/2)
Allows user to take use power key to take pictures/videos
Change-Id: I85a1e1761199f4604672be42a3a5005227f5451a
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/Window.java | 8 | ||||
| -rw-r--r-- | core/java/android/view/WindowManager.java | 4 |
2 files changed, 12 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); diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 3b31ff6..bb859ed 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -804,6 +804,10 @@ public interface WindowManager extends ViewManager { * {@hide} */ public static final int FLAG_SYSTEM_ERROR = 0x40000000; + /** Window flag: Overrides default power key behavior + @{hide} */ + public static final int PREVENT_POWER_KEY = 0x80000000; + /** * Various behavioral options/flags. Default is none. * |
