diff options
author | Bryce Lee <brycelee@google.com> | 2014-11-21 11:08:45 -0800 |
---|---|---|
committer | Bryce Lee <brycelee@google.com> | 2014-11-21 11:08:45 -0800 |
commit | d6e6e7235a7e5c82d64beada54ac89c2b1dec201 (patch) | |
tree | f51bdf6a7ae3687cac6a64ced2957f3bb01a2d47 /core | |
parent | a6d2789c954698f6dca5479b305689d22fc05d80 (diff) | |
download | frameworks_base-d6e6e7235a7e5c82d64beada54ac89c2b1dec201.zip frameworks_base-d6e6e7235a7e5c82d64beada54ac89c2b1dec201.tar.gz frameworks_base-d6e6e7235a7e5c82d64beada54ac89c2b1dec201.tar.bz2 |
Make default windows features configurable.
Bug: 18434078
Change-Id: I0bafce1a201088a8681f4b9e43237e23b49296a2
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/Window.java | 26 | ||||
-rw-r--r-- | core/res/res/values-watch/config.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/config.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 3 |
4 files changed, 34 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 diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 6052fb0..3eede32 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -40,4 +40,7 @@ Reduced intentionally for watches to retain minimal memory footprint --> <integer name="config_notificationServiceArchiveSize">1</integer> + <!-- Flags enabling default window features. See Window.java --> + <bool name="config_defaultWindowFeatureOptionsPanel">false</bool> + <bool name="config_defaultWindowFeatureContextMenu">false</bool> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6e635f3..bb2ee48 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1927,6 +1927,10 @@ <!-- Show the next-alarm as a zen exit condition if it occurs in the next n hours. --> <integer name="config_next_alarm_condition_lookahead_threshold_hrs">12</integer> + <!-- Flags enabling default window features. See Window.java --> + <bool name="config_defaultWindowFeatureOptionsPanel">true</bool> + <bool name="config_defaultWindowFeatureContextMenu">true</bool> + <!-- This config is used to check if the carrier requires converting destination number before sending out a SMS. Formats for this configuration as below: diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index cbc379b..880561d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2115,6 +2115,9 @@ <java-symbol type="bool" name="config_switch_phone_on_voice_reg_state_change" /> <java-symbol type="string" name="whichHomeApplicationNamed" /> <java-symbol type="bool" name="config_sms_force_7bit_encoding" /> + <java-symbol type="bool" name="config_defaultWindowFeatureOptionsPanel" /> + <java-symbol type="bool" name="config_defaultWindowFeatureContextMenu" /> + <java-symbol type="layout" name="simple_account_item" /> <java-symbol type="id" name="scrollIndicatorUp" /> <java-symbol type="id" name="scrollIndicatorDown" /> |