summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt17
-rw-r--r--packages/SystemUI/res-keyguard/color/shade_disabled.xml19
-rw-r--r--packages/SystemUI/res-keyguard/layout/footer_actions_number_button.xml2
-rw-r--r--packages/SystemUI/res-keyguard/layout/footer_actions_text_button.xml6
-rw-r--r--packages/SystemUI/res/drawable/brightness_mirror_background.xml2
-rw-r--r--packages/SystemUI/res/drawable/brightness_progress_drawable.xml2
-rw-r--r--packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml4
-rw-r--r--packages/SystemUI/res/drawable/fgs_dot.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_customizer_background_primary.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_customizer_toolbar.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_dialog_btn_filled.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_dialog_btn_filled_large.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_dialog_btn_outline.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_footer_action_circle.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_footer_action_circle_color.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_footer_actions_background.xml2
-rw-r--r--packages/SystemUI/res/drawable/qs_security_footer_background.xml2
-rw-r--r--packages/SystemUI/res/layout/alert_dialog_title_systemui.xml2
-rw-r--r--packages/SystemUI/res/layout/qs_footer_impl.xml3
-rw-r--r--packages/SystemUI/res/layout/qs_tile_label.xml2
-rw-r--r--packages/SystemUI/res/layout/screen_record_dialog.xml9
-rw-r--r--packages/SystemUI/res/layout/screen_share_dialog.xml8
-rw-r--r--packages/SystemUI/res/values/attrs.xml21
-rw-r--r--packages/SystemUI/res/values/styles.xml73
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/external/TileRequestDialog.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/footer/ui/binder/FooterActionsViewBinder.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModel.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt27
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelTest.kt35
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java30
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/footer/ui/viewmodel/FooterActionsViewModelTest.kt21
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt7
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/tiles/DndTileTest.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/shade/carrier/ShadeCarrierTest.java6
35 files changed, 231 insertions, 120 deletions
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 75bf2813a321..13acde206247 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 000000000000..241f20385eb4
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/color/shade_disabled.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2023 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="4" />
+</selector> \ 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 a7ffe9ca256f..c09607d19bdd 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"/>
<ImageView
android:id="@+id/new_dot"
diff --git a/packages/SystemUI/res-keyguard/layout/footer_actions_text_button.xml b/packages/SystemUI/res-keyguard/layout/footer_actions_text_button.xml
index 6fe7d39f748a..1c31f1da0681 100644
--- a/packages/SystemUI/res-keyguard/layout/footer_actions_text_button.xml
+++ b/packages/SystemUI/res-keyguard/layout/footer_actions_text_button.xml
@@ -33,7 +33,7 @@
android:layout_marginEnd="12dp"
android:contentDescription="@null"
android:src="@drawable/ic_info_outline"
- android:tint="?android:attr/textColorSecondary" />
+ android:tint="?attr/onSurfaceVariant" />
<TextView
android:id="@+id/text"
@@ -43,7 +43,7 @@
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="@style/TextAppearance.QS.SecurityFooter"
- android:textColor="?android:attr/textColorSecondary"/>
+ android:textColor="?attr/onSurfaceVariant"/>
<ImageView
android:id="@+id/new_dot"
@@ -62,5 +62,5 @@
android:contentDescription="@null"
android:src="@*android:drawable/ic_chevron_end"
android:autoMirrored="true"
- android:tint="?android:attr/textColorSecondary" />
+ android:tint="?attr/onSurfaceVariant" />
</com.android.systemui.animation.view.LaunchableLinearLayout> \ 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 209510365fe0..b5c181bd896c 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
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="?attr/underSurfaceColor" />
+ <solid android:color="?attr/underSurface" />
<corners android:radius="@dimen/rounded_slider_background_rounded_corner" />
</shape>
diff --git a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
index 569ee76586c2..95c7778c0e76 100644
--- a/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
+++ b/packages/SystemUI/res/drawable/brightness_progress_drawable.xml
@@ -24,7 +24,7 @@
<shape>
<size android:height="@dimen/rounded_slider_track_width" />
<corners android:radius="@dimen/rounded_slider_track_corner_radius" />
- <solid android:color="?attr/offStateColor" />
+ <solid android:color="?attr/shadeInactive" />
</shape>
</inset>
</item>
diff --git a/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml b/packages/SystemUI/res/drawable/brightness_progress_full_drawable.xml
index 4d9188c40822..2ea90c717863 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">
<shape>
<size android:height="@dimen/rounded_slider_height" />
- <solid android:color="?priv-android:attr/colorAccentPrimary" />
+ <solid android:color="?attr/shadeActive" />
<corners android:radius="@dimen/rounded_slider_corner_radius"/>
</shape>
</item>
@@ -34,7 +34,7 @@
android:right="@dimen/rounded_slider_icon_inset">
<com.android.systemui.util.AlphaTintDrawableWrapper
android:drawable="@drawable/ic_brightness"
- android:tint="?android:attr/textColorPrimaryInverse"
+ android:tint="?attr/onShadeActive"
/>
</item>
</layer-list> \ 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 3669e1d3c374..0881d7c5c2b5 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">
- <solid android:color="?androidprv:attr/colorAccentTertiary" />
+ <solid android:color="?attr/tertiary" />
</shape> \ 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 ea0aafd321e1..e138d094f869 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 @@
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
- <solid android:color="?attr/underSurfaceColor"/>
+ <solid android:color="?attr/underSurface"/>
<corners android:radius="?android:attr/dialogCornerRadius" />
</shape>
</inset>
diff --git a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
index ef950fe67ad2..f1a24aa7af9d 100644
--- a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
+++ b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
@@ -15,6 +15,6 @@
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
- <solid android:color="?attr/underSurfaceColor"/>
+ <solid android:color="?attr/underSurface"/>
</shape>
</inset>
diff --git a/packages/SystemUI/res/drawable/qs_dialog_btn_filled.xml b/packages/SystemUI/res/drawable/qs_dialog_btn_filled.xml
index 14cb1de9fa2d..c4e45bf2c223 100644
--- a/packages/SystemUI/res/drawable/qs_dialog_btn_filled.xml
+++ b/packages/SystemUI/res/drawable/qs_dialog_btn_filled.xml
@@ -28,7 +28,7 @@
<item>
<shape android:shape="rectangle">
<corners android:radius="?android:attr/buttonCornerRadius"/>
- <solid android:color="?androidprv:attr/colorAccentPrimary"/>
+ <solid android:color="?androidprv:attr/materialColorPrimary"/>
<padding android:left="@dimen/dialog_button_horizontal_padding"
android:top="@dimen/dialog_button_vertical_padding"
android:right="@dimen/dialog_button_horizontal_padding"
diff --git a/packages/SystemUI/res/drawable/qs_dialog_btn_filled_large.xml b/packages/SystemUI/res/drawable/qs_dialog_btn_filled_large.xml
index 0544b871fa06..1590daa8b7f9 100644
--- a/packages/SystemUI/res/drawable/qs_dialog_btn_filled_large.xml
+++ b/packages/SystemUI/res/drawable/qs_dialog_btn_filled_large.xml
@@ -26,7 +26,7 @@
<item>
<shape android:shape="rectangle">
<corners android:radius="18dp"/>
- <solid android:color="?androidprv:attr/colorAccentPrimary"/>
+ <solid android:color="?androidprv:attr/materialColorPrimaryFixed"/>
</shape>
</item>
</ripple>
diff --git a/packages/SystemUI/res/drawable/qs_dialog_btn_outline.xml b/packages/SystemUI/res/drawable/qs_dialog_btn_outline.xml
index a47299d6f854..b0dc6523e971 100644
--- a/packages/SystemUI/res/drawable/qs_dialog_btn_outline.xml
+++ b/packages/SystemUI/res/drawable/qs_dialog_btn_outline.xml
@@ -29,7 +29,7 @@
<shape android:shape="rectangle">
<corners android:radius="?android:attr/buttonCornerRadius"/>
<solid android:color="@android:color/transparent"/>
- <stroke android:color="?androidprv:attr/colorAccentPrimaryVariant"
+ <stroke android:color="?androidprv:attr/materialColorPrimary"
android:width="1dp"
/>
<padding android:left="@dimen/dialog_button_horizontal_padding"
diff --git a/packages/SystemUI/res/drawable/qs_footer_action_circle.xml b/packages/SystemUI/res/drawable/qs_footer_action_circle.xml
index c8c36b0081c0..4a5d4af96497 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 @@
</item>
<item>
<shape android:shape="rectangle">
- <solid android:color="?attr/offStateColor"/>
+ <solid android:color="?attr/shadeInactive"/>
<corners android:radius="@dimen/qs_footer_action_corner_radius"/>
</shape>
</item>
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 6a365000a21c..a8c034986425 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 @@
</item>
<item>
<shape android:shape="rectangle">
- <solid android:color="?android:attr/colorAccent"/>
+ <solid android:color="?attr/shadeActive"/>
<corners android:radius="@dimen/qs_footer_action_corner_radius"/>
</shape>
</item>
diff --git a/packages/SystemUI/res/drawable/qs_footer_actions_background.xml b/packages/SystemUI/res/drawable/qs_footer_actions_background.xml
index c9517cd905dc..a7e8762a2593 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 @@
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android">
<shape>
- <solid android:color="?attr/underSurfaceColor"/>
+ <solid android:color="?attr/underSurface"/>
<corners android:topLeftRadius="@dimen/qs_corner_radius"
android:topRightRadius="@dimen/qs_corner_radius"/>
</shape>
diff --git a/packages/SystemUI/res/drawable/qs_security_footer_background.xml b/packages/SystemUI/res/drawable/qs_security_footer_background.xml
index 381af503d47c..0b0055b1f020 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 @@
<item>
<shape android:shape="rectangle">
<stroke android:width="1dp"
- android:color="?android:attr/colorBackground"/>
+ android:color="?attr/shadeInactive"/>
<corners android:radius="@dimen/qs_security_footer_corner_radius"/>
</shape>
</item>
diff --git a/packages/SystemUI/res/layout/alert_dialog_title_systemui.xml b/packages/SystemUI/res/layout/alert_dialog_title_systemui.xml
index 88f13b451bbe..ca7df86d8296 100644
--- a/packages/SystemUI/res/layout/alert_dialog_title_systemui.xml
+++ b/packages/SystemUI/res/layout/alert_dialog_title_systemui.xml
@@ -42,7 +42,7 @@
android:layout_marginBottom="16dp"
android:scaleType="fitCenter"
android:src="@null"
- android:tint="?androidprv:attr/colorAccentPrimaryVariant"
+ android:tint="?androidprv:attr/materialColorPrimary"
/>
<TextView
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index 745cfc6c1655..b8f4c0f212c3 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" />
<FrameLayout
@@ -70,7 +71,7 @@
android:focusable="true"
android:padding="@dimen/qs_footer_icon_padding"
android:src="@*android:drawable/ic_mode_edit"
- android:tint="?android:attr/textColorPrimary" />
+ android:tint="?attr/onSurfaceVariant" />
</FrameLayout>
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml
index c124aea01afc..974cad32f937 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"/>
</com.android.systemui.qs.tileimpl.IgnorableChildLinearLayout>
diff --git a/packages/SystemUI/res/layout/screen_record_dialog.xml b/packages/SystemUI/res/layout/screen_record_dialog.xml
index bbf3adfb8c67..f6ce70d4d032 100644
--- a/packages/SystemUI/res/layout/screen_record_dialog.xml
+++ b/packages/SystemUI/res/layout/screen_record_dialog.xml
@@ -15,6 +15,7 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@@ -47,7 +48,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textAppearance="@style/TextAppearance.Dialog.Title"
android:fontFamily="@*android:string/config_headlineFontFamily"
android:text="@string/screenrecord_permission_dialog_title"
android:layout_marginTop="22dp"
@@ -56,8 +57,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/screenrecord_permission_dialog_warning_entire_screen"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:textColorSecondary"
+ android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
android:gravity="center"
android:layout_marginBottom="20dp"/>
@@ -81,6 +81,7 @@
android:minHeight="48dp"
android:layout_weight="1"
android:popupBackground="@drawable/screenrecord_spinner_background"
+ android:textColor="?androidprv:attr/materialColorOnSurface"
android:dropDownWidth="274dp"
android:prompt="@string/screenrecord_audio_label"/>
<Switch
@@ -117,7 +118,7 @@
android:text="@string/screenrecord_taps_label"
android:textAppearance="?android:attr/textAppearanceMedium"
android:fontFamily="@*android:string/config_headlineFontFamily"
- android:textColor="?android:attr/textColorPrimary"
+ android:textColor="?androidprv:attr/materialColorOnSurface"
android:importantForAccessibility="no"/>
<Switch
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/layout/screen_share_dialog.xml b/packages/SystemUI/res/layout/screen_share_dialog.xml
index ab522a388735..9af46c5b739c 100644
--- a/packages/SystemUI/res/layout/screen_share_dialog.xml
+++ b/packages/SystemUI/res/layout/screen_share_dialog.xml
@@ -36,14 +36,13 @@
android:layout_width="@dimen/screenrecord_logo_size"
android:layout_height="@dimen/screenrecord_logo_size"
android:src="@drawable/ic_media_projection_permission"
- android:tint="?androidprv:attr/colorAccentPrimaryVariant"
+ android:tint="?androidprv:attr/materialColorPrimary"
android:importantForAccessibility="no"/>
<TextView
android:id="@+id/screen_share_dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:fontFamily="@*android:string/config_headlineFontFamily"
+ android:textAppearance="@style/TextAppearance.Dialog.Title"
android:layout_marginTop="@dimen/screenrecord_title_margin_top"
android:gravity="center"/>
<Spinner
@@ -64,8 +63,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/screenrecord_permission_dialog_warning_entire_screen"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="?android:textColorSecondary"
+ style="@style/TextAppearance.Dialog.Body.Message"
android:gravity="start"
android:lineHeight="@dimen/screenrecord_warning_line_height"/>
diff --git a/packages/SystemUI/res/values/attrs.xml b/packages/SystemUI/res/values/attrs.xml
index 3a1d1a8cbf9d..d693631080af 100644
--- a/packages/SystemUI/res/values/attrs.xml
+++ b/packages/SystemUI/res/values/attrs.xml
@@ -118,8 +118,25 @@
<attr name="wallpaperTextColorSecondary" format="reference|color" />
<attr name="wallpaperTextColorAccent" format="reference|color" />
<attr name="backgroundProtectedStyle" format="reference" />
- <attr name="offStateColor" format="reference|color" />
- <attr name="underSurfaceColor" format="reference|color" />
+
+ <!-- color attribute tokens for QS -->
+ <attr name="isQsTheme" format="boolean" />
+ <attr name="underSurface" format="reference|color"/>
+ <attr name="shadeActive" format="reference|color" />
+ <attr name="onShadeActive" format="reference|color" />
+ <attr name="onShadeActiveVariant" format="reference|color" />
+ <attr name="shadeInactive" format="reference|color" />
+ <attr name="onShadeInactive" format="reference|color" />
+ <attr name="onShadeInactiveVariant" format="reference|color" />
+ <attr name="shadeDisabled" format="reference|color" />
+ <attr name="surfaceBright" format="reference|color" />
+ <attr name="scHigh" format="reference|color" />
+ <attr name="tertiary" format="reference|color" />
+ <attr name="onSurface" format="reference|color" />
+ <attr name="onSurfaceVariant" format="reference|color" />
+ <attr name="outline" format="reference|color" />
+ <attr name="primary" format="reference|color" />
+
<declare-styleable name="SmartReplyView">
<attr name="spacing" format="dimension" />
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index cb5342a0d66b..fd74c7eae361 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -83,7 +83,7 @@
<style name="TextAppearance.QS">
<item name="android:textStyle">normal</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?attr/onShadeInactive</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
</style>
@@ -93,7 +93,7 @@
<style name="TextAppearance.QS.DetailItemSecondary">
<item name="android:textSize">@dimen/qs_tile_text_size</item>
- <item name="android:textColor">?android:attr/colorAccent</item>
+ <item name="android:textColor">?attr/shadeActive</item>
</style>
<style name="TextAppearance.QS.Introduction">
@@ -117,11 +117,11 @@
<style name="TextAppearance.QS.DataUsage.Usage">
<item name="android:textSize">@dimen/qs_data_usage_usage_text_size</item>
- <item name="android:textColor">?android:attr/colorAccent</item>
+ <item name="android:textColor">?attr/shadeActive</item>
</style>
<style name="TextAppearance.QS.DataUsage.Secondary">
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/onShadeInactiveVariant</item>
</style>
<style name="TextAppearance.QS.TileLabel">
@@ -137,31 +137,31 @@
<style name="TextAppearance.QS.UserSwitcher">
<item name="android:textSize">@dimen/qs_tile_text_size</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnSurfaceVariant</item>
</style>
<!-- This is hard coded to be sans-serif-condensed to match the icons -->
<style name="TextAppearance.QS.Status">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?attr/onSurface</item>
<item name="android:textSize">14sp</item>
<item name="android:letterSpacing">0.01</item>
</style>
<style name="TextAppearance.QS.SecurityFooter" parent="@style/TextAppearance.QS.Status">
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/onSurface</item>
</style>
<style name="TextAppearance.QS.Status.Carriers" />
<style name="TextAppearance.QS.Status.Carriers.NoCarrierText">
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/onSurfaceVariant</item>
</style>
<style name="TextAppearance.QS.Status.Build">
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/onSurfaceVariant</item>
</style>
<style name="TextAppearance.DeviceManagementDialog.Title" parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle"/>
@@ -278,10 +278,10 @@
<style name="DeviceManagementDialogTitle">
<item name="android:gravity">center</item>
- <item name="android:textAppearance">@style/TextAppearance.DeviceManagementDialog.Title</item>
+ <item name="android:textAppearance">@style/TextAppearance.Dialog.Title</item>
</style>
- <style name="TextAppearance.DeviceManagementDialog.Content" parent="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
+ <style name="TextAppearance.DeviceManagementDialog.Content" parent="@style/TextAppearance.Dialog.Body.Message"/>
<style name="BaseBrightnessDialogContainer" parent="@style/Theme.SystemUI">
<item name="android:layout_width">match_parent</item>
@@ -371,14 +371,30 @@
</style>
<style name="Theme.SystemUI.QuickSettings" parent="@*android:style/Theme.DeviceDefault">
+ <item name="isQsTheme">true</item>
<item name="lightIconTheme">@style/QSIconTheme</item>
<item name="darkIconTheme">@style/QSIconTheme</item>
<item name="android:colorError">@*android:color/error_color_material_dark</item>
<item name="android:windowIsFloating">true</item>
<item name="android:homeAsUpIndicator">@drawable/ic_arrow_back</item>
- <item name="offStateColor">@color/material_dynamic_neutral20</item>
- <item name="underSurfaceColor">@color/material_dynamic_neutral0</item>
- <item name="android:colorBackground">@color/material_dynamic_neutral10</item>
+
+ <item name="surfaceBright">?androidprv:attr/materialColorSurfaceBright</item>
+ <item name="android:colorBackground">?attr/surfaceBright</item>
+ <item name="scHigh">?androidprv:attr/materialColorSurfaceContainerHigh</item>
+ <item name="primary">?androidprv:attr/materialColorPrimary</item>
+ <item name="tertiary">?androidprv:attr/materialColorTertiary</item>
+ <item name="onSurface">?androidprv:attr/materialColorOnSurface</item>
+ <item name="onSurfaceVariant">?androidprv:attr/materialColorOnSurfaceVariant</item>
+ <item name="outline">?androidprv:attr/materialColorOutline</item>
+
+ <item name="shadeActive">@color/material_dynamic_primary90</item>
+ <item name="onShadeActive">@color/material_dynamic_primary10</item>
+ <item name="onShadeActiveVariant">@color/material_dynamic_primary30</item>
+ <item name="shadeInactive">@color/material_dynamic_neutral20</item>
+ <item name="onShadeInactive">@color/material_dynamic_neutral90</item>
+ <item name="onShadeInactiveVariant">@color/material_dynamic_neutral_variant80</item>
+ <item name="shadeDisabled">@color/shade_disabled</item>
+ <item name="underSurface">@color/material_dynamic_neutral0</item>
<item name="android:itemTextAppearance">@style/Control.MenuItem</item>
</style>
@@ -390,8 +406,15 @@
<item name="android:windowBackground">@android:color/transparent</item>
</style>
- <style name="Theme.SystemUI.QuickSettings.Dialog" parent="@android:style/Theme.DeviceDefault.Dialog">
+ <style name="Theme.SystemUI.QuickSettings.Dialog" parent="@style/Theme.SystemUI.Dialog.QuickSettings">
+ </style>
+
+ <!-- Parent style overrides style in the dot inheritance -->
+ <style name="Theme.SystemUI.Dialog.QuickSettings" parent="@style/Theme.SystemUI.QuickSettings">
<item name="android:dialogCornerRadius">@dimen/notification_corner_radius</item>
+ <item name="android:buttonBarPositiveButtonStyle">@style/Widget.Dialog.Button.QuickSettings</item>
+ <item name="android:buttonBarNegativeButtonStyle">@style/Widget.Dialog.Button.QuickSettings</item>
+ <item name="android:buttonBarNeutralButtonStyle">@style/Widget.Dialog.Button.QuickSettings</item>
</style>
<!-- Overridden by values-television/styles.xml with tv-specific settings -->
@@ -406,7 +429,7 @@
<item name="android:buttonBarPositiveButtonStyle">@style/Widget.Dialog.Button</item>
<item name="android:buttonBarNegativeButtonStyle">@style/Widget.Dialog.Button.BorderButton</item>
<item name="android:buttonBarNeutralButtonStyle">@style/Widget.Dialog.Button.BorderButton</item>
- <item name="android:colorBackground">?androidprv:attr/colorSurface</item>
+ <item name="android:colorBackground">?androidprv:attr/materialColorSurfaceBright</item>
<item name="android:alertDialogStyle">@style/ScrollableAlertDialogStyle</item>
<item name="android:buttonBarStyle">@style/ButtonBarStyle</item>
<item name="android:buttonBarButtonStyle">@style/Widget.Dialog.Button.Large</item>
@@ -605,11 +628,11 @@
<item name="android:letterSpacing">0.01</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?attr/onSurfaceVariant</item>
</style>
<style name="QSCustomizeToolbar" parent="@*android:style/Widget.DeviceDefault.Toolbar">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?attr/onSurface</item>
<item name="android:elevation">10dp</item>
</style>
@@ -1055,7 +1078,7 @@
</style>
<style name="TextAppearance.Dialog.Title" parent="@android:style/TextAppearance.DeviceDefault.Large">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
<item name="android:textSize">@dimen/dialog_title_text_size</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:lineHeight">32sp</item>
@@ -1064,7 +1087,7 @@
</style>
<style name="TextAppearance.Dialog.Body" parent="@android:style/TextAppearance.DeviceDefault.Medium">
- <item name="android:textColor">?android:attr/textColorSecondary</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnSurfaceVariant</item>
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:lineHeight">20sp</item>
@@ -1092,7 +1115,7 @@
<style name="Widget.Dialog.Button">
<item name="android:buttonCornerRadius">28dp</item>
<item name="android:background">@drawable/qs_dialog_btn_filled</item>
- <item name="android:textColor">?androidprv:attr/textColorOnAccent</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnPrimary</item>
<item name="android:textSize">14sp</item>
<item name="android:lineHeight">20sp</item>
<item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
@@ -1102,12 +1125,18 @@
<style name="Widget.Dialog.Button.BorderButton">
<item name="android:background">@drawable/qs_dialog_btn_outline</item>
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
</style>
<style name="Widget.Dialog.Button.Large">
<item name="android:background">@drawable/qs_dialog_btn_filled_large</item>
<item name="android:minHeight">56dp</item>
+ <item name="android:textColor">?androidprv:attr/materialColorOnPrimaryFixed</item>
+ </style>
+
+ <style name="Widget.Dialog.Button.QuickSettings">
+ <item name="android:textColor">?attr/primary</item>
+ <item name="android:background">?android:attr/selectableItemBackground</item>
</style>
<style name="MainSwitch.Settingslib" parent="@android:style/Theme.DeviceDefault">
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 6265b3c056e7..3432628e6d67 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 9c9ad33e4918..3c53d77c6beb 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 b3596a254b7d..32146b5b00e4 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 e54168162de6..7e45491adc83 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 b80668379e49..d81e4c229aa7 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 a60dad4a14fe..fe6c9b3fe7b1 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 87892539ccfe..f55ef65a8fc1 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 2cc6709d0f37..d647d6add512 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 28aeba461c50..3c667725c78a 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 f0e4e3adda7c..77a443666442 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 44613103a5b2..dae9c975b997 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));