From c0aadaca1ab833a13ecacc48cf5c458427f8f6b4 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Mon, 11 Oct 2021 19:24:58 -0700 Subject: [PATCH 14/22] 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 Change-Id: I3d45b72f0f119e100505409d178ab8f698993881 --- .../brightness_progress_full_drawable.xml | 2 +- .../qs_footer_action_chip_background.xml | 8 +------- .../qs_security_footer_background.xml | 3 +-- packages/SystemUI/res/values-night/styles.xml | 12 +++++++++++ packages/SystemUI/res/values/styles.xml | 10 +++++----- .../systemui/privacy/OngoingPrivacyChip.kt | 4 ++-- .../systemui/qs/tileimpl/QSTileViewImpl.kt | 2 +- .../statusbar/phone/ScrimController.java | 2 +- .../systemui/statusbar/phone/ScrimState.java | 20 +++++++++---------- 9 files changed, 34 insertions(+), 29 deletions(-) diff --git a/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml index 4d9188c40822..1eae667c6e79 100644 --- a/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml +++ b/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml @@ -22,7 +22,7 @@ android:height="@dimen/rounded_slider_height"> - + diff --git a/packages/SystemUI/res/drawable/qs_footer_action_chip_background.xml b/packages/SystemUI/res/drawable/qs_footer_action_chip_background.xml index 9076da795e71..3aefc95a98b5 100644 --- a/packages/SystemUI/res/drawable/qs_footer_action_chip_background.xml +++ b/packages/SystemUI/res/drawable/qs_footer_action_chip_background.xml @@ -28,13 +28,7 @@ - - - - - - - + diff --git a/packages/SystemUI/res/drawable/qs_security_footer_background.xml b/packages/SystemUI/res/drawable/qs_security_footer_background.xml index 860d23b11439..8f12b95ed4f6 100644 --- a/packages/SystemUI/res/drawable/qs_security_footer_background.xml +++ b/packages/SystemUI/res/drawable/qs_security_footer_background.xml @@ -28,8 +28,7 @@ - + diff --git a/packages/SystemUI/res/values-night/styles.xml b/packages/SystemUI/res/values-night/styles.xml index ffcc3a821d36..a9fa9f3f9fde 100644 --- a/packages/SystemUI/res/values-night/styles.xml +++ b/packages/SystemUI/res/values-night/styles.xml @@ -24,6 +24,18 @@ true + + @@ -619,7 +619,7 @@ diff --git a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt index 9cd97ff8e343..461f67935a11 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt @@ -90,8 +90,8 @@ class OngoingPrivacyChip @JvmOverloads constructor( .getDimensionPixelSize(R.dimen.ongoing_appops_chip_icon_margin) iconSize = context.resources .getDimensionPixelSize(R.dimen.ongoing_appops_chip_icon_size) - iconColor = - Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.colorPrimary) + iconColor = context.resources + .getColor(android.R.color.system_neutral1_900) val padding = context.resources .getDimensionPixelSize(R.dimen.ongoing_appops_chip_side_padding) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index 222539d49526..da7c63ff15a3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -70,7 +70,7 @@ open class QSTileViewImpl @JvmOverloads constructor( override var heightOverride: Int = HeightOverrideable.NO_OVERRIDE private val colorActive = Utils.getColorAttrDefaultColor(context, - com.android.internal.R.attr.colorAccentPrimary) + android.R.attr.colorAccent) private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.offStateColor) private val colorUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorInactive) 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 27c129ad34c5..6bdf82a60e40 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -692,7 +692,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.SHADE_LOCKED) { 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 15b8c67fd4ba..577e33c3c8d6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -88,7 +88,7 @@ public enum ScrimState { mNotifAlpha = mClipQsScrim ? mScrimBehindAlphaKeyguard : 0; mBubbleAlpha = 0; if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } }, @@ -114,7 +114,7 @@ public enum ScrimState { @Override public void prepare(ScrimState previousState) { mBehindAlpha = mClipQsScrim ? 1 : mDefaultScrimAlpha; - mBehindTint = mClipQsScrim ? Color.BLACK : Color.TRANSPARENT; + mBehindTint = Color.TRANSPARENT; mNotifAlpha = mClipQsScrim ? mDefaultScrimAlpha : 0; mNotifTint = Color.TRANSPARENT; mFrontAlpha = 0f; @@ -141,17 +141,17 @@ public enum ScrimState { mNotifAlpha = 1f; mBubbleAlpha = 0f; mFrontAlpha = 0f; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } // to make sure correct color is returned before "prepare" is called @Override public int getBehindTint() { - return Color.BLACK; + return Color.TRANSPARENT; } }, @@ -248,27 +248,27 @@ public enum ScrimState { mAnimateChange = !mLaunchingAffordanceWithPreview && !fromAod; mFrontTint = Color.TRANSPARENT; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; mBubbleTint = Color.TRANSPARENT; mBlankScreen = false; if (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 */); if (mScrimForBubble != null) { updateScrimColor(mScrimForBubble, 1f /* alpha */, Color.BLACK /* tint */); } // Scrims should still be black at the end of the transition. mFrontTint = Color.BLACK; - mBehindTint = Color.BLACK; + mBehindTint = Color.TRANSPARENT; mBubbleTint = Color.BLACK; mBlankScreen = true; } if (mClipQsScrim) { - updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK); + updateScrimColor(mScrimBehind, 1f /* alpha */, Color.TRANSPARENT); } } }, @@ -468,4 +468,4 @@ public enum ScrimState { public void setClipQsScrim(boolean clipsQsScrim) { mClipQsScrim = clipsQsScrim; } -} \ No newline at end of file +} -- 2.25.1