diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
index 75bf2813a3213..13acde2062472 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
@@ -121,8 +121,8 @@ fun FooterActions(
}
}
- val backgroundColor = colorAttr(R.attr.underSurfaceColor)
- val contentColor = LocalAndroidColorScheme.current.deprecated.textColorPrimary
+ val backgroundColor = colorAttr(R.attr.underSurface)
+ val contentColor = LocalAndroidColorScheme.current.onSurface
val backgroundTopRadius = dimensionResource(R.dimen.qs_corner_radius)
val backgroundModifier =
remember(
@@ -268,7 +268,7 @@ private fun NumberButton(
val interactionSource = remember { MutableInteractionSource() }
Expandable(
- color = colorAttr(R.attr.offStateColor),
+ color = colorAttr(R.attr.shadeInactive),
shape = CircleShape,
onClick = onClick,
interactionSource = interactionSource,
@@ -287,7 +287,7 @@ private fun NumberButton(
number.toString(),
modifier = Modifier.align(Alignment.Center),
style = MaterialTheme.typography.bodyLarge,
- color = LocalAndroidColorScheme.current.deprecated.textColorPrimary,
+ color = colorAttr(R.attr.onShadeInactiveVariant),
// TODO(b/242040009): This should only use a standard text style instead and
// should not override the text size.
fontSize = 18.sp,
@@ -305,7 +305,7 @@ private fun NumberButton(
@Composable
private fun NewChangesDot(modifier: Modifier = Modifier) {
val contentDescription = stringResource(R.string.fgs_dot_content_description)
- val color = LocalAndroidColorScheme.current.deprecated.colorAccentTertiary
+ val color = LocalAndroidColorScheme.current.tertiary
Canvas(modifier.size(12.dp).semantics { this.contentDescription = contentDescription }) {
drawCircle(color)
@@ -323,10 +323,9 @@ private fun TextButton(
) {
Expandable(
shape = CircleShape,
- color = colorAttr(R.attr.underSurfaceColor),
- contentColor = LocalAndroidColorScheme.current.deprecated.textColorSecondary,
- borderStroke =
- BorderStroke(1.dp, LocalAndroidColorScheme.current.deprecated.colorBackground),
+ color = colorAttr(R.attr.underSurface),
+ contentColor = LocalAndroidColorScheme.current.onSurfaceVariant,
+ borderStroke = BorderStroke(1.dp, colorAttr(R.attr.onShadeActive)),
modifier = modifier.padding(horizontal = 4.dp),
onClick = onClick,
) {
diff --git a/packages/SystemUI/res-keyguard/color/shade_disabled.xml b/packages/SystemUI/res-keyguard/color/shade_disabled.xml
new file mode 100644
index 0000000000000..241f20385eb49
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/color/shade_disabled.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res-keyguard/layout/footer_actions_number_button.xml b/packages/SystemUI/res-keyguard/layout/footer_actions_number_button.xml
index a7ffe9ca256f4..c09607d19bdd0 100644
--- a/packages/SystemUI/res-keyguard/layout/footer_actions_number_button.xml
+++ b/packages/SystemUI/res-keyguard/layout/footer_actions_number_button.xml
@@ -26,7 +26,7 @@
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.QS.SecurityFooter"
android:layout_gravity="center"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="?attr/onShadeInactiveVariant"
android:textSize="18sp"/>
+ android:tint="?attr/onSurfaceVariant" />
+ android:textColor="?attr/onSurfaceVariant"/>
+ android:tint="?attr/onSurfaceVariant" />
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/brightness_mirror_background.xml b/packages/SystemUI/res/drawable/brightness_mirror_background.xml
index 209510365fe0e..b5c181bd896c7 100644
--- a/packages/SystemUI/res/drawable/brightness_mirror_background.xml
+++ b/packages/SystemUI/res/drawable/brightness_mirror_background.xml
@@ -15,6 +15,6 @@
~ limitations under the License
-->
-
+
diff --git a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
index 569ee76586c23..95c7778c0e769 100644
--- a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
+++ b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml
index 4d9188c40822c..2ea90c7178630 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">
-
+
@@ -34,7 +34,7 @@
android:right="@dimen/rounded_slider_icon_inset">
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/fgs_dot.xml b/packages/SystemUI/res/drawable/fgs_dot.xml
index 3669e1d3c3743..0881d7c5c2b53 100644
--- a/packages/SystemUI/res/drawable/fgs_dot.xml
+++ b/packages/SystemUI/res/drawable/fgs_dot.xml
@@ -19,5 +19,5 @@
android:shape="oval"
android:width="12dp"
android:height="12dp">
-
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml b/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml
index ea0aafd321e1e..e138d094f8697 100644
--- a/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml
+++ b/packages/SystemUI/res/drawable/qs_customizer_background_primary.xml
@@ -15,7 +15,7 @@
-->
-
+
diff --git a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
index ef950fe67ad2f..f1a24aa7af9d0 100644
--- a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
+++ b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
@@ -15,6 +15,6 @@
-->
-
+
diff --git a/packages/SystemUI/res/drawable/qs_footer_action_circle.xml b/packages/SystemUI/res/drawable/qs_footer_action_circle.xml
index c8c36b0081c03..4a5d4af964976 100644
--- a/packages/SystemUI/res/drawable/qs_footer_action_circle.xml
+++ b/packages/SystemUI/res/drawable/qs_footer_action_circle.xml
@@ -28,7 +28,7 @@
-
-
+
diff --git a/packages/SystemUI/res/drawable/qs_footer_action_circle_color.xml b/packages/SystemUI/res/drawable/qs_footer_action_circle_color.xml
index 6a365000a21c2..a8c034986425c 100644
--- a/packages/SystemUI/res/drawable/qs_footer_action_circle_color.xml
+++ b/packages/SystemUI/res/drawable/qs_footer_action_circle_color.xml
@@ -28,7 +28,7 @@
-
-
+
diff --git a/packages/SystemUI/res/drawable/qs_footer_actions_background.xml b/packages/SystemUI/res/drawable/qs_footer_actions_background.xml
index c9517cd905dc9..a7e8762a25937 100644
--- a/packages/SystemUI/res/drawable/qs_footer_actions_background.xml
+++ b/packages/SystemUI/res/drawable/qs_footer_actions_background.xml
@@ -15,7 +15,7 @@
-->
-
+
diff --git a/packages/SystemUI/res/drawable/qs_security_footer_background.xml b/packages/SystemUI/res/drawable/qs_security_footer_background.xml
index 381af503d47c0..0b0055b1f020c 100644
--- a/packages/SystemUI/res/drawable/qs_security_footer_background.xml
+++ b/packages/SystemUI/res/drawable/qs_security_footer_background.xml
@@ -29,7 +29,7 @@
-
+ android:color="?attr/shadeInactive"/>
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index 745cfc6c16553..b8f4c0f212c33 100644
--- a/packages/SystemUI/res/layout/qs_footer_impl.xml
+++ b/packages/SystemUI/res/layout/qs_footer_impl.xml
@@ -53,6 +53,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
+ android:tint="?attr/shadeActive"
android:visibility="gone" />
+ android:tint="?attr/onSurfaceVariant" />
diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml
index c124aea01afca..974cad32f9376 100644
--- a/packages/SystemUI/res/layout/qs_tile_label.xml
+++ b/packages/SystemUI/res/layout/qs_tile_label.xml
@@ -54,6 +54,6 @@
android:focusable="false"
android:importantForAccessibility="no"
android:textAppearance="@style/TextAppearance.QS.TileLabel.Secondary"
- android:textColor="?android:attr/textColorSecondary"/>
+ android:textColor="?attr/onShadeInactive"/>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index 3a1d1a8cbf9db..d693631080af7 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -118,8 +118,25 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index f16d9aaa8c71a..fd74c7eae361a 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -83,7 +83,7 @@
@@ -93,7 +93,7 @@
@@ -278,10 +278,10 @@
-
+
@@ -390,8 +406,15 @@
- @android:color/transparent
-
+
+
+
@@ -605,11 +628,11 @@
- 0.01
- 20sp
- @*android:string/config_headlineFontFamily
- - ?android:attr/textColorSecondary
+ - ?attr/onSurfaceVariant
@@ -1111,6 +1134,11 @@
- ?androidprv:attr/materialColorOnPrimaryFixed
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/qs/external/TileRequestDialog.kt b/packages/SystemUI/src/com/android/systemui/qs/external/TileRequestDialog.kt
index 6265b3c056e70..3432628e6d67f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/external/TileRequestDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/external/TileRequestDialog.kt
@@ -18,6 +18,7 @@ package com.android.systemui.qs.external
import android.content.Context
import android.graphics.drawable.Icon
+import android.view.ContextThemeWrapper
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.TextView
@@ -66,7 +67,8 @@ class TileRequestDialog(
}
private fun createTileView(tileData: TileData): QSTileView {
- val tile = QSTileViewImpl(context, QSIconViewImpl(context), true)
+ val themedContext = ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings)
+ val tile = QSTileViewImpl(themedContext, QSIconViewImpl(themedContext), true)
val state = QSTile.BooleanState().apply {
label = tileData.label
handlesLongClick = false
diff --git a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/binder/FooterActionsViewBinder.kt b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/binder/FooterActionsViewBinder.kt
index 9c9ad33e4918f..3c53d77c6beb2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/binder/FooterActionsViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/binder/FooterActionsViewBinder.kt
@@ -244,8 +244,8 @@ class FooterActionsViewBinder @Inject constructor() {
val backgroundResource =
when (model.backgroundColor) {
- R.attr.offStateColor -> R.drawable.qs_footer_action_circle
- com.android.internal.R.attr.colorAccent -> R.drawable.qs_footer_action_circle_color
+ R.attr.shadeInactive -> R.drawable.qs_footer_action_circle
+ R.attr.shadeActive -> R.drawable.qs_footer_action_circle_color
else -> error("Unsupported icon background resource ${model.backgroundColor}")
}
buttonView.setBackgroundResource(backgroundResource)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
index b3596a254b7d2..32146b5b00e4a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt
@@ -145,8 +145,12 @@ class FooterActionsViewModel(
R.drawable.ic_settings,
ContentDescription.Resource(R.string.accessibility_quick_settings_settings)
),
- iconTint = null,
- backgroundColor = R.attr.offStateColor,
+ iconTint =
+ Utils.getColorAttrDefaultColor(
+ context,
+ R.attr.onShadeInactiveVariant,
+ ),
+ backgroundColor = R.attr.shadeInactive,
this::onSettingsButtonClicked,
)
@@ -162,9 +166,9 @@ class FooterActionsViewModel(
iconTint =
Utils.getColorAttrDefaultColor(
context,
- com.android.internal.R.attr.textColorOnAccent,
+ R.attr.onShadeActive,
),
- backgroundColor = com.android.internal.R.attr.colorAccent,
+ backgroundColor = R.attr.shadeActive,
this::onPowerButtonClicked,
)
} else {
@@ -264,7 +268,7 @@ class FooterActionsViewModel(
),
),
iconTint = null,
- backgroundColor = R.attr.offStateColor,
+ backgroundColor = R.attr.shadeInactive,
onClick = this::onUserSwitcherClicked,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
index e54168162de6e..7e45491adc830 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java
@@ -248,13 +248,11 @@ public class QSIconViewImpl extends QSIconView {
*/
private static int getIconColorForState(Context context, QSTile.State state) {
if (state.disabledByPolicy || state.state == Tile.STATE_UNAVAILABLE) {
- return Utils.getColorAttrDefaultColor(
- context, com.android.internal.R.attr.textColorTertiary);
+ return Utils.getColorAttrDefaultColor(context, R.attr.outline);
} else if (state.state == Tile.STATE_INACTIVE) {
- return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary);
+ return Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactiveVariant);
} else if (state.state == Tile.STATE_ACTIVE) {
- return Utils.getColorAttrDefaultColor(context,
- com.android.internal.R.attr.textColorOnAccent);
+ return Utils.getColorAttrDefaultColor(context, R.attr.onShadeActive);
} else {
Log.e("QSIconView", "Invalid state " + state);
return 0;
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 b80668379e49c..d81e4c229aa7c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
@@ -29,6 +29,7 @@ import android.os.Trace
import android.service.quicksettings.Tile
import android.text.TextUtils
import android.util.Log
+import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@@ -92,24 +93,21 @@ open class QSTileViewImpl @JvmOverloads constructor(
updateHeight()
}
- private val colorActive = Utils.getColorAttrDefaultColor(context,
- com.android.internal.R.attr.colorAccentPrimary)
- private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.offStateColor)
- private val colorUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorInactive)
+ private val colorActive = Utils.getColorAttrDefaultColor(context, R.attr.shadeActive)
+ private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.shadeInactive)
+ private val colorUnavailable = Utils.getColorAttrDefaultColor(context, R.attr.shadeDisabled)
- private val colorLabelActive =
- Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorOnAccent)
- private val colorLabelInactive =
- Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
+ private val colorLabelActive = Utils.getColorAttrDefaultColor(context, R.attr.onShadeActive)
+ private val colorLabelInactive = Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactive)
private val colorLabelUnavailable =
- Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorTertiary)
+ Utils.getColorAttrDefaultColor(context, R.attr.outline)
private val colorSecondaryLabelActive =
- Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondaryInverse)
+ Utils.getColorAttrDefaultColor(context, R.attr.onShadeActiveVariant)
private val colorSecondaryLabelInactive =
- Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary)
+ Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactiveVariant)
private val colorSecondaryLabelUnavailable =
- Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorTertiary)
+ Utils.getColorAttrDefaultColor(context, R.attr.outline)
private lateinit var label: TextView
protected lateinit var secondaryLabel: TextView
@@ -151,6 +149,11 @@ open class QSTileViewImpl @JvmOverloads constructor(
private val locInScreen = IntArray(2)
init {
+ val typedValue = TypedValue()
+ if (!getContext().theme.resolveAttribute(R.attr.isQsTheme, typedValue, true)) {
+ throw IllegalStateException("QSViewImpl must be inflated with a theme that contains " +
+ "Theme.SystemUI.QuickSettings")
+ }
setId(generateViewId())
orientation = LinearLayout.HORIZONTAL
gravity = Gravity.CENTER_VERTICAL or Gravity.START
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.kt
index a60dad4a14fe0..fe6c9b3fe7b11 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.kt
@@ -15,9 +15,11 @@ package com.android.systemui.qs
import android.graphics.Rect
import android.testing.AndroidTestingRunner
+import android.testing.TestableContext
import android.testing.TestableLooper
import android.testing.TestableLooper.RunWithLooper
import android.testing.ViewUtils
+import android.view.ContextThemeWrapper
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.accessibility.AccessibilityNodeInfo
@@ -55,19 +57,24 @@ class QSPanelTest : SysuiTestCase() {
private lateinit var footer: View
+ private val themedContext = TestableContext(
+ ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings)
+ )
+
@Before
@Throws(Exception::class)
fun setup() {
MockitoAnnotations.initMocks(this)
testableLooper = TestableLooper.get(this)
+ // Apply only the values of the theme that are not defined
testableLooper.runWithLooper {
- qsPanel = QSPanel(context, null)
+ qsPanel = QSPanel(themedContext, null)
qsPanel.mUsingMediaPlayer = true
qsPanel.initialize(qsLogger)
// QSPanel inflates a footer inside of it, mocking it here
- footer = LinearLayout(context).apply { id = R.id.qs_footer }
+ footer = LinearLayout(themedContext).apply { id = R.id.qs_footer }
qsPanel.addView(footer, MATCH_PARENT, 100)
qsPanel.onFinishInflate()
// Provides a parent with non-zero size for QSPanel
@@ -105,12 +112,12 @@ class QSPanelTest : SysuiTestCase() {
qsPanel.tileLayout?.addTile(
QSPanelControllerBase.TileRecord(
mock(QSTile::class.java),
- QSTileViewImpl(context, QSIconViewImpl(context))
+ QSTileViewImpl(themedContext, QSIconViewImpl(themedContext))
)
)
- val mediaView = FrameLayout(context)
- mediaView.addView(View(context), MATCH_PARENT, 800)
+ val mediaView = FrameLayout(themedContext)
+ mediaView.addView(View(themedContext), MATCH_PARENT, 800)
qsPanel.setUsingHorizontalLayout(/* horizontal */ true, mediaView, /* force */ true)
qsPanel.measure(
@@ -135,12 +142,12 @@ class QSPanelTest : SysuiTestCase() {
qsPanel.tileLayout?.addTile(
QSPanelControllerBase.TileRecord(
mock(QSTile::class.java),
- QSTileViewImpl(context, QSIconViewImpl(context))
+ QSTileViewImpl(themedContext, QSIconViewImpl(themedContext))
)
)
- val mediaView = FrameLayout(context)
- mediaView.addView(View(context), MATCH_PARENT, 800)
+ val mediaView = FrameLayout(themedContext)
+ mediaView.addView(View(themedContext), MATCH_PARENT, 800)
qsPanel.setUsingHorizontalLayout(/* horizontal */ true, mediaView, /* force */ true)
qsPanel.measure(
@@ -161,7 +168,10 @@ class QSPanelTest : SysuiTestCase() {
@Test
fun testBottomPadding() {
val padding = 10
- context.orCreateTestableResources.addOverride(R.dimen.qs_panel_padding_bottom, padding)
+ themedContext.orCreateTestableResources.addOverride(
+ R.dimen.qs_panel_padding_bottom,
+ padding
+ )
qsPanel.updatePadding()
assertThat(qsPanel.paddingBottom).isEqualTo(padding)
}
@@ -170,8 +180,11 @@ class QSPanelTest : SysuiTestCase() {
fun testTopPadding() {
val padding = 10
val paddingCombined = 100
- context.orCreateTestableResources.addOverride(R.dimen.qs_panel_padding_top, padding)
- context.orCreateTestableResources.addOverride(R.dimen.qs_panel_padding_top, paddingCombined)
+ themedContext.orCreateTestableResources.addOverride(R.dimen.qs_panel_padding_top, padding)
+ themedContext.orCreateTestableResources.addOverride(
+ R.dimen.qs_panel_padding_top,
+ paddingCombined
+ )
qsPanel.updatePadding()
assertThat(qsPanel.paddingTop).isEqualTo(paddingCombined)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
index 87892539ccfe0..f55ef65a8fc1d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java
@@ -26,12 +26,14 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.TestableLooper;
+import android.view.ContextThemeWrapper;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
@@ -56,14 +58,17 @@ public class TileLayoutTest extends SysuiTestCase {
private Resources mResources;
private int mLayoutSizeForOneTile;
private TileLayout mTileLayout; // under test
+ private Context mSpyContext;
+
@Before
public void setUp() throws Exception {
- Context context = Mockito.spy(mContext);
- mResources = Mockito.spy(context.getResources());
- Mockito.when(mContext.getResources()).thenReturn(mResources);
+ mSpyContext = Mockito.spy(
+ new ContextThemeWrapper(mContext, R.style.Theme_SystemUI_QuickSettings));
+ mResources = Mockito.spy(mSpyContext.getResources());
+ when(mSpyContext.getResources()).thenReturn(mResources);
- mTileLayout = new TileLayout(context);
+ mTileLayout = new TileLayout(mSpyContext);
// Layout needs to leave space for the tile margins. Three times the margin size is
// sufficient for any number of columns.
mLayoutSizeForOneTile =
@@ -73,7 +78,7 @@ public class TileLayoutTest extends SysuiTestCase {
private QSPanelControllerBase.TileRecord createTileRecord() {
return new QSPanelControllerBase.TileRecord(
mock(QSTile.class),
- spy(new QSTileViewImpl(mContext, new QSIconViewImpl(mContext))));
+ spy(new QSTileViewImpl(mSpyContext, new QSIconViewImpl(mSpyContext))));
}
@Test
@@ -161,7 +166,7 @@ public class TileLayoutTest extends SysuiTestCase {
.layout(left2.capture(), top2.capture(), right2.capture(), bottom2.capture());
// We assume two tiles will always fit side-by-side.
- assertTrue(mContext.getResources().getInteger(R.integer.quick_settings_num_columns) > 1);
+ assertTrue(mSpyContext.getResources().getInteger(R.integer.quick_settings_num_columns) > 1);
// left <= right, top <= bottom
assertTrue(left1.getValue() <= right1.getValue());
@@ -218,16 +223,16 @@ public class TileLayoutTest extends SysuiTestCase {
@Test
public void resourcesChanged_updateResources_returnsTrue() {
- Mockito.when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(1);
+ when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(1);
mTileLayout.updateResources(); // setup with 1
- Mockito.when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(2);
+ when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(2);
assertEquals(true, mTileLayout.updateResources());
}
@Test
public void resourcesSame_updateResources_returnsFalse() {
- Mockito.when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(1);
+ when(mResources.getInteger(R.integer.quick_settings_num_columns)).thenReturn(1);
mTileLayout.updateResources(); // setup with 1
assertEquals(false, mTileLayout.updateResources());
@@ -250,7 +255,7 @@ public class TileLayoutTest extends SysuiTestCase {
QSPanelControllerBase.TileRecord tileRecord = createTileRecord();
mTileLayout.addTile(tileRecord);
- FakeTileView tileView = new FakeTileView(mContext);
+ FakeTileView tileView = new FakeTileView(mSpyContext);
QSTile.State state = new QSTile.State();
state.label = "TEST LABEL";
state.secondaryLabel = "TEST SECONDARY LABEL";
@@ -276,9 +281,10 @@ public class TileLayoutTest extends SysuiTestCase {
}
private void changeFontScaling(float scale) {
- Configuration configuration = new Configuration(mContext.getResources().getConfiguration());
+ Configuration configuration =
+ new Configuration(mSpyContext.getResources().getConfiguration());
configuration.fontScale = scale;
// updateConfiguration could help update on both resource configuration and displayMetrics
- mContext.getResources().updateConfiguration(configuration, null, null);
+ mSpyContext.getResources().updateConfiguration(configuration, null, null);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt
index 2cc6709d0f37d..d647d6add512c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt
@@ -21,6 +21,7 @@ import android.os.UserManager
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.testing.TestableLooper.RunWithLooper
+import android.view.ContextThemeWrapper
import androidx.test.filters.SmallTest
import com.android.settingslib.Utils
import com.android.settingslib.drawable.UserIconDrawable
@@ -63,6 +64,8 @@ class FooterActionsViewModelTest : SysuiTestCase() {
private val testScope = TestScope()
private lateinit var utils: FooterActionsTestUtils
+ private val themedContext = ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings)
+
@Before
fun setUp() {
utils = FooterActionsTestUtils(context, TestableLooper.get(this), testScope.testScheduler)
@@ -84,8 +87,14 @@ class FooterActionsViewModelTest : SysuiTestCase() {
ContentDescription.Resource(R.string.accessibility_quick_settings_settings)
)
)
- assertThat(settings.backgroundColor).isEqualTo(R.attr.offStateColor)
- assertThat(settings.iconTint).isNull()
+ assertThat(settings.backgroundColor).isEqualTo(R.attr.shadeInactive)
+ assertThat(settings.iconTint)
+ .isEqualTo(
+ Utils.getColorAttrDefaultColor(
+ themedContext,
+ R.attr.onShadeInactiveVariant,
+ )
+ )
}
@Test
@@ -105,12 +114,12 @@ class FooterActionsViewModelTest : SysuiTestCase() {
ContentDescription.Resource(R.string.accessibility_quick_settings_power_menu)
)
)
- assertThat(power.backgroundColor).isEqualTo(com.android.internal.R.attr.colorAccent)
+ assertThat(power.backgroundColor).isEqualTo(R.attr.shadeActive)
assertThat(power.iconTint)
.isEqualTo(
Utils.getColorAttrDefaultColor(
- context,
- com.android.internal.R.attr.textColorOnAccent,
+ themedContext,
+ R.attr.onShadeActive,
),
)
}
@@ -170,7 +179,7 @@ class FooterActionsViewModelTest : SysuiTestCase() {
assertThat(userSwitcher).isNotNull()
assertThat(userSwitcher!!.icon)
.isEqualTo(Icon.Loaded(picture, ContentDescription.Loaded("Signed in as foo")))
- assertThat(userSwitcher.backgroundColor).isEqualTo(R.attr.offStateColor)
+ assertThat(userSwitcher.backgroundColor).isEqualTo(R.attr.shadeInactive)
// Change the current user name.
userSwitcherControllerWrapper.currentUserName = "bar"
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt
index 28aeba461c50c..3c667725c78ae 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt
@@ -22,6 +22,7 @@ import android.service.quicksettings.Tile
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.text.TextUtils
+import android.view.ContextThemeWrapper
import android.view.View
import android.view.accessibility.AccessibilityNodeInfo
import android.widget.TextView
@@ -386,7 +387,11 @@ class QSTileViewImplTest : SysuiTestCase() {
context: Context,
icon: QSIconView,
collapsed: Boolean
- ) : QSTileViewImpl(context, icon, collapsed) {
+ ) : QSTileViewImpl(
+ ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings),
+ icon,
+ collapsed
+ ) {
fun changeState(state: QSTile.State) {
handleStateChanged(state)
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DndTileTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DndTileTest.kt
index f0e4e3adda7c7..77a4436664427 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DndTileTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DndTileTest.kt
@@ -25,6 +25,7 @@ import android.provider.Settings.Global.ZEN_MODE_NO_INTERRUPTIONS
import android.provider.Settings.Global.ZEN_MODE_OFF
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
+import android.view.ContextThemeWrapper
import android.view.View
import androidx.test.filters.SmallTest
import com.android.internal.logging.MetricsLogger
@@ -110,7 +111,9 @@ class DndTileTest : SysuiTestCase() {
whenever(qsHost.userId).thenReturn(DEFAULT_USER)
- val wrappedContext = object : ContextWrapper(context) {
+ val wrappedContext = object : ContextWrapper(
+ ContextThemeWrapper(context, R.style.Theme_SystemUI_QuickSettings)
+ ) {
override fun getSharedPreferences(file: File?, mode: Int): SharedPreferences {
return sharedPreferences
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
index 44613103a5b24..dae9c975b9976 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java
@@ -20,8 +20,10 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import android.content.Context;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
@@ -48,7 +50,9 @@ public class ShadeCarrierTest extends SysuiTestCase {
@Before
public void setUp() throws Exception {
mTestableLooper = TestableLooper.get(this);
- LayoutInflater inflater = LayoutInflater.from(mContext);
+ Context themedContext =
+ new ContextThemeWrapper(mContext, R.style.Theme_SystemUI_QuickSettings);
+ LayoutInflater inflater = LayoutInflater.from(themedContext);
mContext.ensureTestableResources();
mTestableLooper.runWithLooper(() ->
mShadeCarrier = (ShadeCarrier) inflater.inflate(R.layout.shade_carrier, null));