From 3107d99e54795a4fadc5448014ffe2a1f8de7ce3 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Tue, 21 Nov 2017 15:56:19 -0800 Subject: [PATCH] Add config flag to enable/disable nav bar auto dim Added a configuration flag to enable whether to auto dim the navigation bar when wallpaper changes to be invisible such as launching an opaque app. OLED devices should have this flag on to prevent/reduce burn and off for everything else to avoid extra cpu cycles rendering an alpha animation. By default this is on. Test: manual Change-Id: I57ab2a6414b5f6c34e11911346ad4c4d3aac33d0 Fixes: 68812918 (cherry picked from commit 4096e8d028da778f0afbda7df92d6de741650629) --- packages/SystemUI/res/values/config.xml | 6 ++++++ .../statusbar/phone/NavigationBarTransitions.java | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index e313e868022d6..b5abb4576147e 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -95,6 +95,12 @@ false + + true + false diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java index b81a3b0416a40..bd6421c209800 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java @@ -26,7 +26,6 @@ import android.view.IWallpaperVisibilityListener; import android.view.IWindowManager; import android.view.MotionEvent; import android.view.View; -import android.view.WindowManagerGlobal; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.Dependency; @@ -37,6 +36,7 @@ public final class NavigationBarTransitions extends BarTransitions { private final NavigationBarView mView; private final IStatusBarService mBarService; private final LightBarTransitionsController mLightTransitionsController; + private final boolean mAllowAutoDimWallpaperNotVisible; private boolean mWallpaperVisible; private boolean mLightsOut; @@ -49,6 +49,8 @@ public final class NavigationBarTransitions extends BarTransitions { ServiceManager.getService(Context.STATUS_BAR_SERVICE)); mLightTransitionsController = new LightBarTransitionsController(view.getContext(), this::applyDarkIntensity); + mAllowAutoDimWallpaperNotVisible = view.getContext().getResources() + .getBoolean(R.bool.config_navigation_bar_enable_auto_dim_no_visible_wallpaper); IWindowManager windowManagerService = Dependency.get(IWindowManager.class); Handler handler = Handler.getMain(); @@ -80,8 +82,8 @@ public final class NavigationBarTransitions extends BarTransitions { @Override protected boolean isLightsOut(int mode) { - return super.isLightsOut(mode) || (mAutoDim && !mWallpaperVisible - && mode != MODE_WARNING); + return super.isLightsOut(mode) || (mAllowAutoDimWallpaperNotVisible && mAutoDim + && !mWallpaperVisible && mode != MODE_WARNING); } public LightBarTransitionsController getLightTransitionsController() {