summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt12
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/viewmodel/QSTileViewModelImplTest.kt6
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/AirplaneModeMapperTest.kt10
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapperTest.kt20
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapperTest.kt4
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapperTest.kt8
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileMapperTest.kt28
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt8
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapperTest.kt13
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/hearingdevices/domain/HearingDevicesTileMapperTest.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/internet/domain/InternetTileMapperTest.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapperTest.kt10
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapperTest.kt6
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapperTest.kt24
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapperTest.kt42
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapperTest.kt12
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapperTest.kt24
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapperTest.kt13
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapperTest.kt18
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapperTest.kt12
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/screenrecord/ui/ScreenRecordTileMapperTest.kt8
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapperTest.kt12
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapperTest.kt52
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/work/ui/WorkModeTileMapperTest.kt14
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt5
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt5
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/airplane/domain/AirplaneModeMapper.kt22
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/alarm/domain/AlarmTileMapper.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/battery/ui/BatterySaverTileMapper.kt9
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/colorcorrection/domain/ColorCorrectionTileMapper.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/custom/domain/CustomTileMapper.kt27
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/fontscaling/domain/FontScalingTileMapper.kt16
-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.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/inversion/domain/ColorInversionTileMapper.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/irecording/IssueRecordingMapper.kt31
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/location/domain/LocationTileMapper.kt18
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/modes/ui/ModesTileMapper.kt13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/night/ui/NightDisplayTileMapper.kt7
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/onehanded/ui/OneHandedModeTileMapper.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/qr/ui/QRCodeScannerTileMapper.kt8
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/reducebrightness/ui/ReduceBrightColorsTileMapper.kt13
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/rotation/ui/mapper/RotationLockTileMapper.kt25
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/saver/domain/DataSaverTileMapper.kt10
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/screenrecord/domain/ui/ScreenRecordTileMapper.kt26
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/sensorprivacy/ui/SensorPrivacyToggleTileMapper.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/uimodenight/domain/UiModeNightTileMapper.kt13
-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.kt18
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelAdapter.kt6
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/custom/QSTileStateSubject.kt2
54 files changed, 280 insertions, 442 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt
index ff40e43e2c8c..a06353171c33 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/logging/QSTileLoggerTest.kt
@@ -115,7 +115,7 @@ class QSTileLoggerTest : SysuiTestCase() {
underTest.logUserActionPipeline(
TileSpec.create("test_spec"),
QSTileUserAction.Click(null),
- QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {},
+ QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {},
"test_data",
)
@@ -141,7 +141,7 @@ class QSTileLoggerTest : SysuiTestCase() {
fun testLogStateUpdate() {
underTest.logStateUpdate(
TileSpec.create("test_spec"),
- QSTileState.build({ Icon.Resource(0, ContentDescription.Resource(0)) }, "") {},
+ QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), "") {},
"test_data",
)
@@ -162,18 +162,14 @@ class QSTileLoggerTest : SysuiTestCase() {
@Test
fun testLogForceUpdate() {
- underTest.logForceUpdate(
- TileSpec.create("test_spec"),
- )
+ underTest.logForceUpdate(TileSpec.create("test_spec"))
assertThat(logBuffer.getStringBuffer()).contains("tile data force update")
}
@Test
fun testLogInitialUpdate() {
- underTest.logInitialRequest(
- TileSpec.create("test_spec"),
- )
+ underTest.logInitialRequest(TileSpec.create("test_spec"))
assertThat(logBuffer.getStringBuffer()).contains("tile data initial update")
}
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 c918ed82604c..056efb34a0b1 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
@@ -85,8 +85,8 @@ class QSTileViewModelImplTest : SysuiTestCase() {
object : QSTileDataToStateMapper<Any> {
override fun map(config: QSTileConfig, data: Any): QSTileState =
QSTileState.build(
- { Icon.Resource(0, ContentDescription.Resource(0)) },
- data.toString()
+ Icon.Resource(0, ContentDescription.Resource(0)),
+ data.toString(),
) {}
}
},
@@ -116,7 +116,7 @@ class QSTileViewModelImplTest : SysuiTestCase() {
.isEqualTo(
"test_spec:\n" +
" QSTileState(" +
- "icon=() -> com.android.systemui.common.shared.model.Icon?, " +
+ "icon=Resource(res=0, contentDescription=Resource(res=0)), " +
"iconRes=null, " +
"label=test_data, " +
"activationState=INACTIVE, " +
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 5a73fe28ee18..00460bfe83b2 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
@@ -66,7 +66,7 @@ class AirplaneModeMapperTest : SysuiTestCase() {
createAirplaneModeState(
QSTileState.ActivationState.ACTIVE,
context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_ACTIVE],
- R.drawable.qs_airplane_icon_on
+ R.drawable.qs_airplane_icon_on,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -81,7 +81,7 @@ class AirplaneModeMapperTest : SysuiTestCase() {
createAirplaneModeState(
QSTileState.ActivationState.INACTIVE,
context.resources.getStringArray(R.array.tile_states_airplane)[Tile.STATE_INACTIVE],
- R.drawable.qs_airplane_icon_off
+ R.drawable.qs_airplane_icon_off,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -89,11 +89,11 @@ class AirplaneModeMapperTest : SysuiTestCase() {
private fun createAirplaneModeState(
activationState: QSTileState.ActivationState,
secondaryLabel: String,
- iconRes: Int
+ iconRes: Int,
): QSTileState {
val label = context.getString(R.string.airplane_mode)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -103,7 +103,7 @@ class AirplaneModeMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 79e4fef874b6..632aae035ede 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
@@ -51,7 +51,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
.apply { addOverride(R.drawable.ic_alarm, TestStubDrawable()) }
.resources,
context.theme,
- fakeClock
+ fakeClock,
)
}
@@ -69,7 +69,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val expectedState =
createAlarmTileState(
QSTileState.ActivationState.INACTIVE,
- context.getString(R.string.qs_alarm_tile_no_alarm)
+ context.getString(R.string.qs_alarm_tile_no_alarm),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -85,7 +85,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val localDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val expectedSecondaryLabel = AlarmTileMapper.formatter24Hour.format(localDateTime)
val expectedState =
@@ -104,7 +104,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val localDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime)
val expectedState =
@@ -124,7 +124,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val localDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime)
val expectedState =
@@ -144,7 +144,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val localDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val expectedSecondaryLabel = AlarmTileMapper.formatter12Hour.format(localDateTime)
val expectedState =
@@ -164,7 +164,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
val localDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val expectedSecondaryLabel = AlarmTileMapper.formatterDateOnly.format(localDateTime)
val expectedState =
@@ -174,11 +174,11 @@ class AlarmTileMapperTest : SysuiTestCase() {
private fun createAlarmTileState(
activationState: QSTileState.ActivationState,
- secondaryLabel: String
+ secondaryLabel: String,
): QSTileState {
val label = context.getString(R.string.status_bar_alarm)
return QSTileState(
- { Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null) },
+ Icon.Loaded(context.getDrawable(R.drawable.ic_alarm)!!, null),
R.drawable.ic_alarm,
label,
activationState,
@@ -188,7 +188,7 @@ class AlarmTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.Chevron,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 a0d26c28cbfa..5385f945946c 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,7 +253,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.battery_detail_switch_title)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -265,7 +265,7 @@ class BatterySaverTileMapperTest : SysuiTestCase() {
stateDescription,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 ea7b7c5f797d..356b98eb192e 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
@@ -45,7 +45,7 @@ class ColorCorrectionTileMapperTest : SysuiTestCase() {
context.orCreateTestableResources
.apply { addOverride(R.drawable.ic_qs_color_correction, TestStubDrawable()) }
.resources,
- context.theme
+ context.theme,
)
}
@@ -73,11 +73,11 @@ class ColorCorrectionTileMapperTest : SysuiTestCase() {
private fun createColorCorrectionTileState(
activationState: QSTileState.ActivationState,
- secondaryLabel: String
+ secondaryLabel: String,
): 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) },
+ Icon.Loaded(context.getDrawable(R.drawable.ic_qs_color_correction)!!, null),
R.drawable.ic_qs_color_correction,
label,
activationState,
@@ -87,7 +87,7 @@ class ColorCorrectionTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 f1d08c068150..8236c4c1e638 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
@@ -57,10 +57,7 @@ class CustomTileMapperTest : SysuiTestCase() {
private val kosmos =
testKosmos().apply { customTileSpec = TileSpec.Companion.create(TEST_COMPONENT) }
private val underTest by lazy {
- CustomTileMapper(
- context = mockContext,
- uriGrantsManager = uriGrantsManager,
- )
+ CustomTileMapper(context = mockContext, uriGrantsManager = uriGrantsManager)
}
@Test
@@ -68,10 +65,7 @@ class CustomTileMapperTest : SysuiTestCase() {
with(kosmos) {
testScope.runTest {
val actual =
- underTest.map(
- customTileQsTileConfig,
- createModel(hasPendingBind = true),
- )
+ underTest.map(customTileQsTileConfig, createModel(hasPendingBind = true))
val expected =
createTileState(
activationState = QSTileState.ActivationState.UNAVAILABLE,
@@ -91,10 +85,7 @@ class CustomTileMapperTest : SysuiTestCase() {
customTileQsTileConfig,
createModel(tileState = Tile.STATE_ACTIVE),
)
- val expected =
- createTileState(
- activationState = QSTileState.ActivationState.ACTIVE,
- )
+ val expected = createTileState(activationState = QSTileState.ActivationState.ACTIVE)
assertThat(actual).isEqualTo(expected)
}
@@ -110,9 +101,7 @@ class CustomTileMapperTest : SysuiTestCase() {
createModel(tileState = Tile.STATE_INACTIVE),
)
val expected =
- createTileState(
- activationState = QSTileState.ActivationState.INACTIVE,
- )
+ createTileState(activationState = QSTileState.ActivationState.INACTIVE)
assertThat(actual).isEqualTo(expected)
}
@@ -142,10 +131,7 @@ class CustomTileMapperTest : SysuiTestCase() {
with(kosmos) {
testScope.runTest {
val actual =
- underTest.map(
- customTileQsTileConfig,
- createModel(isToggleable = false),
- )
+ underTest.map(customTileQsTileConfig, createModel(isToggleable = false))
val expected =
createTileState(
sideIcon = QSTileState.SideViewIcon.Chevron,
@@ -184,7 +170,7 @@ class CustomTileMapperTest : SysuiTestCase() {
customTileQsTileConfig,
createModel(
tileIcon = createIcon(RuntimeException(), false),
- defaultTileIcon = createIcon(null, true)
+ defaultTileIcon = createIcon(null, true),
),
)
val expected =
@@ -266,7 +252,7 @@ class CustomTileMapperTest : SysuiTestCase() {
a11yClass: String? = Switch::class.qualifiedName,
): QSTileState {
return QSTileState(
- { icon?.let { com.android.systemui.common.shared.model.Icon.Loaded(icon, null) } },
+ icon?.let { com.android.systemui.common.shared.model.Icon.Loaded(icon, null) },
null,
"test label",
activationState,
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 63fb67d432f0..587585ccee2e 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
@@ -44,7 +44,7 @@ class FlashlightMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_flashlight_icon_on, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -74,7 +74,7 @@ class FlashlightMapperTest : SysuiTestCase() {
val expectedIcon =
Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_on)!!, null)
- val actualIcon = tileState.icon()
+ val actualIcon = tileState.icon
assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -85,7 +85,7 @@ class FlashlightMapperTest : SysuiTestCase() {
val expectedIcon =
Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_off)!!, null)
- val actualIcon = tileState.icon()
+ val actualIcon = tileState.icon
assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -96,7 +96,7 @@ class FlashlightMapperTest : SysuiTestCase() {
val expectedIcon =
Icon.Loaded(context.getDrawable(R.drawable.qs_flashlight_icon_off)!!, null)
- val actualIcon = tileState.icon()
+ 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 f8e01be5163f..e81771ec38d5 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
@@ -42,7 +42,7 @@ class FontScalingTileMapperTest : SysuiTestCase() {
context.orCreateTestableResources
.apply { addOverride(R.drawable.ic_qs_font_scaling, TestStubDrawable()) }
.resources,
- context.theme
+ context.theme,
)
}
@@ -58,14 +58,7 @@ class FontScalingTileMapperTest : SysuiTestCase() {
private fun createFontScalingTileState(): QSTileState =
QSTileState(
- {
- Icon.Loaded(
- context.getDrawable(
- R.drawable.ic_qs_font_scaling,
- )!!,
- null
- )
- },
+ 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,
@@ -75,6 +68,6 @@ class FontScalingTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.Chevron,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
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 cdf6bda91301..12d604ff6a7c 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,7 +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) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
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 d32ba47204c0..9dcf49e02697 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
@@ -187,7 +187,7 @@ class InternetTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_internet_label)
return QSTileState(
- { icon },
+ icon,
iconRes,
label,
activationState,
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 a7bd69770a4f..30fce73e04da 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
@@ -49,7 +49,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_invert_colors_icon_on, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -63,7 +63,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
createColorInversionTileState(
QSTileState.ActivationState.INACTIVE,
subtitleArray[1],
- R.drawable.qs_invert_colors_icon_off
+ R.drawable.qs_invert_colors_icon_off,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -78,7 +78,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
createColorInversionTileState(
QSTileState.ActivationState.ACTIVE,
subtitleArray[2],
- R.drawable.qs_invert_colors_icon_on
+ R.drawable.qs_invert_colors_icon_on,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -90,7 +90,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_inversion_label)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -100,7 +100,7 @@ class ColorInversionTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 ea74a4c0d398..37e8a6053682 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
@@ -45,7 +45,7 @@ class LocationTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_location_icon_on, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -70,7 +70,7 @@ class LocationTileMapperTest : SysuiTestCase() {
val tileState: QSTileState = mapper.map(qsTileConfig, LocationTileModel(true))
val expectedIcon = Icon.Loaded(context.getDrawable(R.drawable.qs_location_icon_on)!!, null)
- val actualIcon = tileState.icon()
+ val actualIcon = tileState.icon
Truth.assertThat(actualIcon).isEqualTo(expectedIcon)
}
@@ -79,7 +79,7 @@ class LocationTileMapperTest : SysuiTestCase() {
val tileState: QSTileState = mapper.map(qsTileConfig, LocationTileModel(false))
val expectedIcon = Icon.Loaded(context.getDrawable(R.drawable.qs_location_icon_off)!!, null)
- val actualIcon = tileState.icon()
+ val actualIcon = tileState.icon
Truth.assertThat(actualIcon).isEqualTo(expectedIcon)
}
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 c3d45dbbd09a..4e91d16bf1ec 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
@@ -59,34 +59,24 @@ class ModesTileMapperTest : SysuiTestCase() {
@Test
fun inactiveState() {
val icon = TestStubDrawable("res123").asIcon()
- val model =
- ModesTileModel(
- isActivated = false,
- activeModes = emptyList(),
- icon = icon,
- )
+ val model = ModesTileModel(isActivated = false, activeModes = emptyList(), icon = icon)
val state = underTest.map(config, model)
assertThat(state.activationState).isEqualTo(QSTileState.ActivationState.INACTIVE)
- assertThat(state.icon()).isEqualTo(icon)
+ assertThat(state.icon).isEqualTo(icon)
assertThat(state.secondaryLabel).isEqualTo("No active modes")
}
@Test
fun activeState_oneMode() {
val icon = TestStubDrawable("res123").asIcon()
- val model =
- ModesTileModel(
- isActivated = true,
- activeModes = listOf("DND"),
- icon = icon,
- )
+ val model = ModesTileModel(isActivated = true, activeModes = listOf("DND"), icon = icon)
val state = underTest.map(config, model)
assertThat(state.activationState).isEqualTo(QSTileState.ActivationState.ACTIVE)
- assertThat(state.icon()).isEqualTo(icon)
+ assertThat(state.icon).isEqualTo(icon)
assertThat(state.secondaryLabel).isEqualTo("DND is active")
}
@@ -103,7 +93,7 @@ class ModesTileMapperTest : SysuiTestCase() {
val state = underTest.map(config, model)
assertThat(state.activationState).isEqualTo(QSTileState.ActivationState.ACTIVE)
- assertThat(state.icon()).isEqualTo(icon)
+ assertThat(state.icon).isEqualTo(icon)
assertThat(state.secondaryLabel).isEqualTo("3 modes are active")
}
@@ -115,12 +105,12 @@ class ModesTileMapperTest : SysuiTestCase() {
isActivated = false,
activeModes = emptyList(),
icon = icon,
- iconResId = 123
+ iconResId = 123,
)
val state = underTest.map(config, model)
- assertThat(state.icon()).isEqualTo(icon)
+ 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 75273f2a52e1..1457f533f5ec 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
@@ -73,7 +73,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.INACTIVE,
- context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_INACTIVE]
+ context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_INACTIVE],
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -88,7 +88,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.INACTIVE,
- context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_INACTIVE]
+ context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_INACTIVE],
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -102,7 +102,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.ACTIVE,
- context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_ACTIVE]
+ context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_ACTIVE],
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -116,7 +116,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.ACTIVE,
- context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_ACTIVE]
+ context.resources.getStringArray(R.array.tile_states_night)[Tile.STATE_ACTIVE],
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -140,7 +140,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.ACTIVE,
- context.getString(R.string.quick_settings_night_secondary_label_until_sunrise)
+ context.getString(R.string.quick_settings_night_secondary_label_until_sunrise),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -154,7 +154,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
val expectedState =
createNightDisplayTileState(
QSTileState.ActivationState.INACTIVE,
- context.getString(R.string.quick_settings_night_secondary_label_on_at_sunset)
+ context.getString(R.string.quick_settings_night_secondary_label_on_at_sunset),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -181,8 +181,8 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.INACTIVE,
context.getString(
R.string.quick_settings_night_secondary_label_on_at,
- formatter24Hour.format(testStartTime)
- )
+ formatter24Hour.format(testStartTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -199,8 +199,8 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.INACTIVE,
context.getString(
R.string.quick_settings_night_secondary_label_on_at,
- formatter12Hour.format(testStartTime)
- )
+ formatter12Hour.format(testStartTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -218,8 +218,8 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.INACTIVE,
context.getString(
R.string.quick_settings_night_secondary_label_on_at,
- formatter12Hour.format(testStartTime)
- )
+ formatter12Hour.format(testStartTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -235,8 +235,8 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.ACTIVE,
context.getString(
R.string.quick_settings_secondary_label_until,
- formatter24Hour.format(testEndTime)
- )
+ formatter24Hour.format(testEndTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -252,8 +252,8 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.ACTIVE,
context.getString(
R.string.quick_settings_secondary_label_until,
- formatter12Hour.format(testEndTime)
- )
+ formatter12Hour.format(testEndTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -270,15 +270,15 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.ACTIVE,
context.getString(
R.string.quick_settings_secondary_label_until,
- formatter24Hour.format(testEndTime)
- )
+ formatter24Hour.format(testEndTime),
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
private fun createNightDisplayTileState(
activationState: QSTileState.ActivationState,
- secondaryLabel: String?
+ secondaryLabel: String?,
): QSTileState {
val label = context.getString(R.string.quick_settings_night_display_label)
val iconRes =
@@ -289,7 +289,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
if (TextUtils.isEmpty(secondaryLabel)) label
else TextUtils.concat(label, ", ", secondaryLabel)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -299,7 +299,7 @@ class NightDisplayTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
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 3189a9e063a1..7782d2b279a8 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
@@ -51,11 +51,11 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
.apply {
addOverride(
com.android.internal.R.drawable.ic_qs_one_handed_mode,
- TestStubDrawable()
+ TestStubDrawable(),
)
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -69,7 +69,7 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
createOneHandedModeTileState(
QSTileState.ActivationState.INACTIVE,
subtitleArray[1],
- com.android.internal.R.drawable.ic_qs_one_handed_mode
+ com.android.internal.R.drawable.ic_qs_one_handed_mode,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -84,7 +84,7 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
createOneHandedModeTileState(
QSTileState.ActivationState.ACTIVE,
subtitleArray[2],
- com.android.internal.R.drawable.ic_qs_one_handed_mode
+ com.android.internal.R.drawable.ic_qs_one_handed_mode,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -96,7 +96,7 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(R.string.quick_settings_onehanded_label)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -106,7 +106,7 @@ class OneHandedModeTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 08e5cbef31ab..ed33250a3392 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
@@ -49,11 +49,11 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
.apply {
addOverride(
com.android.systemui.res.R.drawable.ic_qr_code_scanner,
- TestStubDrawable()
+ TestStubDrawable(),
)
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -64,11 +64,7 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
val outputState = mapper.map(config, inputModel)
- val expectedState =
- createQRCodeScannerTileState(
- QSTileState.ActivationState.INACTIVE,
- null,
- )
+ val expectedState = createQRCodeScannerTileState(QSTileState.ActivationState.INACTIVE, null)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -83,7 +79,7 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
QSTileState.ActivationState.UNAVAILABLE,
context.getString(
com.android.systemui.res.R.string.qr_code_scanner_updating_secondary_label
- )
+ ),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -94,12 +90,10 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
): QSTileState {
val label = context.getString(com.android.systemui.res.R.string.qr_code_scanner_title)
return QSTileState(
- {
- Icon.Loaded(
- context.getDrawable(com.android.systemui.res.R.drawable.ic_qr_code_scanner)!!,
- null
- )
- },
+ 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,
label,
activationState,
@@ -109,7 +103,7 @@ class QRCodeScannerTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.Chevron,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 ca30e9ca3e69..85111fd07663 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
@@ -51,7 +51,7 @@ class ReduceBrightColorsTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_extra_dim_icon_off, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -61,10 +61,7 @@ class ReduceBrightColorsTileMapperTest : SysuiTestCase() {
val outputState = mapper.map(config, inputModel)
- val expectedState =
- createReduceBrightColorsTileState(
- QSTileState.ActivationState.INACTIVE,
- )
+ val expectedState = createReduceBrightColorsTileState(QSTileState.ActivationState.INACTIVE)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -79,7 +76,7 @@ class ReduceBrightColorsTileMapperTest : SysuiTestCase() {
}
private fun createReduceBrightColorsTileState(
- activationState: QSTileState.ActivationState,
+ activationState: QSTileState.ActivationState
): QSTileState {
val label =
context.getString(com.android.internal.R.string.reduce_bright_colors_feature_name)
@@ -88,7 +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) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -101,7 +98,7 @@ class ReduceBrightColorsTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 3e40c5ca797c..53671ba38eb6 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
@@ -66,13 +66,13 @@ class RotationLockTileMapperTest : SysuiTestCase() {
addOverride(com.android.internal.R.bool.config_allowRotationResolver, true)
addOverride(
com.android.internal.R.array.config_foldedDeviceStates,
- intArrayOf() // empty array <=> device is not foldable
+ intArrayOf(), // empty array <=> device is not foldable
)
}
.resources,
context.theme,
devicePostureController,
- deviceStateManager
+ deviceStateManager,
)
}
@@ -86,7 +86,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
createRotationLockTileState(
QSTileState.ActivationState.ACTIVE,
EMPTY_SECONDARY_STRING,
- R.drawable.qs_auto_rotate_icon_on
+ R.drawable.qs_auto_rotate_icon_on,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -101,7 +101,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
createRotationLockTileState(
QSTileState.ActivationState.ACTIVE,
context.getString(R.string.rotation_lock_camera_rotation_on),
- R.drawable.qs_auto_rotate_icon_on
+ R.drawable.qs_auto_rotate_icon_on,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -116,7 +116,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
createRotationLockTileState(
QSTileState.ActivationState.INACTIVE,
EMPTY_SECONDARY_STRING,
- R.drawable.qs_auto_rotate_icon_off
+ R.drawable.qs_auto_rotate_icon_off,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -167,7 +167,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
mapper.apply {
overrideResource(
com.android.internal.R.array.config_foldedDeviceStates,
- intArrayOf(1, 2, 3)
+ intArrayOf(1, 2, 3),
)
}
whenever(deviceStateManager.supportedDeviceStates).thenReturn(kosmos.foldedDeviceStateList)
@@ -176,11 +176,11 @@ class RotationLockTileMapperTest : SysuiTestCase() {
private fun createRotationLockTileState(
activationState: QSTileState.ActivationState,
secondaryLabel: String,
- iconRes: Int
+ iconRes: Int,
): QSTileState {
val label = context.getString(R.string.quick_settings_rotation_unlocked_label)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -190,7 +190,7 @@ class RotationLockTileMapperTest : SysuiTestCase() {
secondaryLabel,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
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 9bb61415de28..9a450653aa8f 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
@@ -46,7 +46,7 @@ class DataSaverTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_data_saver_icon_on, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -59,7 +59,7 @@ class DataSaverTileMapperTest : SysuiTestCase() {
val expectedState =
createDataSaverTileState(
QSTileState.ActivationState.ACTIVE,
- R.drawable.qs_data_saver_icon_on
+ R.drawable.qs_data_saver_icon_on,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -73,14 +73,14 @@ class DataSaverTileMapperTest : SysuiTestCase() {
val expectedState =
createDataSaverTileState(
QSTileState.ActivationState.INACTIVE,
- R.drawable.qs_data_saver_icon_off
+ R.drawable.qs_data_saver_icon_off,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
private fun createDataSaverTileState(
activationState: QSTileState.ActivationState,
- iconRes: Int
+ iconRes: Int,
): QSTileState {
val label = context.getString(R.string.data_saver)
val secondaryLabel =
@@ -91,7 +91,7 @@ class DataSaverTileMapperTest : SysuiTestCase() {
else context.resources.getStringArray(R.array.tile_states_saver)[0]
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -101,7 +101,7 @@ class DataSaverTileMapperTest : SysuiTestCase() {
null,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 336b56612261..cd683c44a59c 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
@@ -52,7 +52,7 @@ class ScreenRecordTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_screen_record_icon_off, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -82,7 +82,7 @@ class ScreenRecordTileMapperTest : SysuiTestCase() {
createScreenRecordTileState(
QSTileState.ActivationState.ACTIVE,
R.drawable.qs_screen_record_icon_on,
- String.format("%d...", timeLeft)
+ String.format("%d...", timeLeft),
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -110,7 +110,7 @@ class ScreenRecordTileMapperTest : SysuiTestCase() {
val label = context.getString(R.string.quick_settings_screen_record_label)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -123,7 +123,7 @@ class ScreenRecordTileMapperTest : SysuiTestCase() {
QSTileState.SideViewIcon.Chevron
else QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 b08f39b0accf..c569403960d0 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
@@ -56,7 +56,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
context.getString(R.string.quick_settings_camera_mic_available),
R.drawable.qs_camera_access_icon_on,
null,
- CAMERA
+ CAMERA,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -74,7 +74,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
context.getString(R.string.quick_settings_camera_mic_blocked),
R.drawable.qs_camera_access_icon_off,
null,
- CAMERA
+ CAMERA,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -92,7 +92,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
context.getString(R.string.quick_settings_camera_mic_available),
R.drawable.qs_mic_access_on,
null,
- MICROPHONE
+ MICROPHONE,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -110,7 +110,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
context.getString(R.string.quick_settings_camera_mic_blocked),
R.drawable.qs_mic_access_off,
null,
- MICROPHONE
+ MICROPHONE,
)
QSTileStateSubject.assertThat(outputState).isEqualTo(expectedState)
}
@@ -146,7 +146,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
else context.getString(R.string.quick_settings_mic_label)
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -156,7 +156,7 @@ class SensorPrivacyToggleTileMapperTest : SysuiTestCase() {
stateDescription,
QSTileState.SideViewIcon.None,
QSTileState.EnabledState.ENABLED,
- Switch::class.qualifiedName
+ Switch::class.qualifiedName,
)
}
}
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 c021caa598b9..0d2ebe42b7ad 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
@@ -49,7 +49,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
addOverride(R.drawable.qs_light_dark_theme_icon_on, TestStubDrawable())
}
.resources,
- context.theme
+ context.theme,
)
}
@@ -69,7 +69,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
expandedAccessibilityClass: KClass<out View>? = Switch::class,
): QSTileState {
return QSTileState(
- { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes,
label,
activationState,
@@ -79,7 +79,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
stateDescription,
sideViewIcon,
enabledState,
- expandedAccessibilityClass?.qualifiedName
+ expandedAccessibilityClass?.qualifiedName,
)
}
@@ -98,7 +98,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
createUiNightModeTileState(
activationState = QSTileState.ActivationState.UNAVAILABLE,
secondaryLabel = expectedSecondaryLabel,
- contentDescription = expectedContentDescription
+ contentDescription = expectedContentDescription,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -118,7 +118,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
createUiNightModeTileState(
activationState = QSTileState.ActivationState.UNAVAILABLE,
secondaryLabel = expectedSecondaryLabel,
- contentDescription = expectedContentDescription
+ contentDescription = expectedContentDescription,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -136,7 +136,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.INACTIVE,
label = expectedLabel,
secondaryLabel = expectedSecondaryLabel,
- contentDescription = expectedLabel
+ contentDescription = expectedLabel,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -155,7 +155,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
label = expectedLabel,
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.ACTIVE,
- contentDescription = expectedLabel
+ contentDescription = expectedLabel,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -174,7 +174,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
label = expectedLabel,
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.ACTIVE,
- contentDescription = expectedLabel
+ contentDescription = expectedLabel,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -193,7 +193,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
label = expectedLabel,
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.INACTIVE,
- contentDescription = expectedLabel
+ contentDescription = expectedLabel,
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -214,7 +214,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.ACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -237,7 +237,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.UNAVAILABLE,
contentDescription = expectedContentDescription,
- supportedActions = setOf(QSTileState.UserAction.LONG_CLICK)
+ supportedActions = setOf(QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -258,7 +258,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.INACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -279,7 +279,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.UNAVAILABLE,
contentDescription = TextUtils.concat(expectedLabel, ", ", expectedSecondaryLabel),
- supportedActions = setOf(QSTileState.UserAction.LONG_CLICK)
+ supportedActions = setOf(QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -300,7 +300,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.UNAVAILABLE,
contentDescription = TextUtils.concat(expectedLabel, ", ", expectedSecondaryLabel),
- supportedActions = setOf(QSTileState.UserAction.LONG_CLICK)
+ supportedActions = setOf(QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -312,7 +312,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
nightMode = true,
powerSave = false,
isLocationEnabled = true,
- uiMode = UiModeManager.MODE_NIGHT_AUTO
+ uiMode = UiModeManager.MODE_NIGHT_AUTO,
)
val actualState: QSTileState = mapper.map(qsTileConfig, inputModel)
@@ -328,7 +328,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.ACTIVE,
contentDescription = TextUtils.concat(expectedLabel, ", ", expectedSecondaryLabel),
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -340,7 +340,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
nightMode = false,
powerSave = false,
isLocationEnabled = true,
- uiMode = UiModeManager.MODE_NIGHT_AUTO
+ uiMode = UiModeManager.MODE_NIGHT_AUTO,
)
val actualState: QSTileState = mapper.map(qsTileConfig, inputModel)
@@ -356,7 +356,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.INACTIVE,
contentDescription = TextUtils.concat(expectedLabel, ", ", expectedSecondaryLabel),
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -379,7 +379,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.ACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -401,7 +401,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.INACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -413,7 +413,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
nightMode = false,
powerSave = false,
uiMode = UiModeManager.MODE_NIGHT_CUSTOM,
- nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN
+ nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN,
)
val actualState: QSTileState = mapper.map(qsTileConfig, inputModel)
@@ -428,7 +428,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.INACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -440,7 +440,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
nightMode = true,
powerSave = false,
uiMode = UiModeManager.MODE_NIGHT_CUSTOM,
- nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN
+ nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN,
)
val actualState: QSTileState = mapper.map(qsTileConfig, inputModel)
@@ -455,7 +455,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
activationState = QSTileState.ActivationState.ACTIVE,
contentDescription = expectedLabel,
supportedActions =
- setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
@@ -467,7 +467,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
nightMode = false,
powerSave = true,
uiMode = UiModeManager.MODE_NIGHT_CUSTOM,
- nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN
+ nighModeCustomType = UiModeManager.MODE_NIGHT_CUSTOM_TYPE_UNKNOWN,
)
val actualState: QSTileState = mapper.map(qsTileConfig, inputModel)
@@ -484,7 +484,7 @@ class UiModeNightTileMapperTest : SysuiTestCase() {
secondaryLabel = expectedSecondaryLabel,
activationState = QSTileState.ActivationState.UNAVAILABLE,
contentDescription = expectedContentDescription,
- supportedActions = setOf(QSTileState.UserAction.LONG_CLICK)
+ supportedActions = setOf(QSTileState.UserAction.LONG_CLICK),
)
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
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 e7bde681fe6f..86321ea04703 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
@@ -56,7 +56,7 @@ class WorkModeTileMapperTest : SysuiTestCase() {
whenever(
devicePolicyResourceManager.getString(
eq(DevicePolicyResources.Strings.SystemUi.QS_WORK_PROFILE_LABEL),
- any()
+ any(),
)
)
.thenReturn(testLabel)
@@ -66,12 +66,12 @@ class WorkModeTileMapperTest : SysuiTestCase() {
.apply {
addOverride(
com.android.internal.R.drawable.stat_sys_managed_profile_status,
- TestStubDrawable()
+ TestStubDrawable(),
)
}
.resources,
context.theme,
- devicePolicyManager
+ devicePolicyManager,
)
}
@@ -105,13 +105,11 @@ class WorkModeTileMapperTest : SysuiTestCase() {
QSTileStateSubject.assertThat(actualState).isEqualTo(expectedState)
}
- private fun createWorkModeTileState(
- activationState: QSTileState.ActivationState,
- ): QSTileState {
+ private fun createWorkModeTileState(activationState: QSTileState.ActivationState): QSTileState {
val label = testLabel
val iconRes = com.android.internal.R.drawable.stat_sys_managed_profile_status
return QSTileState(
- icon = { Icon.Loaded(context.getDrawable(iconRes)!!, null) },
+ icon = Icon.Loaded(context.getDrawable(iconRes)!!, null),
iconRes = iconRes,
label = label,
activationState = activationState,
@@ -134,7 +132,7 @@ class WorkModeTileMapperTest : SysuiTestCase() {
stateDescription = null,
sideViewIcon = QSTileState.SideViewIcon.None,
enabledState = QSTileState.EnabledState.ENABLED,
- expandedAccessibilityClassName = Switch::class.qualifiedName
+ expandedAccessibilityClassName = Switch::class.qualifiedName,
)
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt
index c33e2a49ef5d..954215eede0d 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelTest.kt
@@ -184,10 +184,7 @@ class QSTileViewModelTest : SysuiTestCase() {
{
object : QSTileDataToStateMapper<String> {
override fun map(config: QSTileConfig, data: String): QSTileState =
- QSTileState.build(
- { Icon.Resource(0, ContentDescription.Resource(0)) },
- data
- ) {}
+ QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), data) {}
}
},
disabledByPolicyInteractor,
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt
index 7955f2fc1335..0219a4c58dcf 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/viewmodel/QSTileViewModelUserInputTest.kt
@@ -104,7 +104,7 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
eq(tileConfig.tileSpec),
eq(userAction),
any(),
- eq("initial_data")
+ eq("initial_data"),
)
verify(qsTileAnalytics).trackUserAction(eq(tileConfig), eq(userAction))
}
@@ -130,7 +130,7 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
.logUserActionRejectedByPolicy(
eq(userAction),
eq(tileConfig.tileSpec),
- eq(DISABLED_RESTRICTION)
+ eq(DISABLED_RESTRICTION),
)
verify(qsTileAnalytics, never()).trackUserAction(any(), any())
}
@@ -159,7 +159,7 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
.logUserActionRejectedByPolicy(
eq(userAction),
eq(tileConfig.tileSpec),
- eq(DISABLED_RESTRICTION)
+ eq(DISABLED_RESTRICTION),
)
verify(qsTileAnalytics, never()).trackUserAction(any(), any())
}
@@ -174,7 +174,7 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
QSTilePolicy.Restricted(
listOf(
DISABLED_RESTRICTION,
- FakeDisabledByPolicyInteractor.DISABLED_RESTRICTION_2
+ FakeDisabledByPolicyInteractor.DISABLED_RESTRICTION_2,
)
)
}
@@ -194,13 +194,13 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
.logUserActionRejectedByPolicy(
eq(userAction),
eq(tileConfig.tileSpec),
- eq(DISABLED_RESTRICTION)
+ eq(DISABLED_RESTRICTION),
)
verify(qsTileLogger, never())
.logUserActionRejectedByPolicy(
eq(userAction),
eq(tileConfig.tileSpec),
- eq(FakeDisabledByPolicyInteractor.DISABLED_RESTRICTION_2)
+ eq(FakeDisabledByPolicyInteractor.DISABLED_RESTRICTION_2),
)
verify(qsTileAnalytics, never()).trackUserAction(any(), any())
}
@@ -243,10 +243,7 @@ class QSTileViewModelUserInputTest : SysuiTestCase() {
{
object : QSTileDataToStateMapper<String> {
override fun map(config: QSTileConfig, data: String): QSTileState =
- QSTileState.build(
- { Icon.Resource(0, ContentDescription.Resource(0)) },
- data
- ) {}
+ QSTileState.build(Icon.Resource(0, ContentDescription.Resource(0)), data) {}
}
},
disabledByPolicyInteractor,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt
index 1c9cb3d99480..fef5a745c1ca 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ModesTile.kt
@@ -25,6 +25,7 @@ import androidx.annotation.VisibleForTesting
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.coroutineScope
import androidx.lifecycle.repeatOnLifecycle
+import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.internal.logging.MetricsLogger
import com.android.systemui.animation.Expandable
import com.android.systemui.dagger.qualifiers.Background
@@ -48,7 +49,6 @@ import com.android.systemui.qs.tiles.viewmodel.QSTileConfigProvider
import com.android.systemui.qs.tiles.viewmodel.QSTileState
import com.android.systemui.res.R
import javax.inject.Inject
-import com.android.app.tracing.coroutines.launchTraced as launch
import kotlinx.coroutines.runBlocking
class ModesTile
@@ -120,8 +120,7 @@ constructor(
tileState = tileMapper.map(config, model)
state?.apply {
this.state = tileState.activationState.legacyState
- val tileStateIcon = tileState.icon()
- icon = tileStateIcon?.asQSTileIcon() ?: ResourceIcon.get(ICON_RES_ID)
+ icon = tileState.icon?.asQSTileIcon() ?: ResourceIcon.get(ICON_RES_ID)
label = tileLabel
secondaryLabel = tileState.secondaryLabel
contentDescription = tileState.contentDescription
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 9fb1d46c4241..d67057a2f476 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [AirplaneModeTileModel] to [QSTileState]. */
class AirplaneModeMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- val theme: Theme,
-) : QSTileDataToStateMapper<AirplaneModeTileModel> {
+constructor(@Main private val resources: Resources, val theme: Theme) :
+ QSTileDataToStateMapper<AirplaneModeTileModel> {
override fun map(config: QSTileConfig, data: AirplaneModeTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
@@ -43,16 +41,7 @@ constructor(
} else {
R.drawable.qs_airplane_icon_off
}
-
- icon = {
- Icon.Loaded(
- resources.getDrawable(
- iconRes!!,
- theme,
- ),
- contentDescription = null
- )
- }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = resources.getStringArray(R.array.tile_states_airplane)[2]
@@ -62,9 +51,6 @@ constructor(
}
contentDescription = label
supportedActions =
- setOf(
- QSTileState.UserAction.CLICK,
- QSTileState.UserAction.LONG_CLICK,
- )
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
}
}
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 f0889433094a..7322b8d098fd 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
@@ -45,6 +45,7 @@ constructor(
val formatter24Hour: DateTimeFormatter = DateTimeFormatter.ofPattern("E HH:mm")
val formatterDateOnly: DateTimeFormatter = DateTimeFormatter.ofPattern("E MMM d")
}
+
override fun map(config: QSTileConfig, data: AlarmTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
when (data) {
@@ -54,13 +55,13 @@ constructor(
val alarmDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(data.alarmClockInfo.triggerTime),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
val nowDateTime =
LocalDateTime.ofInstant(
Instant.ofEpochMilli(clock.currentTimeMillis()),
- TimeZone.getDefault().toZoneId()
+ TimeZone.getDefault().toZoneId(),
)
// Edge case: If it's 8:00:30 right now and alarm is requested for next week at
@@ -84,7 +85,7 @@ constructor(
}
}
iconRes = R.drawable.ic_alarm
- icon = { Icon.Loaded(resources.getDrawable(iconRes!!, theme), null) }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 bcf0935adf85..5b30e8d2c86b 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
@@ -29,10 +29,8 @@ import javax.inject.Inject
/** Maps [BatterySaverTileModel] to [QSTileState]. */
open class BatterySaverTileMapper
@Inject
-constructor(
- @Main protected val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<BatterySaverTileModel> {
+constructor(@Main protected val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<BatterySaverTileModel> {
override fun map(config: QSTileConfig, data: BatterySaverTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
@@ -41,8 +39,7 @@ constructor(
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)
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 cad7c65ad112..7c90b3d87958 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
@@ -17,6 +17,7 @@
package com.android.systemui.qs.tiles.impl.colorcorrection.domain
import android.content.res.Resources
+import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.qs.tiles.base.interactor.QSTileDataToStateMapper
import com.android.systemui.qs.tiles.impl.colorcorrection.domain.model.ColorCorrectionTileModel
@@ -28,17 +29,14 @@ import javax.inject.Inject
/** Maps [ColorCorrectionTileModel] to [QSTileState]. */
class ColorCorrectionTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<ColorCorrectionTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<ColorCorrectionTileModel> {
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)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
secondaryLabel = subtitleArray[2]
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/custom/domain/CustomTileMapper.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/custom/domain/CustomTileMapper.kt
index 984228d80b7f..60aa4ea4759f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/custom/domain/CustomTileMapper.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/custom/domain/CustomTileMapper.kt
@@ -35,10 +35,8 @@ import javax.inject.Inject
@SysUISingleton
class CustomTileMapper
@Inject
-constructor(
- private val context: Context,
- private val uriGrantsManager: IUriGrantsManager,
-) : QSTileDataToStateMapper<CustomTileDataModel> {
+constructor(private val context: Context, private val uriGrantsManager: IUriGrantsManager) :
+ QSTileDataToStateMapper<CustomTileDataModel> {
override fun map(config: QSTileConfig, data: CustomTileDataModel): QSTileState {
val userContext =
@@ -50,7 +48,7 @@ constructor(
val iconResult =
if (userContext != null) {
- getIconProvider(
+ getIcon(
userContext = userContext,
icon = data.tile.icon,
callingAppUid = data.callingAppUid,
@@ -58,16 +56,16 @@ constructor(
defaultIcon = data.defaultTileIcon,
)
} else {
- IconResult({ null }, true)
+ IconResult(null, true)
}
- return QSTileState.build(iconResult.iconProvider, data.tile.label) {
+ return QSTileState.build(iconResult.icon, data.tile.label) {
var tileState: Int = data.tile.state
if (data.hasPendingBind) {
tileState = Tile.STATE_UNAVAILABLE
}
- icon = iconResult.iconProvider
+ icon = iconResult.icon
activationState =
if (iconResult.failedToLoad) {
QSTileState.ActivationState.UNAVAILABLE
@@ -102,7 +100,7 @@ constructor(
}
@SuppressLint("MissingPermission") // android.permission.INTERACT_ACROSS_USERS_FULL
- private fun getIconProvider(
+ private fun getIcon(
userContext: Context,
icon: android.graphics.drawable.Icon?,
callingAppUid: Int,
@@ -123,17 +121,12 @@ constructor(
null
} ?: defaultIcon?.loadDrawable(userContext)
return IconResult(
- {
- drawable?.constantState?.newDrawable()?.let {
- Icon.Loaded(it, contentDescription = null)
- }
+ drawable?.constantState?.newDrawable()?.let {
+ Icon.Loaded(it, contentDescription = null)
},
failedToLoad,
)
}
- class IconResult(
- val iconProvider: () -> Icon?,
- val failedToLoad: Boolean,
- )
+ class IconResult(val icon: Icon?, val failedToLoad: Boolean)
}
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 d7d61241fc6c..7e557ebe4639 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [FlashlightTileModel] to [QSTileState]. */
class FlashlightMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Theme,
-) : QSTileDataToStateMapper<FlashlightTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Theme) :
+ QSTileDataToStateMapper<FlashlightTileModel> {
override fun map(config: QSTileConfig, data: FlashlightTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
@@ -43,15 +41,8 @@ constructor(
} else {
R.drawable.qs_flashlight_icon_off
}
- val icon =
- Icon.Loaded(
- resources.getDrawable(
- iconRes!!,
- theme,
- ),
- contentDescription = null
- )
- this.icon = { icon }
+
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 6b4dda13a5e6..9d44fc6ae25e 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
@@ -29,23 +29,13 @@ import javax.inject.Inject
/** Maps [FontScalingTileModel] to [QSTileState]. */
class FontScalingTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<FontScalingTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<FontScalingTileModel> {
override fun map(config: QSTileConfig, data: FontScalingTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
iconRes = R.drawable.ic_qs_font_scaling
- val icon =
- Icon.Loaded(
- resources.getDrawable(
- iconRes!!,
- theme,
- ),
- contentDescription = null
- )
- this.icon = { icon }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 8dd611f9911a..c3ac1f8d9a72 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
@@ -36,9 +36,7 @@ constructor(@Main private val resources: Resources, private val theme: Resources
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.quick_settings_hearing_devices_label)
iconRes = R.drawable.qs_hearing_devices_icon
- val loadedIcon =
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- icon = { loadedIcon }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 bb0b9b7084fa..fc945851cdad 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,28 +61,26 @@ constructor(
when (val dataIcon = data.icon) {
is InternetTileIconModel.ResourceId -> {
iconRes = dataIcon.resId
- icon = {
+ icon =
Icon.Loaded(
resources.getDrawable(dataIcon.resId, theme),
contentDescription = null,
)
- }
}
is InternetTileIconModel.Cellular -> {
val signalDrawable = SignalDrawable(context, handler)
signalDrawable.setLevel(dataIcon.level)
- icon = { Icon.Loaded(signalDrawable, contentDescription = null) }
+ icon = Icon.Loaded(signalDrawable, contentDescription = null)
}
is InternetTileIconModel.Satellite -> {
iconRes = dataIcon.resourceIcon.res // level is inferred from res
- icon = {
+ icon =
Icon.Loaded(
resources.getDrawable(dataIcon.resourceIcon.res, theme),
contentDescription = null,
)
- }
}
}
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 40aee65f41a7..3692c35472f2 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [ColorInversionTileModel] to [QSTileState]. */
class ColorInversionTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Theme,
-) : QSTileDataToStateMapper<ColorInversionTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Theme) :
+ QSTileDataToStateMapper<ColorInversionTileModel> {
override fun map(config: QSTileConfig, data: ColorInversionTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
val subtitleArray = resources.getStringArray(R.array.tile_states_inversion)
@@ -47,7 +45,7 @@ constructor(
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)
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 ff931b35567f..3fe2a7734801 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
@@ -28,21 +28,26 @@ import javax.inject.Inject
class IssueRecordingMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Theme,
-) : QSTileDataToStateMapper<IssueRecordingModel> {
+constructor(@Main private val resources: Resources, private val theme: Theme) :
+ QSTileDataToStateMapper<IssueRecordingModel> {
override fun map(config: QSTileConfig, data: IssueRecordingModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- if (data.isRecording) {
- activationState = QSTileState.ActivationState.ACTIVE
- secondaryLabel = resources.getString(R.string.qs_record_issue_stop)
- icon = { Icon.Resource(R.drawable.qs_record_issue_icon_on, null) }
- } else {
- icon = { Icon.Resource(R.drawable.qs_record_issue_icon_off, null) }
- activationState = QSTileState.ActivationState.INACTIVE
- secondaryLabel = resources.getString(R.string.qs_record_issue_start)
- }
+ icon =
+ if (data.isRecording) {
+ activationState = QSTileState.ActivationState.ACTIVE
+ secondaryLabel = resources.getString(R.string.qs_record_issue_stop)
+ Icon.Loaded(
+ resources.getDrawable(R.drawable.qs_record_issue_icon_on, theme),
+ null,
+ )
+ } else {
+ activationState = QSTileState.ActivationState.INACTIVE
+ secondaryLabel = resources.getString(R.string.qs_record_issue_start)
+ Icon.Loaded(
+ resources.getDrawable(R.drawable.qs_record_issue_icon_off, theme),
+ null,
+ )
+ }
supportedActions = setOf(QSTileState.UserAction.CLICK)
contentDescription = "$label, $secondaryLabel"
}
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 d58f5abcd018..08432f685ea8 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [LocationTileModel] to [QSTileState]. */
class LocationTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Theme,
-) : QSTileDataToStateMapper<LocationTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Theme) :
+ QSTileDataToStateMapper<LocationTileModel> {
override fun map(config: QSTileConfig, data: LocationTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
@@ -43,17 +41,9 @@ constructor(
} else {
R.drawable.qs_location_icon_off
}
- val icon =
- Icon.Loaded(
- resources.getDrawable(
- iconRes!!,
- theme,
- ),
- contentDescription = null
- )
- this.icon = { icon }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- this.label = resources.getString(R.string.quick_settings_location_label)
+ label = resources.getString(R.string.quick_settings_location_label)
if (data.isEnabled) {
activationState = QSTileState.ActivationState.ACTIVE
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 69da3134314b..4a6431359ca2 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
@@ -30,14 +30,12 @@ import javax.inject.Inject
class ModesTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- val theme: Resources.Theme,
-) : QSTileDataToStateMapper<ModesTileModel> {
+constructor(@Main private val resources: Resources, val theme: Resources.Theme) :
+ QSTileDataToStateMapper<ModesTileModel> {
override fun map(config: QSTileConfig, data: ModesTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
iconRes = data.iconResId
- icon = { data.icon }
+ icon = data.icon
activationState =
if (data.isActivated) {
QSTileState.ActivationState.ACTIVE
@@ -47,10 +45,7 @@ constructor(
secondaryLabel = getModesStatus(data, resources)
contentDescription = "$label. $secondaryLabel"
supportedActions =
- setOf(
- QSTileState.UserAction.CLICK,
- QSTileState.UserAction.LONG_CLICK,
- )
+ setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
sideViewIcon = QSTileState.SideViewIcon.Chevron
expandedAccessibilityClass = Button::class
}
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 bcf7cc763b9e..081a03c7ae67 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
@@ -57,9 +57,8 @@ constructor(
activationState = QSTileState.ActivationState.INACTIVE
iconRes = R.drawable.qs_nightlight_icon_off
}
- val loadedIcon =
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- icon = { loadedIcon }
+
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
secondaryLabel = getSecondaryLabel(data, resources)
@@ -70,7 +69,7 @@ constructor(
private fun getSecondaryLabel(
data: NightDisplayTileModel,
- resources: Resources
+ resources: Resources,
): CharSequence? {
when (data) {
is NightDisplayTileModel.AutoModeTwilight -> {
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 40809960735f..8e5d0d4eb3dc 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
@@ -29,17 +29,15 @@ import javax.inject.Inject
/** Maps [OneHandedModeTileModel] to [QSTileState]. */
class OneHandedModeTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<OneHandedModeTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<OneHandedModeTileModel> {
override fun map(config: QSTileConfig, data: OneHandedModeTileModel): QSTileState =
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) }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 823174234b13..5c6351e88494 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
@@ -29,17 +29,15 @@ import javax.inject.Inject
/** Maps [QRCodeScannerTileModel] to [QSTileState]. */
class QRCodeScannerTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<QRCodeScannerTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<QRCodeScannerTileModel> {
override fun map(config: QSTileConfig, data: QRCodeScannerTileModel): QSTileState =
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) }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 85ee02207ac6..fe77fe61b4bf 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [ReduceBrightColorsTileModel] to [QSTileState]. */
class ReduceBrightColorsTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<ReduceBrightColorsTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<ReduceBrightColorsTileModel> {
override fun map(config: QSTileConfig, data: ReduceBrightColorsTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
@@ -50,12 +48,7 @@ constructor(
resources
.getStringArray(R.array.tile_states_reduce_brightness)[Tile.STATE_INACTIVE]
}
- icon = {
- Icon.Loaded(
- drawable = resources.getDrawable(iconRes!!, theme),
- contentDescription = null
- )
- }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 33dc6ed7a1e8..9a003ffdf7de 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
@@ -36,36 +36,33 @@ constructor(
@Main private val resources: Resources,
private val theme: Resources.Theme,
private val devicePostureController: DevicePostureController,
- private val deviceStateManager: DeviceStateManager
+ private val deviceStateManager: DeviceStateManager,
) : QSTileDataToStateMapper<RotationLockTileModel> {
override fun map(config: QSTileConfig, data: RotationLockTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
- this.label = resources.getString(R.string.quick_settings_rotation_unlocked_label)
- this.contentDescription =
- resources.getString(R.string.accessibility_quick_settings_rotation)
+ label = resources.getString(R.string.quick_settings_rotation_unlocked_label)
+ contentDescription = resources.getString(R.string.accessibility_quick_settings_rotation)
if (data.isRotationLocked) {
activationState = QSTileState.ActivationState.INACTIVE
- this.secondaryLabel = EMPTY_SECONDARY_STRING
+ secondaryLabel = EMPTY_SECONDARY_STRING
iconRes = R.drawable.qs_auto_rotate_icon_off
} else {
activationState = QSTileState.ActivationState.ACTIVE
- this.secondaryLabel =
+ secondaryLabel =
if (data.isCameraRotationEnabled) {
resources.getString(R.string.rotation_lock_camera_rotation_on)
} else {
EMPTY_SECONDARY_STRING
}
- this.iconRes = R.drawable.qs_auto_rotate_icon_on
- }
- this.icon = {
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
+ iconRes = R.drawable.qs_auto_rotate_icon_on
}
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
if (isDeviceFoldable(resources, deviceStateManager)) {
- this.secondaryLabel = getSecondaryLabelWithPosture(this.activationState)
+ secondaryLabel = getSecondaryLabelWithPosture(activationState)
}
- this.stateDescription = this.secondaryLabel
- this.sideViewIcon = QSTileState.SideViewIcon.None
+ stateDescription = secondaryLabel
+ sideViewIcon = QSTileState.SideViewIcon.None
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
}
@@ -86,7 +83,7 @@ constructor(
return resources.getString(
R.string.rotation_tile_with_posture_secondary_label_template,
stateName,
- posture
+ posture,
)
}
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 888bba87a03a..08196bbfe2f3 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
@@ -29,10 +29,8 @@ import javax.inject.Inject
/** Maps [DataSaverTileModel] to [QSTileState]. */
class DataSaverTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<DataSaverTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<DataSaverTileModel> {
override fun map(config: QSTileConfig, data: DataSaverTileModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
with(data) {
@@ -45,9 +43,7 @@ constructor(
iconRes = R.drawable.qs_data_saver_icon_off
secondaryLabel = resources.getStringArray(R.array.tile_states_saver)[1]
}
- val loadedIcon =
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- icon = { loadedIcon }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 e74e77f29007..ba06de966c10 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
@@ -30,10 +30,8 @@ import javax.inject.Inject
/** Maps [ScreenRecordModel] to [QSTileState]. */
class ScreenRecordTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Resources.Theme,
-) : QSTileDataToStateMapper<ScreenRecordModel> {
+constructor(@Main private val resources: Resources, private val theme: Resources.Theme) :
+ QSTileDataToStateMapper<ScreenRecordModel> {
override fun map(config: QSTileConfig, data: ScreenRecordModel): QSTileState =
QSTileState.build(resources, theme, config.uiConfig) {
label = resources.getString(R.string.quick_settings_screen_record_label)
@@ -43,24 +41,12 @@ constructor(
is ScreenRecordModel.Recording -> {
activationState = QSTileState.ActivationState.ACTIVE
iconRes = R.drawable.qs_screen_record_icon_on
- val loadedIcon =
- Icon.Loaded(
- resources.getDrawable(iconRes!!, theme),
- contentDescription = null
- )
- icon = { loadedIcon }
sideViewIcon = QSTileState.SideViewIcon.None
secondaryLabel = resources.getString(R.string.quick_settings_screen_record_stop)
}
is ScreenRecordModel.Starting -> {
activationState = QSTileState.ActivationState.ACTIVE
iconRes = R.drawable.qs_screen_record_icon_on
- val loadedIcon =
- Icon.Loaded(
- resources.getDrawable(iconRes!!, theme),
- contentDescription = null
- )
- icon = { loadedIcon }
val countDown = data.countdownSeconds
sideViewIcon = QSTileState.SideViewIcon.None
secondaryLabel = String.format("%d...", countDown)
@@ -68,17 +54,13 @@ constructor(
is ScreenRecordModel.DoingNothing -> {
activationState = QSTileState.ActivationState.INACTIVE
iconRes = R.drawable.qs_screen_record_icon_off
- val loadedIcon =
- Icon.Loaded(
- resources.getDrawable(iconRes!!, theme),
- contentDescription = null
- )
- icon = { loadedIcon }
sideViewIcon = QSTileState.SideViewIcon.Chevron // tapping will open dialog
secondaryLabel =
resources.getString(R.string.quick_settings_screen_record_start)
}
}
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
+
contentDescription =
if (TextUtils.isEmpty(secondaryLabel)) label
else TextUtils.concat(label, ", ", secondaryLabel)
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 597cf274dcff..b4cfec48fb0a 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
@@ -51,8 +51,7 @@ constructor(
supportedActions =
setOf(QSTileState.UserAction.CLICK, QSTileState.UserAction.LONG_CLICK)
iconRes = sensorPrivacyTileResources.getIconRes(data.isBlocked)
- icon = { Icon.Loaded(resources.getDrawable(iconRes!!, theme), null) }
-
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 f29c745d8119..eda8e5ce8c43 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
@@ -34,14 +34,13 @@ import javax.inject.Inject
/** Maps [UiModeNightTileModel] to [QSTileState]. */
class UiModeNightTileMapper
@Inject
-constructor(
- @Main private val resources: Resources,
- private val theme: Theme,
-) : QSTileDataToStateMapper<UiModeNightTileModel> {
+constructor(@Main private val resources: Resources, private val theme: Theme) :
+ QSTileDataToStateMapper<UiModeNightTileModel> {
companion object {
val formatter12Hour: DateTimeFormatter = DateTimeFormatter.ofPattern("hh:mm a")
val formatter24Hour: DateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm")
}
+
override fun map(config: QSTileConfig, data: UiModeNightTileModel): QSTileState =
with(data) {
QSTileState.build(resources, theme, config.uiConfig) {
@@ -76,7 +75,7 @@ constructor(
if (isNightMode)
R.string.quick_settings_dark_mode_secondary_label_until
else R.string.quick_settings_dark_mode_secondary_label_on_at,
- formatter.format(time)
+ formatter.format(time),
)
} else if (
nightModeCustomType == UiModeManager.MODE_NIGHT_CUSTOM_TYPE_BEDTIME
@@ -121,9 +120,7 @@ constructor(
if (activationState == QSTileState.ActivationState.ACTIVE)
R.drawable.qs_light_dark_theme_icon_on
else R.drawable.qs_light_dark_theme_icon_off
- val loadedIcon =
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- icon = { loadedIcon }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), null)
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 eee95b7311d3..a1bc8a889a1b 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
@@ -42,9 +42,7 @@ constructor(
label = getTileLabel()!!
contentDescription = label
iconRes = com.android.internal.R.drawable.stat_sys_managed_profile_status
- icon = {
- Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
- }
+ icon = Icon.Loaded(resources.getDrawable(iconRes!!, theme), contentDescription = null)
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 549f0a73908d..8394be5e0a38 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
@@ -35,7 +35,7 @@ import kotlin.reflect.KClass
* // TODO(b/http://b/299909989): Clean up legacy mappings after the transition
*/
data class QSTileState(
- val icon: () -> Icon?,
+ val icon: Icon?,
val iconRes: Int?,
val label: CharSequence,
val activationState: ActivationState,
@@ -54,21 +54,18 @@ data class QSTileState(
resources: Resources,
theme: Theme,
config: QSTileUIConfig,
- builder: Builder.() -> Unit
+ builder: Builder.() -> Unit,
): QSTileState {
val iconDrawable = resources.getDrawable(config.iconRes, theme)
return build(
- { Icon.Loaded(iconDrawable, null) },
+ Icon.Loaded(iconDrawable, null),
resources.getString(config.labelRes),
builder,
)
}
- fun build(
- icon: () -> Icon?,
- label: CharSequence,
- builder: Builder.() -> Unit
- ): QSTileState = Builder(icon, label).apply { builder() }.build()
+ fun build(icon: Icon?, label: CharSequence, builder: Builder.() -> Unit): QSTileState =
+ Builder(icon, label).apply { builder() }.build()
}
enum class ActivationState(val legacyState: Int) {
@@ -117,10 +114,7 @@ data class QSTileState(
data object None : SideViewIcon
}
- class Builder(
- var icon: () -> Icon?,
- var label: CharSequence,
- ) {
+ class Builder(var icon: Icon?, var label: CharSequence) {
var iconRes: Int? = null
var activationState: ActivationState = ActivationState.INACTIVE
var secondaryLabel: CharSequence? = null
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 f89745f49cc8..35b1b9636263 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
@@ -19,6 +19,7 @@ package com.android.systemui.qs.tiles.viewmodel
import android.content.Context
import android.os.UserHandle
import android.util.Log
+import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.internal.logging.InstanceId
import com.android.systemui.Dumpable
import com.android.systemui.animation.Expandable
@@ -42,7 +43,6 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.takeWhile
-import com.android.app.tracing.coroutines.launchTraced as launch
// TODO(b/http://b/299909989): Use QSTileViewModel directly after the rollout
class QSTileViewModelAdapter
@@ -223,7 +223,7 @@ constructor(
fun mapState(
context: Context,
viewModelState: QSTileState,
- config: QSTileConfig
+ config: QSTileConfig,
): QSTile.State =
// we have to use QSTile.BooleanState to support different side icons
// which are bound to instanceof QSTile.BooleanState in QSTileView.
@@ -241,7 +241,7 @@ constructor(
viewModelState.supportedActions.contains(QSTileState.UserAction.TOGGLE_CLICK)
icon =
- when (val stateIcon = viewModelState.icon()) {
+ when (val stateIcon = viewModelState.icon) {
is Icon.Loaded ->
if (viewModelState.iconRes == null) DrawableIcon(stateIcon.drawable)
else DrawableIconWithRes(stateIcon.drawable, viewModelState.iconRes)
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt
index f66125a6087e..6787b8ebb37f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/di/NewQSTileFactoryKosmos.kt
@@ -52,7 +52,7 @@ val Kosmos.customTileViewModelFactory: QSTileViewModelFactory.Component by
)
object : QSTileViewModel {
override val state: StateFlow<QSTileState?> =
- MutableStateFlow(QSTileState.build({ null }, tileSpec.spec) {})
+ MutableStateFlow(QSTileState.build(null, tileSpec.spec) {})
override val config: QSTileConfig = config
override val isAvailable: StateFlow<Boolean> = MutableStateFlow(true)
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 5b6fd8c3bd62..ab1c1818bf80 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
@@ -44,7 +44,7 @@ private constructor(failureMetadata: FailureMetadata, subject: QSTileState?) :
check("other").that(other).isNotNull()
other ?: return
}
- check("icon").that(actual.icon()).isEqualTo(other.icon())
+ 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)