From 5f65456d8135c74d48cd0528fdf7005e235ffd43 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 11 Oct 2021 19:24:58 -0700 Subject: [PATCH 20/34] SystemUI: Follow light/dark theme in quick settings Android 12's dual-tone style where the quick settings panel is always dark makes the light theme look like a second-class citizen. Pure black also looks out-of-place next to QS tiles and the notification panel because dynamic themes don't affect it at all. Revert to the ~Beta 1 style where quick settings used the same theme as the notification shade. - colorAccentPrimary has been replaced with colorAccent for contrast in light mode, because colorAccentPrimary is system_accent1_100 (dark accent color) - Footer chips have been converted to surfaces (similar to QS tiles and notifications), which makes more sense with the new style - The QS background is now the same as the notification shade background in both light and dark modes Demo screenshots (with dual-tone commit): https://twitter.com/kdrag0n/status/1445922541218922496 [kdrag0n: ported to 12L] [neobuddy89: adapted for 14QPR1] TODO: Fix QS customizer background in light theme Change-Id: I3d45b72f0f119e100505409d178ab8f698993881 Signed-off-by: Pranav Vashi --- packages/SystemUI/res/values-night/styles.xml | 31 ++++++++++++++++++- packages/SystemUI/res/values/styles.xml | 20 ++++++------ .../statusbar/phone/ScrimController.java | 2 +- .../systemui/statusbar/phone/ScrimState.java | 16 +++++----- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/packages/SystemUI/res/values-night/styles.xml b/packages/SystemUI/res/values-night/styles.xml index b6971d3c1fa4..8972df2b7490 100644 --- a/packages/SystemUI/res/values-night/styles.xml +++ b/packages/SystemUI/res/values-night/styles.xml @@ -14,7 +14,8 @@ limitations under the License. --> - + + + @@ -663,7 +663,7 @@ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 05904eae769c..1130585db0c7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -945,7 +945,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump mNotificationsAlpha = behindAlpha; mNotificationsTint = behindTint; mBehindAlpha = 1; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; } else { mBehindAlpha = behindAlpha; if (mState == ScrimState.KEYGUARD && mTransitionToFullShadeProgress > 0.0f) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java index e3b65ab27f48..44297566d0f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -82,7 +82,7 @@ public enum ScrimState { mBehindAlpha = mClipQsScrim ? 1 : mScrimBehindAlphaKeyguard; mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0; if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } }, @@ -122,7 +122,7 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; - mBehindTint = mClipQsScrim ? Color.BLACK : mSurfaceColor; + mBehindTint = mSurfaceColor; mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0; mNotifTint = Color.TRANSPARENT; mFrontAlpha = 0f; @@ -154,10 +154,10 @@ public enum ScrimState { mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; mNotifAlpha = 1f; mFrontAlpha = 0f; - mBehindTint = mClipQsScrim ? Color.TRANSPARENT : Color.BLACK; + mBehindTint = Color.TRANSPARENT; if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } }, @@ -259,22 +259,22 @@ public enum ScrimState { && !fromAod; mFrontTint = Color.TRANSPARENT; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; mBlankScreen = false; if (mDisplayRequiresBlanking && previousState == ScrimState.AOD) { // Set all scrims black, before they fade transparent. updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */); - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT /* tint */); // Scrims should still be black at the end of the transition. mFrontTint = Color.BLACK; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; mBlankScreen = true; } if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } }, -- 2.34.1