summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2024-03-21 15:53:49 +0800
committer Riddle Hsu <riddlehsu@google.com> 2024-03-21 16:25:09 +0800
commitde86235034d9e9d87dcadb7a2467ce7efc567b6c (patch)
tree808909e6f50c04855acfbacea7ad3260498e33bf
parent642bdb48a81b682be3307e9066786bdfc63b0e84 (diff)
Finish volume panel after launching sound settings
Otherwise the activity behind volume panel will be moved to front first. The causes the animation of activity launch to show the reorder in a short time, which looks flickering. Fix: 330105146 Test atest BottomBarViewModelTest Test: On home screen. Click volume key. Press menu to launch VolumePanelActivity. Press Settings to launch SoundSettingsActivity. Home should not cover on VolumePanelActivity in transition. Change-Id: I6e5fd97581cee47bf64ce11158169693b6c30236
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModelTest.kt11
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/panel/component/bottombar/ui/viewmodel/BottomBarViewModel.kt3
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 8ff2837c44ef..81e38125b0b0 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,10 +36,9 @@ constructor(
}
fun onSettingsClicked() {
- volumePanelViewModel.dismissPanel()
activityStarter.startActivity(
Intent(Settings.ACTION_SOUND_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
true,
- )
+ ) { volumePanelViewModel.dismissPanel() }
}
}