diff options
12 files changed, 196 insertions, 23 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt index 9da2a1b06f30..5ffb6f82fbba 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelRoot.kt @@ -50,7 +50,7 @@ fun VolumePanelRoot( ) { val accessibilityTitle = stringResource(R.string.accessibility_volume_settings) val state: VolumePanelState by viewModel.volumePanelState.collectAsStateWithLifecycle() - val components by viewModel.componentsLayout.collectAsStateWithLifecycle(null) + val components by viewModel.componentsLayout.collectAsStateWithLifecycle() with(VolumePanelComposeScope(state)) { components?.let { componentsState -> diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorImplTest.kt index ab184abdc963..f232d52615a4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorImplTest.kt @@ -28,6 +28,7 @@ import com.android.systemui.volume.panel.domain.model.ComponentModel import com.android.systemui.volume.panel.domain.unavailableCriteria import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey import com.android.systemui.volume.panel.ui.composable.enabledComponents +import com.android.systemui.volume.shared.volumePanelLogger import com.google.common.truth.Truth.assertThat import javax.inject.Provider import kotlinx.coroutines.test.runTest @@ -49,6 +50,7 @@ class ComponentsInteractorImplTest : SysuiTestCase() { enabledComponents, { defaultCriteria }, testScope.backgroundScope, + volumePanelLogger, criteriaByKey, ) } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt index 420b955e88e0..51a70bda6034 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelTest.kt @@ -24,21 +24,30 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.broadcast.broadcastDispatcher import com.android.systemui.coroutines.collectLastValue +import com.android.systemui.dump.DumpManager import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.kosmos.testScope +import com.android.systemui.statusbar.policy.configurationController import com.android.systemui.statusbar.policy.fakeConfigurationController import com.android.systemui.testKosmos +import com.android.systemui.volume.panel.dagger.factory.volumePanelComponentFactory import com.android.systemui.volume.panel.data.repository.volumePanelGlobalStateRepository import com.android.systemui.volume.panel.domain.interactor.criteriaByKey +import com.android.systemui.volume.panel.domain.interactor.volumePanelGlobalStateInteractor import com.android.systemui.volume.panel.domain.unavailableCriteria import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey import com.android.systemui.volume.panel.shared.model.mockVolumePanelUiComponentProvider import com.android.systemui.volume.panel.ui.composable.componentByKey import com.android.systemui.volume.panel.ui.layout.DefaultComponentsLayoutManager import com.android.systemui.volume.panel.ui.layout.componentsLayoutManager +import com.android.systemui.volume.shared.volumePanelLogger import com.google.common.truth.Truth.assertThat +import java.io.PrintWriter +import java.io.StringWriter import javax.inject.Provider import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.launch import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test @@ -55,6 +64,7 @@ class VolumePanelViewModelTest : SysuiTestCase() { volumePanelGlobalStateRepository.updateVolumePanelState { it.copy(isVisible = true) } } + private val realDumpManager = DumpManager() private val testableResources = context.orCreateTestableResources private lateinit var underTest: VolumePanelViewModel @@ -124,6 +134,60 @@ class VolumePanelViewModelTest : SysuiTestCase() { } @Test + fun testDumpableRegister_unregister() = + with(kosmos) { + testScope.runTest { + val job = launch { + applicationCoroutineScope = this + underTest = createViewModel() + + runCurrent() + + assertThat(realDumpManager.getDumpables().any { it.name == DUMPABLE_NAME }) + .isTrue() + } + + runCurrent() + job.cancel() + + assertThat(realDumpManager.getDumpables().any { it.name == DUMPABLE_NAME }).isTrue() + } + } + + @Test + fun testDumpingState() = + test({ + componentByKey = + mapOf( + COMPONENT_1 to mockVolumePanelUiComponentProvider, + COMPONENT_2 to mockVolumePanelUiComponentProvider, + BOTTOM_BAR to mockVolumePanelUiComponentProvider, + ) + criteriaByKey = mapOf(COMPONENT_2 to Provider { unavailableCriteria }) + }) { + testScope.runTest { + runCurrent() + + StringWriter().use { + underTest.dump(PrintWriter(it), emptyArray()) + + assertThat(it.buffer.toString()) + .isEqualTo( + "volumePanelState=" + + "VolumePanelState(orientation=1, isLargeScreen=false)\n" + + "componentsLayout=( " + + "headerComponents= " + + "contentComponents=" + + "test_component:1:visible=true, " + + "test_component:2:visible=false " + + "footerComponents= " + + "bottomBarComponent=test_bottom_bar:visible=true )\n" + ) + } + } + } + + @Test fun dismissBroadcast_dismissesPanel() = test { testScope.runTest { runCurrent() // run the flows to let allow the receiver to be registered @@ -140,11 +204,26 @@ class VolumePanelViewModelTest : SysuiTestCase() { private fun test(setup: Kosmos.() -> Unit = {}, test: Kosmos.() -> Unit) = with(kosmos) { setup() - underTest = volumePanelViewModel + underTest = createViewModel() + test() } + private fun Kosmos.createViewModel(): VolumePanelViewModel = + VolumePanelViewModel( + context.orCreateTestableResources.resources, + applicationCoroutineScope, + volumePanelComponentFactory, + configurationController, + broadcastDispatcher, + realDumpManager, + volumePanelLogger, + volumePanelGlobalStateInteractor, + ) + private companion object { + const val DUMPABLE_NAME = "VolumePanelViewModel" + const val BOTTOM_BAR: VolumePanelComponentKey = "test_bottom_bar" const val COMPONENT_1: VolumePanelComponentKey = "test_component:1" const val COMPONENT_2: VolumePanelComponentKey = "test_component:2" diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepository.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepository.kt index e46ce2699beb..24fb001a1b6d 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepository.kt @@ -19,6 +19,7 @@ package com.android.systemui.volume.panel.data.repository import com.android.systemui.Dumpable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager +import com.android.systemui.volume.panel.shared.VolumePanelLogger import com.android.systemui.volume.panel.shared.model.VolumePanelGlobalState import java.io.PrintWriter import javax.inject.Inject @@ -27,10 +28,15 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update -private const val TAG = "VolumePanelGlobalState" +private const val TAG = "VolumePanelGlobalStateRepository" @SysUISingleton -class VolumePanelGlobalStateRepository @Inject constructor(dumpManager: DumpManager) : Dumpable { +class VolumePanelGlobalStateRepository +@Inject +constructor( + dumpManager: DumpManager, + private val logger: VolumePanelLogger, +) : Dumpable { private val mutableGlobalState = MutableStateFlow( @@ -48,6 +54,7 @@ class VolumePanelGlobalStateRepository @Inject constructor(dumpManager: DumpMana update: (currentState: VolumePanelGlobalState) -> VolumePanelGlobalState ) { mutableGlobalState.update(update) + logger.onVolumePanelGlobalStateChanged(mutableGlobalState.value) } override fun dump(pw: PrintWriter, args: Array<out String>) { diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractor.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractor.kt index 5301b008bab7..9de862a814d6 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractor.kt @@ -19,6 +19,7 @@ package com.android.systemui.volume.panel.domain.interactor import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria import com.android.systemui.volume.panel.domain.model.ComponentModel +import com.android.systemui.volume.panel.shared.VolumePanelLogger import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey import javax.inject.Inject import javax.inject.Provider @@ -26,8 +27,12 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.conflate +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.shareIn +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.flow.stateIn interface ComponentsInteractor { @@ -45,6 +50,7 @@ constructor( enabledComponents: Collection<VolumePanelComponentKey>, defaultCriteria: Provider<ComponentAvailabilityCriteria>, @VolumePanelScope coroutineScope: CoroutineScope, + private val logger: VolumePanelLogger, private val criteriaByKey: Map< VolumePanelComponentKey, @@ -57,12 +63,18 @@ constructor( combine( enabledComponents.map { componentKey -> val componentCriteria = (criteriaByKey[componentKey] ?: defaultCriteria).get() - componentCriteria.isAvailable().map { isAvailable -> - ComponentModel(componentKey, isAvailable = isAvailable) - } + componentCriteria + .isAvailable() + .distinctUntilChanged() + .conflate() + .onEach { logger.onComponentAvailabilityChanged(componentKey, it) } + .map { isAvailable -> + ComponentModel(componentKey, isAvailable = isAvailable) + } } ) { it.asList() } - .shareIn(coroutineScope, SharingStarted.Eagerly, replay = 1) + .stateIn(coroutineScope, SharingStarted.Eagerly, null) + .filterNotNull() } diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/shared/VolumePanelLogger.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/shared/VolumePanelLogger.kt index cc513b5d820c..276326cbf430 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/shared/VolumePanelLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/shared/VolumePanelLogger.kt @@ -20,15 +20,41 @@ import com.android.settingslib.volume.shared.model.AudioStream import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.dagger.VolumeLog -import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope +import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey +import com.android.systemui.volume.panel.shared.model.VolumePanelGlobalState +import com.android.systemui.volume.panel.ui.viewmodel.VolumePanelState import javax.inject.Inject private const val TAG = "SysUI_VolumePanel" /** Logs events related to the Volume Panel. */ -@VolumePanelScope class VolumePanelLogger @Inject constructor(@VolumeLog private val logBuffer: LogBuffer) { + fun onVolumePanelStateChanged(state: VolumePanelState) { + logBuffer.log(TAG, LogLevel.DEBUG, { str1 = state.toString() }, { "State changed: $str1" }) + } + + fun onComponentAvailabilityChanged(key: VolumePanelComponentKey, isAvailable: Boolean) { + logBuffer.log( + TAG, + LogLevel.DEBUG, + { + str1 = key + bool1 = isAvailable + }, + { "$str1 isAvailable=$bool1" } + ) + } + + fun onVolumePanelGlobalStateChanged(globalState: VolumePanelGlobalState) { + logBuffer.log( + TAG, + LogLevel.DEBUG, + { bool1 = globalState.isVisible }, + { "Global state changed: isVisible=$bool1" } + ) + } + fun onSetVolumeRequested(audioStream: AudioStream, volume: Int) { logBuffer.log( TAG, diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/ComponentsLayout.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/ComponentsLayout.kt index 1c51236689d8..a06d3e3c6785 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/ComponentsLayout.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/layout/ComponentsLayout.kt @@ -17,6 +17,7 @@ package com.android.systemui.volume.panel.ui.layout import com.android.systemui.volume.panel.ui.viewmodel.ComponentState +import com.android.systemui.volume.panel.ui.viewmodel.toLogString /** Represents components grouping into the layout. */ data class ComponentsLayout( @@ -29,3 +30,12 @@ data class ComponentsLayout( /** This is a separated entity that is always visible on the bottom of the Volume Panel. */ val bottomBarComponent: ComponentState, ) + +fun ComponentsLayout.toLogString(): String { + return "(" + + " headerComponents=${headerComponents.joinToString { it.toLogString() }}" + + " contentComponents=${contentComponents.joinToString { it.toLogString() }}" + + " footerComponents=${footerComponents.joinToString { it.toLogString() }}" + + " bottomBarComponent=${bottomBarComponent.toLogString()}" + + " )" +} diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/ComponentState.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/ComponentState.kt index 5f4dbfb4235e..41c80fa58527 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/ComponentState.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/ComponentState.kt @@ -32,3 +32,5 @@ data class ComponentState( val component: VolumePanelUiComponent, val isVisible: Boolean, ) + +fun ComponentState.toLogString(): String = "$key:visible=$isVisible" diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt index f495a02f6cc7..2f60c4b29a81 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt @@ -19,23 +19,30 @@ package com.android.systemui.volume.panel.ui.viewmodel import android.content.Context import android.content.IntentFilter import android.content.res.Resources +import com.android.systemui.Dumpable import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.dagger.qualifiers.Application +import com.android.systemui.dump.DumpManager import com.android.systemui.res.R import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.onConfigChanged +import com.android.systemui.util.kotlin.launchAndDispose import com.android.systemui.volume.VolumePanelDialogReceiver import com.android.systemui.volume.panel.dagger.VolumePanelComponent import com.android.systemui.volume.panel.dagger.factory.VolumePanelComponentFactory import com.android.systemui.volume.panel.domain.VolumePanelStartable import com.android.systemui.volume.panel.domain.interactor.ComponentsInteractor import com.android.systemui.volume.panel.domain.interactor.VolumePanelGlobalStateInteractor +import com.android.systemui.volume.panel.shared.VolumePanelLogger import com.android.systemui.volume.panel.ui.composable.ComponentsFactory import com.android.systemui.volume.panel.ui.layout.ComponentsLayout import com.android.systemui.volume.panel.ui.layout.ComponentsLayoutManager +import com.android.systemui.volume.panel.ui.layout.toLogString +import java.io.PrintWriter import javax.inject.Inject import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.DisposableHandle +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine @@ -43,19 +50,23 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart -import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.stateIn +private const val TAG = "VolumePanelViewModel" + // Can't inject a constructor here because VolumePanelComponent provides this view model for its // components. +@OptIn(ExperimentalCoroutinesApi::class) class VolumePanelViewModel( resources: Resources, coroutineScope: CoroutineScope, daggerComponentFactory: VolumePanelComponentFactory, configurationController: ConfigurationController, broadcastDispatcher: BroadcastDispatcher, + private val dumpManager: DumpManager, + private val logger: VolumePanelLogger, private val volumePanelGlobalStateInteractor: VolumePanelGlobalStateInteractor, -) { +) : Dumpable { private val volumePanelComponent: VolumePanelComponent = daggerComponentFactory.create(this, coroutineScope) @@ -77,9 +88,10 @@ class VolumePanelViewModel( .onStart { emit(resources.configuration) } .map { configuration -> VolumePanelState( - orientation = configuration.orientation, - isLargeScreen = resources.getBoolean(R.bool.volume_panel_is_large_screen), - ) + orientation = configuration.orientation, + isLargeScreen = resources.getBoolean(R.bool.volume_panel_is_large_screen), + ) + .also { logger.onVolumePanelStateChanged(it) } } .stateIn( scope, @@ -89,7 +101,7 @@ class VolumePanelViewModel( isLargeScreen = resources.getBoolean(R.bool.volume_panel_is_large_screen) ), ) - val componentsLayout: Flow<ComponentsLayout> = + val componentsLayout: StateFlow<ComponentsLayout?> = combine( componentsInteractor.components, volumePanelState, @@ -104,13 +116,18 @@ class VolumePanelViewModel( } componentsLayoutManager.layout(scope, componentStates) } - .shareIn( + .stateIn( scope, SharingStarted.Eagerly, - replay = 1, + null, ) init { + scope.launchAndDispose { + dumpManager.registerNormalDumpable(TAG, this) + DisposableHandle { dumpManager.unregisterDumpable(TAG) } + } + volumePanelComponent.volumePanelStartables().onEach(VolumePanelStartable::start) broadcastDispatcher .broadcastFlow(IntentFilter(VolumePanelDialogReceiver.DISMISS_ACTION)) @@ -122,6 +139,13 @@ class VolumePanelViewModel( volumePanelGlobalStateInteractor.setVisible(false) } + override fun dump(pw: PrintWriter, args: Array<out String>) { + with(pw) { + println("volumePanelState=${volumePanelState.value}") + println("componentsLayout=${componentsLayout.value?.toLogString()}") + } + } + class Factory @Inject constructor( @@ -129,6 +153,8 @@ class VolumePanelViewModel( private val daggerComponentFactory: VolumePanelComponentFactory, private val configurationController: ConfigurationController, private val broadcastDispatcher: BroadcastDispatcher, + private val dumpManager: DumpManager, + private val logger: VolumePanelLogger, private val volumePanelGlobalStateInteractor: VolumePanelGlobalStateInteractor, ) { @@ -139,6 +165,8 @@ class VolumePanelViewModel( daggerComponentFactory, configurationController, broadcastDispatcher, + dumpManager, + logger, volumePanelGlobalStateInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepositoryKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepositoryKosmos.kt index 2ba1211a9bdb..0b438d183544 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepositoryKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/data/repository/VolumePanelGlobalStateRepositoryKosmos.kt @@ -18,6 +18,7 @@ package com.android.systemui.volume.panel.data.repository import com.android.systemui.dump.dumpManager import com.android.systemui.kosmos.Kosmos +import com.android.systemui.volume.shared.volumePanelLogger val Kosmos.volumePanelGlobalStateRepository by - Kosmos.Fixture { VolumePanelGlobalStateRepository(dumpManager) } + Kosmos.Fixture { VolumePanelGlobalStateRepository(dumpManager, volumePanelLogger) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorKosmos.kt index a18f498e5441..3804a9f21080 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/domain/interactor/ComponentsInteractorKosmos.kt @@ -28,6 +28,7 @@ import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria import com.android.systemui.volume.panel.domain.defaultCriteria import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey import com.android.systemui.volume.panel.ui.composable.enabledComponents +import com.android.systemui.volume.shared.volumePanelLogger import javax.inject.Provider var Kosmos.criteriaByKey: Map<VolumePanelComponentKey, Provider<ComponentAvailabilityCriteria>> by @@ -50,6 +51,7 @@ var Kosmos.componentsInteractor: ComponentsInteractor by enabledComponents, { defaultCriteria }, testScope.backgroundScope, + volumePanelLogger, criteriaByKey, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelKosmos.kt index 34a008f92518..c4fb9e486c4d 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModelKosmos.kt @@ -18,17 +18,19 @@ package com.android.systemui.volume.panel.ui.viewmodel import android.content.applicationContext import com.android.systemui.broadcast.broadcastDispatcher +import com.android.systemui.dump.dumpManager import com.android.systemui.kosmos.Kosmos -import com.android.systemui.kosmos.testScope +import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.statusbar.policy.configurationController import com.android.systemui.volume.panel.dagger.factory.volumePanelComponentFactory import com.android.systemui.volume.panel.domain.VolumePanelStartable import com.android.systemui.volume.panel.domain.interactor.volumePanelGlobalStateInteractor +import com.android.systemui.volume.shared.volumePanelLogger var Kosmos.volumePanelStartables: Set<VolumePanelStartable> by Kosmos.Fixture { emptySet() } var Kosmos.volumePanelViewModel: VolumePanelViewModel by - Kosmos.Fixture { volumePanelViewModelFactory.create(testScope.backgroundScope) } + Kosmos.Fixture { volumePanelViewModelFactory.create(applicationCoroutineScope) } val Kosmos.volumePanelViewModelFactory: VolumePanelViewModel.Factory by Kosmos.Fixture { @@ -37,6 +39,8 @@ val Kosmos.volumePanelViewModelFactory: VolumePanelViewModel.Factory by volumePanelComponentFactory, configurationController, broadcastDispatcher, + dumpManager, + volumePanelLogger, volumePanelGlobalStateInteractor, ) } |