diff options
author | Bryce Lee <brycelee@google.com> | 2014-11-21 19:27:55 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-21 19:27:55 +0000 |
commit | 296ea9174222e64085a66a238e6df13b8b378b1e (patch) | |
tree | 2606a06396cb893fe145f30e4e8e00a130c2b6f4 /core/java | |
parent | 879a4ee8b09e879de890dbbbc34629cd297572eb (diff) | |
parent | deee5566417af229a142cf8c1964e98a356513e4 (diff) | |
download | frameworks_base-296ea9174222e64085a66a238e6df13b8b378b1e.zip frameworks_base-296ea9174222e64085a66a238e6df13b8b378b1e.tar.gz frameworks_base-296ea9174222e64085a66a238e6df13b8b378b1e.tar.bz2 |
am deee5566: am d45cedd6: Merge "Make default windows features configurable." into lmp-mr1-dev
* commit 'deee5566417af229a142cf8c1964e98a356513e4':
Make default windows features configurable.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/view/Window.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 0076abf..2e5c1e0 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.content.res.Configuration; +import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; @@ -155,6 +156,7 @@ public abstract class Window { "android:navigation:background"; /** The default features enabled */ + @Deprecated @SuppressWarnings({"PointlessBitwiseExpression"}) protected static final int DEFAULT_FEATURES = (1 << FEATURE_OPTIONS_PANEL) | (1 << FEATURE_CONTEXT_MENU); @@ -183,8 +185,8 @@ public abstract class Window { private boolean mSetCloseOnTouchOutside = false; private int mForcedWindowFlags = 0; - private int mFeatures = DEFAULT_FEATURES; - private int mLocalFeatures = DEFAULT_FEATURES; + private int mFeatures; + private int mLocalFeatures; private boolean mHaveWindowFormat = false; private boolean mHaveDimAmount = false; @@ -442,6 +444,7 @@ public abstract class Window { public Window(Context context) { mContext = context; + mFeatures = mLocalFeatures = getDefaultFeatures(context); } /** @@ -1270,6 +1273,25 @@ public abstract class Window { } /** + * Return the feature bits set by default on a window. + * @param context The context used to access resources + */ + public static int getDefaultFeatures(Context context) { + int features = 0; + + final Resources res = context.getResources(); + if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureOptionsPanel)) { + features |= 1 << FEATURE_OPTIONS_PANEL; + } + + if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureContextMenu)) { + features |= 1 << FEATURE_CONTEXT_MENU; + } + + return features; + } + + /** * Query for the availability of a certain feature. * * @param feature The feature ID to check |