summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Behnam Heydarshahi <bhnm@google.com> 2024-12-18 15:59:42 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2024-12-18 15:59:42 -0800
commitbc80bc50b7718b6f6a380101023d03ea63871ea7 (patch)
tree6cfc6d3e03702acb6e2c6d826965032c7d859180
parent4fa18de57a420038d3815aefb2402dedc14725c1 (diff)
parentd0628f50652d4475eaedc1fe053812fdcb4df6de (diff)
Merge "QS Tile Icons: use Icon.res, ditch state.iconResId" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt1
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt7
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt1
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt18
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt7
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt15
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt14
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt22
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt6
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt11
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapperTest.kt7
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt20
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt3
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/NotesTile.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/model/ModesTileModel.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapper.kt4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileState.kt5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt4
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt1
55 files changed, 142 insertions, 139 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt
index 056efb34a0b1..c47a412e226a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt
@@ -117,7 +117,6 @@ class QSTileViewModelImplTest : SysuiTestCase() {
"test_spec:\n" +
" QSTileState(" +
"icon=Resource(res=0, contentDescription=Resource(res=0)), " +
- "iconRes=null, " +
"label=test_data, " +
"activationState=INACTIVE, " +
"secondaryLabel=null, " +
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt
index 00460bfe83b2..557f4ea262a3 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt
@@ -93,8 +93,7 @@ class AirplaneModeMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.airplane_mode)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt
index 632aae035ede..24e46686e23d 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt
@@ -178,8 +178,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.status_bar_alarm)
return QSTileState(
- Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null),
- R.drawable.ic_alarm,
+ Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null, R.drawable.ic_alarm),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt
index 5385f945946c..2ddaddd5ad35 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt
@@ -253,8 +253,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.battery_detail_switch_title)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt
index 356b98eb192e..a3c159820a94 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt
@@ -77,8 +77,11 @@ class ColorCorrectionTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_color_correction_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(R.drawable.ic_qs_color_correction)!!, null),
- R.drawable.ic_qs_color_correction,
+ Icon.Loaded(
+ context.getDrawable(R.drawable.ic_qs_color_correction)!!,
+ null,
+ R.drawable.ic_qs_color_correction,
+ ),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt
index 8236c4c1e638..608adf183163 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt
@@ -253,7 +253,6 @@ class CustomTileMapperTest : SysuiTestCase() {
): QSTileState {
return QSTileState(
icon?.let { com.android.systemui.common.shared.model.Icon.Loaded(icon, null) },
- null,
"test label",
activationState,
"test subtitle",
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt
index 587585ccee2e..a115c1235210 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt
@@ -73,7 +73,11 @@ class FlashlightMapperTest : SysuiTestCase() {
mapper.map(qsTileConfig, FlashlightTileModel.FlashlightAvailable(true))
val expectedIcon =
- Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_on)!!, null)
+ Icon.Loaded(
+ context.getDrawable(R.drawable.qs_flashlight_icon_on)!!,
+ null,
+ R.drawable.qs_flashlight_icon_on,
+ )
val actualIcon = tileState.icon
assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -84,7 +88,11 @@ class FlashlightMapperTest : SysuiTestCase() {
mapper.map(qsTileConfig, FlashlightTileModel.FlashlightAvailable(false))
val expectedIcon =
- Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_off)!!, null)
+ Icon.Loaded(
+ context.getDrawable(R.drawable.qs_flashlight_icon_off)!!,
+ null,
+ R.drawable.qs_flashlight_icon_off,
+ )
val actualIcon = tileState.icon
assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -95,7 +103,11 @@ class FlashlightMapperTest : SysuiTestCase() {
mapper.map(qsTileConfig, FlashlightTileModel.FlashlightTemporarilyUnavailable)
val expectedIcon =
- Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_off)!!, null)
+ Icon.Loaded(
+ context.getDrawable(R.drawable.qs_flashlight_icon_off)!!,
+ null,
+ R.drawable.qs_flashlight_icon_off,
+ )
val actualIcon = tileState.icon
assertThat(actualIcon).isEqualTo(expectedIcon)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt
index e81771ec38d5..8f8f7105415f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt
@@ -58,8 +58,11 @@ class FontScalingTileMapperTest : SysuiTestCase() {
private fun createFontScalingTileState(): QSTileState =
QSTileState(
- Icon.Loaded(context.getDrawable(R.drawable.ic_qs_font_scaling)!!, null),
- R.drawable.ic_qs_font_scaling,
+ Icon.Loaded(
+ context.getDrawable(R.drawable.ic_qs_font_scaling)!!,
+ null,
+ R.drawable.ic_qs_font_scaling,
+ ),
context.getString(R.string.quick_settings_font_scaling_label),
QSTileState.ActivationState.ACTIVE,
null,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt
index 12d604ff6a7c..3d3447da15a1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt
@@ -102,8 +102,7 @@ class HearingDevicesTileMapperTest : SysuiTestCase() {
val label = context.getString(R.string.quick_settings_hearing_devices_label)
val iconRes = R.drawable.qs_hearing_devices_icon
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt
index 9dcf49e02697..b087bbc29bf7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt
@@ -82,7 +82,6 @@ class InternetTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.ACTIVE,
context.getString(R.string.quick_settings_networks_available),
Icon.Loaded(signalDrawable, null),
- null,
context.getString(R.string.quick_settings_internet_label),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
@@ -120,8 +119,11 @@ class InternetTileMapperTest : SysuiTestCase() {
createInternetTileState(
QSTileState.ActivationState.ACTIVE,
inputModel.secondaryLabel.loadText(context).toString(),
- Icon.Loaded(context.getDrawable(expectedSatIcon!!.res)!!, null),
- expectedSatIcon.res,
+ Icon.Loaded(
+ context.getDrawable(expectedSatIcon!!.res)!!,
+ null,
+ expectedSatIcon.res,
+ ),
expectedSatIcon.contentDescription.loadContentDescription(context).toString(),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
@@ -144,8 +146,7 @@ class InternetTileMapperTest : SysuiTestCase() {
createInternetTileState(
QSTileState.ActivationState.ACTIVE,
context.getString(R.string.quick_settings_networks_available),
- Icon.Loaded(context.getDrawable(wifiRes)!!, contentDescription = null),
- wifiRes,
+ Icon.Loaded(context.getDrawable(wifiRes)!!, null, wifiRes),
context.getString(R.string.quick_settings_internet_label),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
@@ -171,8 +172,8 @@ class InternetTileMapperTest : SysuiTestCase() {
Icon.Loaded(
context.getDrawable(R.drawable.ic_qs_no_internet_unavailable)!!,
contentDescription = null,
+ R.drawable.ic_qs_no_internet_unavailable,
),
- R.drawable.ic_qs_no_internet_unavailable,
context.getString(R.string.quick_settings_networks_unavailable),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
@@ -182,13 +183,11 @@ class InternetTileMapperTest : SysuiTestCase() {
activationState: QSTileState.ActivationState,
secondaryLabel: String,
icon: Icon,
- iconRes: Int? = null,
contentDescription: String,
): QSTileState {
val label = context.getString(R.string.quick_settings_internet_label)
return QSTileState(
icon,
- iconRes,
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt
index 30fce73e04da..780d58c83e5b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt
@@ -90,8 +90,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_inversion_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt
index 37e8a6053682..4ebe23dcdef1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt
@@ -69,7 +69,12 @@ class LocationTileMapperTest : SysuiTestCase() {
fun mapsEnabledDataToOnIconState() {
val tileState: QSTileState = mapper.map(qsTileConfig, LocationTileModel(true))
- val expectedIcon = Icon.Loaded(context.getDrawable(R.drawable.qs_location_icon_on)!!, null)
+ val expectedIcon =
+ Icon.Loaded(
+ context.getDrawable(R.drawable.qs_location_icon_on)!!,
+ null,
+ R.drawable.qs_location_icon_on,
+ )
val actualIcon = tileState.icon
Truth.assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -78,7 +83,12 @@ class LocationTileMapperTest : SysuiTestCase() {
fun mapsDisabledDataToOffIconState() {
val tileState: QSTileState = mapper.map(qsTileConfig, LocationTileModel(false))
- val expectedIcon = Icon.Loaded(context.getDrawable(R.drawable.qs_location_icon_off)!!, null)
+ val expectedIcon =
+ Icon.Loaded(
+ context.getDrawable(R.drawable.qs_location_icon_off)!!,
+ null,
+ R.drawable.qs_location_icon_off,
+ )
val actualIcon = tileState.icon
Truth.assertThat(actualIcon).isEqualTo(expectedIcon)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt
index d16342ba3287..44e6b4d2d0f6 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractorTest.kt
@@ -146,13 +146,13 @@ class ModesTileDataInteractorTest : SysuiTestCase() {
// Tile starts with the generic Modes icon.
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
// Add an inactive mode -> Still modes icon
zenModeRepository.addMode(id = "Mode", active = false)
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
// Add an active mode with a default icon: icon should be the mode icon, and the
// iconResId is also populated, because we know it's a system icon.
@@ -163,7 +163,7 @@ class ModesTileDataInteractorTest : SysuiTestCase() {
)
runCurrent()
assertThat(tileData?.icon).isEqualTo(BEDTIME_ICON)
- assertThat(tileData?.iconResId).isEqualTo(R.drawable.ic_zen_mode_type_bedtime)
+ assertThat(tileData?.icon!!.res).isEqualTo(BEDTIME_DRAWABLE_ID)
// Add another, less-prioritized mode that has a *custom* icon: for now, icon should
// remain the first mode icon
@@ -178,20 +178,20 @@ class ModesTileDataInteractorTest : SysuiTestCase() {
)
runCurrent()
assertThat(tileData?.icon).isEqualTo(BEDTIME_ICON)
- assertThat(tileData?.iconResId).isEqualTo(R.drawable.ic_zen_mode_type_bedtime)
+ assertThat(tileData?.icon!!.res).isEqualTo(BEDTIME_DRAWABLE_ID)
// Deactivate more important mode: icon should be the less important, still active mode
// And because it's a package-provided icon, iconResId is not populated.
zenModeRepository.deactivateMode("Bedtime with default icon")
runCurrent()
assertThat(tileData?.icon).isEqualTo(CUSTOM_ICON)
- assertThat(tileData?.iconResId).isNull()
+ assertThat(tileData?.icon!!.res).isNull()
// Deactivate remaining mode: back to the default modes icon
zenModeRepository.deactivateMode("Driving with custom icon")
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
}
@Test
@@ -206,18 +206,18 @@ class ModesTileDataInteractorTest : SysuiTestCase() {
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
// Activate a Mode -> Icon doesn't change.
zenModeRepository.addMode(id = "Mode", active = true)
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
zenModeRepository.deactivateMode(id = "Mode")
runCurrent()
assertThat(tileData?.icon).isEqualTo(MODES_ICON)
- assertThat(tileData?.iconResId).isEqualTo(MODES_DRAWABLE_ID)
+ assertThat(tileData?.icon!!.res).isEqualTo(MODES_DRAWABLE_ID)
}
@EnableFlags(Flags.FLAG_MODES_UI)
@@ -257,10 +257,10 @@ class ModesTileDataInteractorTest : SysuiTestCase() {
val TEST_USER = UserHandle.of(1)!!
const val CUSTOM_PACKAGE = "com.some.mode.owner.package"
- val MODES_DRAWABLE_ID = R.drawable.ic_zen_priority_modes
+ const val MODES_DRAWABLE_ID = R.drawable.ic_zen_priority_modes
const val CUSTOM_DRAWABLE_ID = 12345
- val BEDTIME_DRAWABLE_ID = R.drawable.ic_zen_mode_type_bedtime
+ const val BEDTIME_DRAWABLE_ID = R.drawable.ic_zen_mode_type_bedtime
val MODES_DRAWABLE = TestStubDrawable("modes_icon")
val BEDTIME_DRAWABLE = TestStubDrawable("bedtime")
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt
index 88b00468573f..04e094f25f5d 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileUserActionInteractorTest.kt
@@ -156,6 +156,10 @@ class ModesTileUserActionInteractorTest : SysuiTestCase() {
}
private fun modelOf(isActivated: Boolean, activeModeNames: List<String>): ModesTileModel {
- return ModesTileModel(isActivated, activeModeNames, TestStubDrawable("icon").asIcon(), 123)
+ return ModesTileModel(
+ isActivated,
+ activeModeNames,
+ TestStubDrawable("icon").asIcon(res = 123),
+ )
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt
index 4e91d16bf1ec..d73044f6b479 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt
@@ -99,18 +99,11 @@ class ModesTileMapperTest : SysuiTestCase() {
@Test
fun state_modelHasIconResId_includesIconResId() {
- val icon = TestStubDrawable("res123").asIcon()
- val model =
- ModesTileModel(
- isActivated = false,
- activeModes = emptyList(),
- icon = icon,
- iconResId = 123,
- )
+ val icon = TestStubDrawable("res123").asIcon(res = 123)
+ val model = ModesTileModel(isActivated = false, activeModes = emptyList(), icon = icon)
val state = underTest.map(config, model)
assertThat(state.icon).isEqualTo(icon)
- assertThat(state.iconRes).isEqualTo(123)
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt
index 1457f533f5ec..7c853261aa1c 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt
@@ -289,8 +289,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
if (TextUtils.isEmpty(secondaryLabel)) label
else TextUtils.concat(label, ", ", secondaryLabel)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapperTest.kt
index 2ac3e081b8f4..b6caa22a3012 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapperTest.kt
@@ -58,8 +58,11 @@ class NotesTileMapperTest : SysuiTestCase() {
private fun createNotesTileState(): QSTileState =
QSTileState(
- Icon.Loaded(context.getDrawable(R.drawable.ic_qs_notes)!!, null),
- R.drawable.ic_qs_notes,
+ Icon.Loaded(
+ context.getDrawable(R.drawable.ic_qs_notes)!!,
+ null,
+ R.drawable.ic_qs_notes,
+ ),
context.getString(R.string.quick_settings_notes_label),
QSTileState.ActivationState.INACTIVE,
/* secondaryLabel= */ null,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt
index 7782d2b279a8..5b39810e3477 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt
@@ -66,11 +66,7 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
val outputState = mapper.map(config, inputModel)
val expectedState =
- createOneHandedModeTileState(
- QSTileState.ActivationState.INACTIVE,
- subtitleArray[1],
- com.android.internal.R.drawable.ic_qs_one_handed_mode,
- )
+ createOneHandedModeTileState(QSTileState.ActivationState.INACTIVE, subtitleArray[1])
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -81,23 +77,21 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
val outputState = mapper.map(config, inputModel)
val expectedState =
- createOneHandedModeTileState(
- QSTileState.ActivationState.ACTIVE,
- subtitleArray[2],
- com.android.internal.R.drawable.ic_qs_one_handed_mode,
- )
+ createOneHandedModeTileState(QSTileState.ActivationState.ACTIVE, subtitleArray[2])
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
private fun createOneHandedModeTileState(
activationState: QSTileState.ActivationState,
secondaryLabel: String,
- iconRes: Int,
): QSTileState {
val label = context.getString(R.string.quick_settings_onehanded_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(
+ context.getDrawable(com.android.internal.R.drawable.ic_qs_one_handed_mode)!!,
+ null,
+ com.android.internal.R.drawable.ic_qs_one_handed_mode,
+ ),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt
index ed33250a3392..c572ff60b61a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt
@@ -93,8 +93,8 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
Icon.Loaded(
context.getDrawable(com.android.systemui.res.R.drawable.ic_qr_code_scanner)!!,
null,
+ com.android.systemui.res.R.drawable.ic_qr_code_scanner,
),
- com.android.systemui.res.R.drawable.ic_qr_code_scanner,
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt
index 85111fd07663..00017f9059de 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt
@@ -85,8 +85,7 @@ class ReduceBrightColorsTileMapperTest : SysuiTestCase() {
R.drawable.qs_extra_dim_icon_on
else R.drawable.qs_extra_dim_icon_off
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
context.resources
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt
index 53671ba38eb6..74010143166b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt
@@ -180,8 +180,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_rotation_unlocked_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt
index 9a450653aa8f..1fb5048dd4c9 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt
@@ -91,8 +91,7 @@ class DataSaverTileMapperTest : SysuiTestCase() {
else context.resources.getStringArray(R.array.tile_states_saver)[0]
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt
index cd683c44a59c..363255695131 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt
@@ -110,8 +110,7 @@ class ScreenRecordTileMapperTest : SysuiTestCase() {
val label = context.getString(R.string.quick_settings_screen_record_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt
index c569403960d0..e4cd0e0ec215 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt
@@ -146,8 +146,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
else context.getString(R.string.quick_settings_mic_label)
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt
index 0d2ebe42b7ad..8f5f2d3e6689 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt
@@ -69,8 +69,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
expandedAccessibilityClass: KClass<out View>? = Switch::class,
): QSTileState {
return QSTileState(
- Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes,
+ Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt
index 86321ea04703..2c81f39a03ec 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt
@@ -109,8 +109,7 @@ class WorkModeTileMapperTest : SysuiTestCase() {
val label = testLabel
val iconRes = com.android.internal.R.drawable.stat_sys_managed_profile_status
return QSTileState(
- icon = Icon.Loaded(context.getDrawable(iconRes)!!, null),
- iconRes = iconRes,
+ icon = Icon.Loaded(context.getDrawable(iconRes)!!, null, iconRes),
label = label,
activationState = activationState,
secondaryLabel =
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NotesTile.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/NotesTile.kt
index 989fc0fd6f44..5ba1527dbf69 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NotesTile.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NotesTile.kt
@@ -22,6 +22,7 @@ import android.os.Looper
import android.service.quicksettings.Tile
import com.android.internal.logging.MetricsLogger
import com.android.systemui.animation.Expandable
+import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.plugins.ActivityStarter
@@ -92,7 +93,8 @@ constructor(
state?.apply {
this.state = tileState.activationState.legacyState
- icon = maybeLoadResourceIcon(tileState.iconRes ?: R.drawable.ic_qs_notes)
+ icon =
+ maybeLoadResourceIcon((tileState.icon as Icon.Loaded).res ?: R.drawable.ic_qs_notes)
label = tileState.label
contentDescription = tileState.contentDescription
expandedAccessibilityClassName = tileState.expandedAccessibilityClassName
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt
index 34c2ec90f1e8..80d429ce2716 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt
@@ -35,13 +35,13 @@ constructor(@ShadeDisplayAware private val resources: Resources, val theme: Them
override fun map(config: QSTileConfig, data: AirplaneModeTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes =
+ val iconRes =
if (data.isEnabled) {
R.drawable.qs_airplane_icon_on
} else {
R.drawable.qs_airplane_icon_off
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = resources.getStringArray(R.array.tile_states_airplane)[2]
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt
index a72992db4496..d56d9944dbb8 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt
@@ -84,8 +84,8 @@ constructor(
secondaryLabel = resources.getString(R.string.qs_alarm_tile_no_alarm)
}
}
- iconRes = R.drawable.ic_alarm
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = R.drawable.ic_alarm
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
sideViewIcon = QSTileState.SideViewIcon.Chevron
contentDescription = label
supportedActions = setOf(QSTileState.UserAction.CLICK)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt
index e116d8cef2ee..72759c5bb066 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt
@@ -38,10 +38,10 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.battery_detail_switch_title)
contentDescription = label
- iconRes =
+ val iconRes =
if (data.isPowerSaving) R.drawable.qs_battery_saver_icon_on
else R.drawable.qs_battery_saver_icon_off
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
sideViewIcon = QSTileState.SideViewIcon.None
if (data.isPluggedIn) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt
index 21b9f659dde4..e5a0fe8ed048 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt
@@ -37,8 +37,8 @@ constructor(
override fun map(config: QSTileConfig, data: ColorCorrectionTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
val subtitleArray = resources.getStringArray(R.array.tile_states_color_correction)
- iconRes = R.drawable.ic_qs_color_correction
- icon = Icon.Loaded(resources.getDrawable(R.drawable.ic_qs_color_correction)!!, null)
+ val iconRes = R.drawable.ic_qs_color_correction
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = subtitleArray[2]
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt
index 2dfb1fc4fe98..32ccba6f1fa5 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt
@@ -35,14 +35,14 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
override fun map(config: QSTileConfig, data: FlashlightTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes =
+ val iconRes =
if (data is FlashlightTileModel.FlashlightAvailable && data.isEnabled) {
R.drawable.qs_flashlight_icon_on
} else {
R.drawable.qs_flashlight_icon_off
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription = label
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt
index 7f41cbd322dd..c571b136e18b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt
@@ -36,8 +36,8 @@ constructor(
override fun map(config: QSTileConfig, data: FontScalingTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes = R.drawable.ic_qs_font_scaling
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = R.drawable.ic_qs_font_scaling
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription = label
activationState = QSTileState.ActivationState.ACTIVE
sideViewIcon = QSTileState.SideViewIcon.Chevron
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapper.kt
index 4c302b363c3b..12f71491c7b4 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapper.kt
@@ -37,8 +37,8 @@ constructor(
override fun map(config: QSTileConfig, data: HearingDevicesTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.quick_settings_hearing_devices_label)
- iconRes = R.drawable.qs_hearing_devices_icon
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = R.drawable.qs_hearing_devices_icon
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
sideViewIcon = QSTileState.SideViewIcon.Chevron
contentDescription = label
if (data.isAnyActiveHearingDevice) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapper.kt
index 1a6876d0b765..7ad01e463399 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapper.kt
@@ -61,11 +61,11 @@ constructor(
when (val dataIcon = data.icon) {
is InternetTileIconModel.ResourceId -> {
- iconRes = dataIcon.resId
icon =
Icon.Loaded(
resources.getDrawable(dataIcon.resId, theme),
contentDescription = null,
+ dataIcon.resId,
)
}
@@ -76,11 +76,11 @@ constructor(
}
is InternetTileIconModel.Satellite -> {
- iconRes = dataIcon.resourceIcon.res // level is inferred from res
icon =
Icon.Loaded(
resources.getDrawable(dataIcon.resourceIcon.res, theme),
contentDescription = null,
+ dataIcon.resourceIcon.res,
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt
index 8d35b2413bad..05590e803ffa 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt
@@ -35,7 +35,7 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
override fun map(config: QSTileConfig, data: ColorInversionTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
val subtitleArray = resources.getStringArray(R.array.tile_states_inversion)
-
+ val iconRes: Int
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = subtitleArray[2]
@@ -45,7 +45,7 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
secondaryLabel = subtitleArray[1]
iconRes = R.drawable.qs_invert_colors_icon_off
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription = label
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt
index 3557c1a4ac9d..afb137e1e92f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt
@@ -39,6 +39,7 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
Icon.Loaded(
resources.getDrawable(R.drawable.qs_record_issue_icon_on, theme),
null,
+ R.drawable.qs_record_issue_icon_on,
)
} else {
activationState = QSTileState.ActivationState.INACTIVE
@@ -46,6 +47,7 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
Icon.Loaded(
resources.getDrawable(R.drawable.qs_record_issue_icon_off, theme),
null,
+ R.drawable.qs_record_issue_icon_off,
)
}
supportedActions = setOf(QSTileState.UserAction.CLICK)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt
index dfc24a10c491..ced5a4f099a2 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt
@@ -35,13 +35,13 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
override fun map(config: QSTileConfig, data: LocationTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes =
+ val iconRes =
if (data.isEnabled) {
R.drawable.qs_location_icon_on
} else {
R.drawable.qs_location_icon_off
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
label = resources.getString(R.string.quick_settings_location_label)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt
index ee6b0b865abc..bb08022ee084 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/interactor/ModesTileDataInteractor.kt
@@ -73,7 +73,6 @@ constructor(
return ModesTileModel(
isActivated = activeModes.isAnyActive(),
icon = tileIcon.icon,
- iconResId = tileIcon.resId,
activeModes = activeModes.modeNames,
)
} else {
@@ -83,7 +82,6 @@ constructor(
context
.getDrawable(ModesTile.ICON_RES_ID)!!
.asIcon(res = ModesTile.ICON_RES_ID),
- iconResId = ModesTile.ICON_RES_ID,
activeModes = activeModes.modeNames,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/model/ModesTileModel.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/model/ModesTileModel.kt
index db4812342050..d0eacbc9a957 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/model/ModesTileModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/domain/model/ModesTileModel.kt
@@ -21,12 +21,10 @@ import com.android.systemui.common.shared.model.Icon
data class ModesTileModel(
val isActivated: Boolean,
val activeModes: List<String>,
- val icon: Icon.Loaded,
-
/**
- * Resource id corresponding to [icon]. Will only be present if it's know to correspond to a
- * resource with a known id in SystemUI (such as resources from `android.R`,
- * `com.android.internal.R`, or `com.android.systemui.res` itself).
+ * icon.res will only be present if it is known to correspond to a resource with a known id in
+ * SystemUI (such as resources from `android.R`, `com.android.internal.R`, or
+ * `com.android.systemui.res` itself).
*/
- val iconResId: Int? = null
+ val icon: Icon.Loaded,
)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt
index 1507ef4b3b58..99ae3b8db709 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt
@@ -34,7 +34,6 @@ constructor(@ShadeDisplayAware private val resources: Resources, val theme: Reso
QSTileDataToStateMapper<ModesTileModel> {
override fun map(config: QSTileConfig, data: ModesTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes = data.iconResId
icon = data.icon
activationState =
if (data.isActivated) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt
index 3569e4d0b42c..16b36289ad95 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt
@@ -49,7 +49,7 @@ constructor(
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
sideViewIcon = QSTileState.SideViewIcon.None
-
+ val iconRes: Int
if (data.isActivated) {
activationState = QSTileState.ActivationState.ACTIVE
iconRes = R.drawable.qs_nightlight_icon_on
@@ -58,7 +58,7 @@ constructor(
iconRes = R.drawable.qs_nightlight_icon_off
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
secondaryLabel = getSecondaryLabel(data, resources)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapper.kt
index a5436192af39..ecdd71170cda 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/notes/domain/NotesTileMapper.kt
@@ -35,8 +35,8 @@ constructor(
) : QSTileDataToStateMapper<NotesTileModel> {
override fun map(config: QSTileConfig, data: NotesTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- iconRes = R.drawable.ic_qs_notes
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
+ val iconRes = R.drawable.ic_qs_notes
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription = label
activationState = QSTileState.ActivationState.INACTIVE
sideViewIcon = QSTileState.SideViewIcon.Chevron
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt
index 76f1e8b8760c..5b3ea93ab1ae 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt
@@ -38,8 +38,8 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
val subtitleArray = resources.getStringArray(R.array.tile_states_onehanded)
label = resources.getString(R.string.quick_settings_onehanded_label)
- iconRes = com.android.internal.R.drawable.ic_qs_one_handed_mode
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = com.android.internal.R.drawable.ic_qs_one_handed_mode
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = subtitleArray[2]
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt
index c546250e73d2..21e92d3a1972 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt
@@ -38,8 +38,8 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.qr_code_scanner_title)
contentDescription = label
- iconRes = R.drawable.ic_qr_code_scanner
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = R.drawable.ic_qr_code_scanner
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
sideViewIcon = QSTileState.SideViewIcon.Chevron
supportedActions = setOf(QSTileState.UserAction.CLICK)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt
index 66d0f96fdcde..66759cdfd1a6 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt
@@ -37,6 +37,7 @@ constructor(
override fun map(config: QSTileConfig, data: ReduceBrightColorsTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
+ val iconRes: Int
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
iconRes = R.drawable.qs_extra_dim_icon_on
@@ -50,7 +51,7 @@ constructor(
resources
.getStringArray(R.array.tile_states_reduce_brightness)[Tile.STATE_INACTIVE]
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
label =
resources.getString(com.android.internal.R.string.reduce_bright_colors_feature_name)
contentDescription = label
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt
index a0144221577d..000c7025e32b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt
@@ -42,7 +42,7 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.quick_settings_rotation_unlocked_label)
contentDescription = resources.getString(R.string.accessibility_quick_settings_rotation)
-
+ val iconRes: Int
if (data.isRotationLocked) {
activationState = QSTileState.ActivationState.INACTIVE
secondaryLabel = EMPTY_SECONDARY_STRING
@@ -57,7 +57,7 @@ constructor(
}
iconRes = R.drawable.qs_auto_rotate_icon_on
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
if (isDeviceFoldable(resources, deviceStateManager)) {
secondaryLabel = getSecondaryLabelWithPosture(activationState)
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt
index aea4967c546c..1d5cf29f2462 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt
@@ -36,6 +36,7 @@ constructor(
override fun map(config: QSTileConfig, data: DataSaverTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
with(data) {
+ val iconRes: Int
if (isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
iconRes = R.drawable.qs_data_saver_icon_on
@@ -45,7 +46,7 @@ constructor(
iconRes = R.drawable.qs_data_saver_icon_off
secondaryLabel = resources.getStringArray(R.array.tile_states_saver)[1]
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription = label
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt
index f3136e015acf..0a61e3cbe616 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt
@@ -38,7 +38,7 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.quick_settings_screen_record_label)
supportedActions = setOf(QSTileState.UserAction.CLICK)
-
+ val iconRes: Int
when (data) {
is ScreenRecordModel.Recording -> {
activationState = QSTileState.ActivationState.ACTIVE
@@ -61,7 +61,7 @@ constructor(
resources.getString(R.string.quick_settings_screen_record_start)
}
}
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
contentDescription =
if (TextUtils.isEmpty(secondaryLabel)) label
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt
index 73e61b7d178e..f54f46c01dee 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt
@@ -50,8 +50,8 @@ constructor(
contentDescription = label
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
- iconRes = sensorPrivacyTileResources.getIconRes(data.isBlocked)
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ val iconRes = sensorPrivacyTileResources.getIconRes(data.isBlocked)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
sideViewIcon = QSTileState.SideViewIcon.None
if (data.isBlocked) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt
index e9aa46c5f253..5933d65bc61f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt
@@ -116,11 +116,11 @@ constructor(@ShadeDisplayAware private val resources: Resources, private val the
}
}
- iconRes =
+ val iconRes =
if (activationState == QSTileState.ActivationState.ACTIVE)
R.drawable.qs_light_dark_theme_icon_on
else R.drawable.qs_light_dark_theme_icon_off
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
supportedActions =
if (activationState == QSTileState.ActivationState.UNAVAILABLE)
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapper.kt
index 6a3195a493c8..5b462ba074ec 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapper.kt
@@ -41,8 +41,8 @@ constructor(
QSTileState.build(resources, theme, config.uiConfig) {
label = getTileLabel()!!
contentDescription = label
- iconRes = com.android.internal.R.drawable.stat_sys_managed_profile_status
- icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
+ val iconRes = com.android.internal.R.drawable.stat_sys_managed_profile_status
+ icon = Icon.Loaded(resources.getDrawable(iconRes, theme), null, iconRes)
when (data) {
is WorkModeTileModel.HasActiveProfile -> {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileState.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileState.kt
index 8394be5e0a38..c6af729cd4a7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileState.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileState.kt
@@ -36,7 +36,6 @@ import kotlin.reflect.KClass
*/
data class QSTileState(
val icon: Icon?,
- val iconRes: Int?,
val label: CharSequence,
val activationState: ActivationState,
val secondaryLabel: CharSequence?,
@@ -58,7 +57,7 @@ data class QSTileState(
): QSTileState {
val iconDrawable = resources.getDrawable(config.iconRes, theme)
return build(
- Icon.Loaded(iconDrawable, null),
+ Icon.Loaded(iconDrawable, null, config.iconRes),
resources.getString(config.labelRes),
builder,
)
@@ -115,7 +114,6 @@ data class QSTileState(
}
class Builder(var icon: Icon?, var label: CharSequence) {
- var iconRes: Int? = null
var activationState: ActivationState = ActivationState.INACTIVE
var secondaryLabel: CharSequence? = null
var supportedActions: Set<UserAction> = setOf(UserAction.CLICK)
@@ -128,7 +126,6 @@ data class QSTileState(
fun build(): QSTileState =
QSTileState(
icon,
- iconRes,
label,
activationState,
secondaryLabel,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt
index 632eeefcb462..c34edc81bfe7 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt
@@ -260,8 +260,8 @@ constructor(
icon =
when (val stateIcon = viewModelState.icon) {
is Icon.Loaded ->
- if (viewModelState.iconRes == null) DrawableIcon(stateIcon.drawable)
- else DrawableIconWithRes(stateIcon.drawable, viewModelState.iconRes)
+ if (stateIcon.res == null) DrawableIcon(stateIcon.drawable)
+ else DrawableIconWithRes(stateIcon.drawable, stateIcon.res)
is Icon.Resource -> ResourceIcon.get(stateIcon.res)
null -> null
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
index ab1c1818bf80..aa29808bd9ee 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt
@@ -45,7 +45,6 @@ private constructor(failureMetadata: FailureMetadata, subject: QSTileState?) :
other ?: return
}
check("icon").that(actual.icon).isEqualTo(other.icon)
- check("iconRes").that(actual.iconRes).isEqualTo(other.iconRes)
check("label").that(actual.label).isEqualTo(other.label)
check("activationState").that(actual.activationState).isEqualTo(other.activationState)
check("secondaryLabel").that(actual.secondaryLabel).isEqualTo(other.secondaryLabel)