From dd73ee4d0a33aa9a423b80471aec6d1ec81a6c82 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 11 Oct 2013 22:19:59 -0400 Subject: Add a config resource to enable translucent bars globally. Setting config_enableTranslucentDecor to false will not prevent clients from adding FLAG_TRANSLUCENT_NAVIGATION or STATUS to the window or using the TransluentDecor themes, but it will prevent View.STATUS_BAR_TRANSLUCENT and View.NAVIGATION_BAR_TRANSLUCENT from being propagated to the SystemUI so these requests will not be honored. Bug: 11182618 Change-Id: I8be6a3a565acf0987ff12f18f1c7e67c96d563c3 --- core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + .../internal/policy/impl/PhoneWindowManager.java | 20 +++++++++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 196be74..42ea384 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -588,6 +588,9 @@ false + + true + true diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 0b050c7..611c085 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1295,6 +1295,7 @@ + diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 5ac3ed0..539d0a0 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -297,6 +297,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; boolean mHasSoftInput = false; boolean mTouchExplorationEnabled = false; + boolean mTranslucentDecorEnabled = true; int mPointerLocationMode = 0; // guarded by mLock @@ -901,6 +902,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { com.android.internal.R.integer.config_lidNavigationAccessibility); mLidControlsSleep = mContext.getResources().getBoolean( com.android.internal.R.bool.config_lidControlsSleep); + mTranslucentDecorEnabled = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_enableTranslucentDecor); readConfigurationDependentBehaviors(); // register for dock events @@ -2703,7 +2706,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean immersiveSticky = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0; boolean navAllowedHidden = immersive || immersiveSticky; navTranslucent &= !immersiveSticky; // transient trumps translucent - navTranslucent &= isTranslucentNavigationAllowed(); + navTranslucent &= areTranslucentBarsAllowed(); // When the navigation bar isn't visible, we put up a fake // input window to catch all touch events. This way we can @@ -2824,6 +2827,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean statusBarTransient = (sysui & View.STATUS_BAR_TRANSIENT) != 0; boolean statusBarTranslucent = (sysui & View.STATUS_BAR_TRANSLUCENT) != 0; + statusBarTranslucent &= areTranslucentBarsAllowed(); // If the status bar is hidden, we don't want to cause // windows behind it to scroll. @@ -5116,8 +5120,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { vis = (vis & ~flags) | (oldVis & flags); } - if (!isTranslucentNavigationAllowed()) { - vis &= ~View.NAVIGATION_BAR_TRANSLUCENT; + if (!areTranslucentBarsAllowed()) { + vis &= ~(View.NAVIGATION_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSLUCENT); } // update status bar @@ -5182,11 +5186,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** - * @return whether the navigation bar can be made translucent, e.g. touch - * exploration is not enabled + * @return whether the navigation or status bar can be made translucent + * + * This should return true unless touch exploration is not enabled or + * R.boolean.config_enableTranslucentDecor is false. */ - private boolean isTranslucentNavigationAllowed() { - return !mTouchExplorationEnabled; + private boolean areTranslucentBarsAllowed() { + return mTranslucentDecorEnabled && !mTouchExplorationEnabled; } // Use this instead of checking config_showNavigationBar so that it can be consistently -- cgit v1.1