diff options
2 files changed, 10 insertions, 4 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt index 471c8d851879..8e925573d40a 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt @@ -16,6 +16,7 @@ package com.android.systemui.volume.panel.component.bottombar.ui.viewmodel +import android.app.ActivityManager import android.content.Intent import android.provider.Settings import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -23,6 +24,7 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.testScope +import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.activityStarter import com.android.systemui.testKosmos import com.android.systemui.util.mockito.capture @@ -49,6 +51,8 @@ class BottomBarViewModelTest : SysuiTestCase() { @Captor private lateinit var intentCaptor: ArgumentCaptor<Intent> + @Captor private lateinit var activityStartedCaptor: ArgumentCaptor<ActivityStarter.Callback> + private val kosmos = testKosmos() private lateinit var underTest: BottomBarViewModel @@ -80,10 +84,13 @@ class BottomBarViewModelTest : SysuiTestCase() { runCurrent() + verify(activityStarter).startActivity(capture(intentCaptor), eq(true), + capture(activityStartedCaptor)) + assertThat(intentCaptor.value.action).isEqualTo(Settings.ACTION_SOUND_SETTINGS) + + activityStartedCaptor.value.onActivityStarted(ActivityManager.START_SUCCESS) val volumePanelState by collectLastValue(volumePanelViewModel.volumePanelState) assertThat(volumePanelState!!.isVisible).isFalse() - verify(activityStarter).startActivity(capture(intentCaptor), eq(true)) - assertThat(intentCaptor.value.action).isEqualTo(Settings.ACTION_SOUND_SETTINGS) } } } diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModel.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModel.kt index 46ea38239aa2..0207d6e8e8c2 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModel.kt @@ -36,11 +36,10 @@ constructor( } fun onSettingsClicked() { - volumePanelViewModel.dismissPanel() activityStarter.startActivity( Intent(Settings.ACTION_SOUND_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), true, - ) + ) { volumePanelViewModel.dismissPanel() } } } |