diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 5f5004d7137..a91c5856040 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3950,6 +3950,12 @@ public boolean validate(String value) { */ public static final String QUICK_SETTINGS_TILES_VIBRATE = "quick_settings_vibrate"; + /** + * Dyanamic Navbar Switch + * @hide + */ + public static final String NAV_BAR_DYNAMIC = "nav_bar_dynamic"; + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 6fb6f34287d..2e304ec84cd 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -49,6 +49,7 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.RemoteException; +import android.provider.Settings; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; @@ -1264,6 +1265,8 @@ private void updateColorViewTranslations() { private WindowInsets updateStatusGuard(WindowInsets insets) { boolean showStatusGuard = false; + boolean isDynamic = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NAV_BAR_DYNAMIC, 0) == 1; // Show the status guard when the non-overlay contextual action bar is showing if (mPrimaryActionModeView != null) { if (mPrimaryActionModeView.getLayoutParams() instanceof MarginLayoutParams) { @@ -1287,8 +1290,13 @@ private WindowInsets updateStatusGuard(WindowInsets insets) { if (mStatusGuard == null) { mStatusGuard = new View(mContext); - mStatusGuard.setBackgroundColor(mContext.getColor( - R.color.input_method_navigation_guard)); + if (!isDynamic) { + mStatusGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard)); + } else { + mStatusGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard_dynamic)); + } addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), new LayoutParams(LayoutParams.MATCH_PARENT, mlp.topMargin, Gravity.START | Gravity.TOP)); @@ -1333,10 +1341,13 @@ private WindowInsets updateStatusGuard(WindowInsets insets) { } private WindowInsets updateNavigationGuard(WindowInsets insets) { + boolean isDynamic = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.NAV_BAR_DYNAMIC, 0) == 1; // IME windows lay out below the nav bar, but the content view must not (for back compat) // Only make this adjustment if the window is not requesting layout in overscan if (mWindow.getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD && (mWindow.getAttributes().flags & FLAG_LAYOUT_IN_OVERSCAN) == 0) { + // prevent the content view from including the nav bar height if (mWindow.mContentParent != null) { if (mWindow.mContentParent.getLayoutParams() instanceof MarginLayoutParams) { @@ -1349,8 +1360,13 @@ private WindowInsets updateNavigationGuard(WindowInsets insets) { // position the navigation guard view, creating it if necessary if (mNavigationGuard == null) { mNavigationGuard = new View(mContext); - mNavigationGuard.setBackgroundColor(mContext.getColor( - R.color.input_method_navigation_guard)); + if (!isDynamic) { + mNavigationGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard)); + } else { + mNavigationGuard.setBackgroundColor(mContext.getColor( + R.color.input_method_navigation_guard_dynamic)); + } addView(mNavigationGuard, indexOfChild(mNavigationColorViewState.view), new LayoutParams(LayoutParams.MATCH_PARENT, insets.getSystemWindowInsetBottom(), diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 3b280ad20d4..f6a03327dd0 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -23,6 +23,7 @@ import android.app.ActivityManagerNative; import android.app.SearchManager; +import android.database.ContentObserver; import android.os.UserHandle; import android.text.TextUtils; @@ -2407,7 +2408,13 @@ protected ViewGroup generateLayout(DecorView decor) { mStatusBarColor = a.getColor(R.styleable.Window_statusBarColor, 0xFF000000); } if (!mForcedNavigationBarColor) { - mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000); + boolean isDynamic = Settings.System.getInt(getContext().getContentResolver(), + Settings.System.NAV_BAR_DYNAMIC, 0) == 1; + if (!isDynamic) { + mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000); + } else { + mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColordynamic, 0xFF000000); + } } WindowManager.LayoutParams params = getAttributes(); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 066a5381d56..817a781ef22 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -2003,6 +2003,16 @@ i Corresponds to {@link android.view.Window#setNavigationBarColor(int)}. --> + + + #fff4511e diff --git a/core/res/res/values/dnd_strings.xml b/core/res/res/values/dnd_strings.xml index 59604bcf919..7d05680e027 100644 --- a/core/res/res/values/dnd_strings.xml +++ b/core/res/res/values/dnd_strings.xml @@ -18,4 +18,7 @@ Restart SystemUIService so that system bars can load themed resources + + + diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index b19858ef194..aea1397a5a3 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -570,6 +570,7 @@ easier. @color/primary_device_default_light @color/primary_dark_device_default_light @color/accent_device_default_light + @android:color/transparent @android:color/transparent @android:color/transparent + @android:color/transparent true @null 0.35 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index f33e44c2a29..4313460919d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -333,6 +333,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, Settings.Secure.QS_COLUMNS; private static final String STATUS_BAR_SHOW_CARRIER = "system:" + Settings.System.STATUS_BAR_SHOW_CARRIER; + private static final String NAV_BAR_DYNAMIC = + "system:" + Settings.System.NAV_BAR_DYNAMIC; static { boolean onlyCoreApps; @@ -811,7 +813,8 @@ public void start() { QS_ROWS_PORTRAIT, QS_ROWS_LANDSCAPE, QS_COLUMNS, - STATUS_BAR_SHOW_CARRIER); + STATUS_BAR_SHOW_CARRIER, + NAV_BAR_DYNAMIC); // Lastly, call to the icon policy to install/update all the icons. mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController, mCastController, @@ -5541,6 +5544,11 @@ public void onTuningChanged(String key, String newValue) { newValue == null ? 1 : Integer.parseInt(newValue); updateCarrier(); break; + case NAV_BAR_DYNAMIC: + if (mNavigationController != null) { + mNavigationController.updateNavbarOverlay(mContext.getResources()); + } + break; default: break; }