summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hanna Nizhnikava <yulecat@google.com> 2023-11-16 18:17:39 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-11-16 18:17:39 +0000
commitcb427e9f451363863b0fc5d673c20f8a0b83803b (patch)
tree670a53e6c8578be7927971bd2399aad295042670
parentf0cf3a68dad109f74f0512f234b58c2c27e300b6 (diff)
parent706e89f7fbbaffa40635e1a8c87c490f7046a042 (diff)
Merge "Revert "Migrate FlashlightTile into new architecture"" into main
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt97
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt88
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractorTest.kt67
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt60
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractor.kt62
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractor.kt45
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/model/FlashlightTileModel.kt24
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt48
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/InstanceIdSequenceFake.kt (renamed from packages/SystemUI/tests/utils/src/com/android/systemui/InstanceIdSequenceFake.kt)10
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/QsEventLoggerFake.kt (renamed from packages/SystemUI/tests/utils/src/com/android/systemui/qs/QsEventLoggerFake.kt)2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/QuickSettingsKosmos.kt27
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/flashlight/FlashlightTileKosmos.kt24
12 files changed, 8 insertions, 546 deletions
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
deleted file mode 100644
index 4bf405410f4d..000000000000
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapperTest.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight.domain
-
-import android.graphics.drawable.Drawable
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.systemui.SysuiTestCase
-import com.android.systemui.common.shared.model.Icon
-import com.android.systemui.kosmos.Kosmos
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.qs.tiles.impl.flashlight.qsFlashlightTileConfig
-import com.android.systemui.qs.tiles.viewmodel.QSTileState
-import com.android.systemui.res.R
-import com.android.systemui.util.mockito.mock
-import com.google.common.truth.Truth.assertThat
-import junit.framework.Assert.assertEquals
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class FlashlightMapperTest : SysuiTestCase() {
- private val kosmos = Kosmos()
- private val qsTileConfig = kosmos.qsFlashlightTileConfig
- private val mapper = FlashlightMapper(context)
-
- @Test
- fun mapsDisabledDataToInactiveState() {
- val tileState: QSTileState = mapper.map(qsTileConfig, FlashlightTileModel(false))
-
- val actualActivationState = tileState.activationState
-
- assertEquals(QSTileState.ActivationState.INACTIVE, actualActivationState)
- }
-
- @Test
- fun mapsEnabledDataToActiveState() {
- val tileState: QSTileState = mapper.map(qsTileConfig, FlashlightTileModel(true))
-
- val actualActivationState = tileState.activationState
- assertEquals(QSTileState.ActivationState.ACTIVE, actualActivationState)
- }
-
- @Test
- fun mapsEnabledDataToOnIconState() {
- val fakeDrawable = mock<Drawable>()
- context.orCreateTestableResources.addOverride(
- R.drawable.qs_flashlight_icon_on,
- fakeDrawable
- )
- val expectedIcon = Icon.Loaded(fakeDrawable, null)
-
- val tileState: QSTileState = mapper.map(qsTileConfig, FlashlightTileModel(true))
-
- val actualIcon = tileState.icon()
- assertThat(actualIcon).isEqualTo(expectedIcon)
- }
-
- @Test
- fun mapsDisabledDataToOffIconState() {
- val fakeDrawable = mock<Drawable>()
- context.orCreateTestableResources.addOverride(
- R.drawable.qs_flashlight_icon_off,
- fakeDrawable
- )
- val expectedIcon = Icon.Loaded(fakeDrawable, null)
-
- val tileState: QSTileState = mapper.map(qsTileConfig, FlashlightTileModel(false))
-
- val actualIcon = tileState.icon()
- assertThat(actualIcon).isEqualTo(expectedIcon)
- }
-
- @Test
- fun supportsOnlyClickAction() {
- val dontCare = true
- val tileState: QSTileState = mapper.map(qsTileConfig, FlashlightTileModel(dontCare))
-
- val supportedActions = tileState.supportedActions
- assertThat(supportedActions).containsExactly(QSTileState.UserAction.CLICK)
- }
-}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt
deleted file mode 100644
index 00572d3163eb..000000000000
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractorTest.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import android.os.UserHandle
-import android.testing.LeakCheck
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.systemui.SysuiTestCase
-import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.coroutines.collectValues
-import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger
-import com.android.systemui.qs.tiles.impl.flashlight.domain.interactor.FlashlightTileDataInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.utils.leaks.FakeFlashlightController
-import com.google.common.truth.Truth.assertThat
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.flow.flowOf
-import kotlinx.coroutines.test.runCurrent
-import kotlinx.coroutines.test.runTest
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@OptIn(ExperimentalCoroutinesApi::class)
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class FlashlightTileDataInteractorTest : SysuiTestCase() {
- private lateinit var controller: FakeFlashlightController
- private lateinit var underTest: FlashlightTileDataInteractor
-
- @Before
- fun setup() {
- controller = FakeFlashlightController(LeakCheck())
- underTest = FlashlightTileDataInteractor(controller)
- }
-
- @Test
- fun availabilityOnMatchesController() = runTest {
- controller.hasFlashlight = true
-
- runCurrent()
- val availability by collectLastValue(underTest.availability(TEST_USER))
-
- assertThat(availability).isTrue()
- }
- @Test
- fun availabilityOffMatchesController() = runTest {
- controller.hasFlashlight = false
-
- runCurrent()
- val availability by collectLastValue(underTest.availability(TEST_USER))
-
- assertThat(availability).isFalse()
- }
-
- @Test
- fun dataMatchesController() = runTest {
- controller.setFlashlight(false)
- val flowValues: List<FlashlightTileModel> by
- collectValues(underTest.tileData(TEST_USER, flowOf(DataUpdateTrigger.InitialRequest)))
-
- runCurrent()
- controller.setFlashlight(true)
- runCurrent()
- controller.setFlashlight(false)
- runCurrent()
-
- assertThat(flowValues.size).isEqualTo(3)
- assertThat(flowValues.map { it.isEnabled }).containsExactly(false, true, false).inOrder()
- }
-
- private companion object {
- val TEST_USER = UserHandle.of(1)!!
- }
-}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractorTest.kt
deleted file mode 100644
index f819f53838b8..000000000000
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractorTest.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import android.app.ActivityManager
-import androidx.test.ext.junit.runners.AndroidJUnit4
-import androidx.test.filters.SmallTest
-import com.android.systemui.SysuiTestCase
-import com.android.systemui.qs.tiles.base.interactor.QSTileInputTestKtx.click
-import com.android.systemui.qs.tiles.impl.flashlight.domain.interactor.FlashlightTileUserActionInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.statusbar.policy.FlashlightController
-import com.android.systemui.util.mockito.mock
-import kotlinx.coroutines.test.runTest
-import org.junit.Assume.assumeFalse
-import org.junit.Before
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.mockito.Mock
-import org.mockito.Mockito.verify
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class FlashlightTileUserActionInteractorTest : SysuiTestCase() {
-
- @Mock private lateinit var controller: FlashlightController
-
- private lateinit var underTest: FlashlightTileUserActionInteractor
-
- @Before
- fun setup() {
- controller = mock<FlashlightController>()
- underTest = FlashlightTileUserActionInteractor(controller)
- }
-
- @Test
- fun handleClickToEnable() = runTest {
- assumeFalse(ActivityManager.isUserAMonkey())
- val stateBeforeClick = false
-
- underTest.handleInput(click(FlashlightTileModel(stateBeforeClick)))
-
- verify(controller).setFlashlight(!stateBeforeClick)
- }
-
- @Test
- fun handleClickToDisable() = runTest {
- assumeFalse(ActivityManager.isUserAMonkey())
- val stateBeforeClick = true
-
- underTest.handleInput(click(FlashlightTileModel(stateBeforeClick)))
-
- verify(controller).setFlashlight(!stateBeforeClick)
- }
-}
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
deleted file mode 100644
index b2b226464ee5..000000000000
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/FlashlightMapper.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight.domain
-
-import android.content.Context
-import com.android.systemui.common.shared.model.Icon
-import com.android.systemui.qs.tiles.base.interactor.QSTileDataToStateMapper
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.qs.tiles.viewmodel.QSTileConfig
-import com.android.systemui.qs.tiles.viewmodel.QSTileState
-import com.android.systemui.res.R
-import javax.inject.Inject
-
-/** Maps [FlashlightTileModel] to [QSTileState]. */
-class FlashlightMapper @Inject constructor(private val context: Context) :
- QSTileDataToStateMapper<FlashlightTileModel> {
-
- override fun map(config: QSTileConfig, data: FlashlightTileModel): QSTileState =
- QSTileState.build(context, config.uiConfig) {
- val icon =
- Icon.Loaded(
- context.resources.getDrawable(
- if (data.isEnabled) {
- R.drawable.qs_flashlight_icon_on
- } else {
- R.drawable.qs_flashlight_icon_off
- }
- ),
- contentDescription = null
- )
- this.icon = { icon }
-
- if (data.isEnabled) {
- activationState = QSTileState.ActivationState.ACTIVE
- secondaryLabel = context.resources.getStringArray(R.array.tile_states_flashlight)[2]
- } else {
- activationState = QSTileState.ActivationState.INACTIVE
- secondaryLabel = context.resources.getStringArray(R.array.tile_states_flashlight)[1]
- }
- contentDescription = label
- supportedActions =
- setOf(
- QSTileState.UserAction.CLICK,
- )
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractor.kt
deleted file mode 100644
index 53d4cf96809c..000000000000
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileDataInteractor.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight.domain.interactor
-
-import android.os.UserHandle
-import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
-import com.android.systemui.qs.tiles.base.interactor.DataUpdateTrigger
-import com.android.systemui.qs.tiles.base.interactor.QSTileDataInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.statusbar.policy.FlashlightController
-import javax.inject.Inject
-import kotlinx.coroutines.channels.awaitClose
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.flowOf
-
-/** Observes flashlight state changes providing the [FlashlightTileModel]. */
-class FlashlightTileDataInteractor
-@Inject
-constructor(
- private val flashlightController: FlashlightController,
-) : QSTileDataInteractor<FlashlightTileModel> {
-
- override fun tileData(
- user: UserHandle,
- triggers: Flow<DataUpdateTrigger>
- ): Flow<FlashlightTileModel> = conflatedCallbackFlow {
- val initialValue = flashlightController.isEnabled
- trySend(FlashlightTileModel(initialValue))
-
- val callback =
- object : FlashlightController.FlashlightListener {
- override fun onFlashlightChanged(enabled: Boolean) {
- trySend(FlashlightTileModel(enabled))
- }
- override fun onFlashlightError() {
- trySend(FlashlightTileModel(false))
- }
- override fun onFlashlightAvailabilityChanged(available: Boolean) {
- trySend(FlashlightTileModel(flashlightController.isEnabled))
- }
- }
- flashlightController.addCallback(callback)
- awaitClose { flashlightController.removeCallback(callback) }
- }
-
- override fun availability(user: UserHandle): Flow<Boolean> =
- flowOf(flashlightController.hasFlashlight())
-}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractor.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractor.kt
deleted file mode 100644
index 9180e3080d07..000000000000
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/interactor/FlashlightTileUserActionInteractor.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight.domain.interactor
-
-import android.app.ActivityManager
-import com.android.systemui.qs.tiles.base.interactor.QSTileInput
-import com.android.systemui.qs.tiles.base.interactor.QSTileUserActionInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.qs.tiles.viewmodel.QSTileUserAction
-import com.android.systemui.statusbar.policy.FlashlightController
-import javax.inject.Inject
-
-/** Handles flashlight tile clicks. */
-class FlashlightTileUserActionInteractor
-@Inject
-constructor(
- private val flashlightController: FlashlightController,
-) : QSTileUserActionInteractor<FlashlightTileModel> {
-
- override suspend fun handleInput(input: QSTileInput<FlashlightTileModel>) =
- with(input) {
- when (action) {
- is QSTileUserAction.Click -> {
- if (!ActivityManager.isUserAMonkey()) {
- flashlightController.setFlashlight(!input.data.isEnabled)
- }
- }
- else -> {}
- }
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/model/FlashlightTileModel.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/model/FlashlightTileModel.kt
deleted file mode 100644
index ef6b2be06747..000000000000
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/impl/flashlight/domain/model/FlashlightTileModel.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight.domain.model
-
-/**
- * Flashlight tile model.
- *
- * @param isEnabled is true when the falshlight is enabled;
- */
-@JvmInline value class FlashlightTileModel(val isEnabled: Boolean)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt
index 78f48bb511e5..d66ad5868e65 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/PolicyModule.kt
@@ -14,8 +14,6 @@
package com.android.systemui.statusbar.policy
-import com.android.systemui.qs.QsEventLogger
-import com.android.systemui.qs.pipeline.shared.TileSpec
import com.android.systemui.qs.tileimpl.QSTileImpl
import com.android.systemui.qs.tiles.AlarmTile
import com.android.systemui.qs.tiles.CameraToggleTile
@@ -25,18 +23,8 @@ import com.android.systemui.qs.tiles.LocationTile
import com.android.systemui.qs.tiles.MicrophoneToggleTile
import com.android.systemui.qs.tiles.UiModeNightTile
import com.android.systemui.qs.tiles.WorkModeTile
-import com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelFactory
-import com.android.systemui.qs.tiles.impl.flashlight.domain.FlashlightMapper
-import com.android.systemui.qs.tiles.impl.flashlight.domain.interactor.FlashlightTileDataInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.interactor.FlashlightTileUserActionInteractor
-import com.android.systemui.qs.tiles.impl.flashlight.domain.model.FlashlightTileModel
-import com.android.systemui.qs.tiles.viewmodel.QSTileConfig
-import com.android.systemui.qs.tiles.viewmodel.QSTileUIConfig
-import com.android.systemui.qs.tiles.viewmodel.QSTileViewModel
-import com.android.systemui.res.R
import dagger.Binds
import dagger.Module
-import dagger.Provides
import dagger.multibindings.IntoMap
import dagger.multibindings.StringKey
@@ -52,42 +40,6 @@ interface PolicyModule {
@StringKey(WorkModeTile.TILE_SPEC)
fun bindWorkModeTile(workModeTile: WorkModeTile): QSTileImpl<*>
- companion object {
- const val FLASHLIGHT_TILE_SPEC = "flashlight"
-
- /** Inject config */
- @Provides
- @IntoMap
- @StringKey(FLASHLIGHT_TILE_SPEC)
- fun provideFlashlightTileConfig(uiEventLogger: QsEventLogger): QSTileConfig =
- QSTileConfig(
- tileSpec = TileSpec.create(FLASHLIGHT_TILE_SPEC),
- uiConfig =
- QSTileUIConfig.Resource(
- iconRes = R.drawable.qs_flashlight_icon_off,
- labelRes = R.string.quick_settings_flashlight_label,
- ),
- instanceId = uiEventLogger.getNewInstanceId(),
- )
-
- /** Inject FlashlightTile into tileViewModelMap in QSModule */
- @Provides
- @IntoMap
- @StringKey(FLASHLIGHT_TILE_SPEC)
- fun provideFlashlightTileViewModel(
- factory: QSTileViewModelFactory.Static<FlashlightTileModel>,
- mapper: FlashlightMapper,
- stateInteractor: FlashlightTileDataInteractor,
- userActionInteractor: FlashlightTileUserActionInteractor
- ): QSTileViewModel =
- factory.create(
- TileSpec.create(FLASHLIGHT_TILE_SPEC),
- userActionInteractor,
- stateInteractor,
- mapper,
- )
- }
-
/** Inject FlashlightTile into tileMap in QSModule */
@Binds
@IntoMap
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/InstanceIdSequenceFake.kt b/packages/SystemUI/tests/src/com/android/systemui/InstanceIdSequenceFake.kt
index aae270d2b849..6fbe3ada2406 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/InstanceIdSequenceFake.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/InstanceIdSequenceFake.kt
@@ -19,10 +19,14 @@ package com.android.systemui
import com.android.internal.logging.InstanceId
import com.android.internal.logging.InstanceIdSequence
-/** Fake [InstanceId] generator. */
+/**
+ * Fake [InstanceId] generator.
+ */
class InstanceIdSequenceFake(instanceIdMax: Int) : InstanceIdSequence(instanceIdMax) {
- /** Last id used to generate a [InstanceId]. `-1` if no [InstanceId] has been generated. */
+ /**
+ * Last id used to generate a [InstanceId]. `-1` if no [InstanceId] has been generated.
+ */
var lastInstanceId = -1
private set
@@ -34,4 +38,4 @@ class InstanceIdSequenceFake(instanceIdMax: Int) : InstanceIdSequence(instanceId
}
return newInstanceIdInternal(lastInstanceId)
}
-}
+} \ No newline at end of file
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/QsEventLoggerFake.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QsEventLoggerFake.kt
index baccc6f6962f..40aa2607dc94 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/QsEventLoggerFake.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QsEventLoggerFake.kt
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/QuickSettingsKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/QuickSettingsKosmos.kt
deleted file mode 100644
index 1cb2587e4e99..000000000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/QuickSettingsKosmos.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs
-
-import com.android.internal.logging.testing.UiEventLoggerFake
-import com.android.systemui.InstanceIdSequenceFake
-import com.android.systemui.kosmos.Kosmos
-
-val Kosmos.instanceIdSequenceFake: InstanceIdSequenceFake by
- Kosmos.Fixture { InstanceIdSequenceFake(0) }
-val Kosmos.uiEventLogger: UiEventLoggerFake by Kosmos.Fixture { UiEventLoggerFake() }
-val Kosmos.qsEventLogger: QsEventLoggerFake by
- Kosmos.Fixture { QsEventLoggerFake(uiEventLogger, instanceIdSequenceFake) }
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/flashlight/FlashlightTileKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/flashlight/FlashlightTileKosmos.kt
deleted file mode 100644
index 97e9b519b022..000000000000
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/qs/tiles/impl/flashlight/FlashlightTileKosmos.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.systemui.qs.tiles.impl.flashlight
-
-import com.android.systemui.kosmos.Kosmos
-import com.android.systemui.qs.qsEventLogger
-import com.android.systemui.statusbar.policy.PolicyModule
-
-val Kosmos.qsFlashlightTileConfig by
- Kosmos.Fixture { PolicyModule.provideFlashlightTileConfig(qsEventLogger) }