Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,8 @@ constructor( } } LaunchedEffectWithLifecycle(key1 = Unit) { viewModel.detectShadeModeChanges() } QuickSettingsScene( notificationStackScrollView = notificationStackScrollView.get(), viewModel = viewModel, Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.content.state.TransitionState import com.android.compose.lifecycle.LaunchedEffectWithLifecycle import com.android.compose.modifiers.thenIf import com.android.systemui.brightness.ui.compose.BrightnessSliderContainer import com.android.systemui.brightness.ui.compose.ContainerColors Loading Loading @@ -148,6 +149,8 @@ constructor( // Set the bounds to null when the QuickSettings overlay disappears. DisposableEffect(Unit) { onDispose { contentViewModel.onPanelShapeInWindowChanged(null) } } LaunchedEffectWithLifecycle(key1 = Unit) { contentViewModel.detectShadeModeChanges() } Box(modifier = modifier.graphicsLayer { alpha = contentAlphaFromBrightnessMirror }) { OverlayShade( panelElement = QuickSettingsShade.Elements.Panel, Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.window.domain.interactor.windowRootViewBlurInteractor import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.launch import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -85,6 +86,7 @@ class QuickSettingsSceneContentViewModelTest : SysuiTestCase() { windowRootViewBlurInteractor = windowRootViewBlurInteractor, ) underTest.activateIn(testScope) testScope.backgroundScope.launch { underTest.detectShadeModeChanges() } disableDualShade() } } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.android.systemui.statusbar.policy.configurationController import com.android.systemui.testKosmos import com.android.systemui.window.data.repository.fakeWindowRootViewBlurRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.launch import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -80,6 +81,7 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { enableDualShade() runCurrent() underTest.activateIn(testScope) testScope.backgroundScope.launch { underTest.detectShadeModeChanges() } } @Test Loading packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt +26 −19 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.withContext /** * Models UI state needed for rendering the content of the quick settings scene. Loading Loading @@ -94,29 +95,35 @@ constructor( launch { qsContainerViewModel.activate() } launch(context = mainDispatcher) { awaitCancellation() } } /** * Monitors changes to the shade mode that would make this scene stale, and snaps to the * appropriate scene/overlay instead. * * This function must only run while the scene is shown. Therefore, it shouldn't be part of * [onActivated()] while this scene uses `alwaysCompose`. */ suspend fun detectShadeModeChanges(): Nothing { shadeModeInteractor.shadeMode.collect { shadeMode -> withContext(mainDispatcher) { val loggingReason = "Unfold while on Quick Settings" when (shadeMode) { is ShadeMode.Split -> sceneInteractor.snapToScene( Scenes.Shade, loggingReason = "Unfold while on Quick Settings", ) is ShadeMode.Split -> sceneInteractor.snapToScene(Scenes.Shade, loggingReason) is ShadeMode.Dual -> { val loggingReason = "Unfold or rotate while on Quick Settings" sceneInteractor.snapToScene(SceneFamilies.Home, loggingReason) sceneInteractor.instantlyShowOverlay( Overlays.QuickSettingsShade, loggingReason, ) } else -> Unit } } } awaitCancellation() } } @AssistedFactory Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +2 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,8 @@ constructor( } } LaunchedEffectWithLifecycle(key1 = Unit) { viewModel.detectShadeModeChanges() } QuickSettingsScene( notificationStackScrollView = notificationStackScrollView.get(), viewModel = viewModel, Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsShadeOverlay.kt +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.compose.animation.scene.content.state.TransitionState import com.android.compose.lifecycle.LaunchedEffectWithLifecycle import com.android.compose.modifiers.thenIf import com.android.systemui.brightness.ui.compose.BrightnessSliderContainer import com.android.systemui.brightness.ui.compose.ContainerColors Loading Loading @@ -148,6 +149,8 @@ constructor( // Set the bounds to null when the QuickSettings overlay disappears. DisposableEffect(Unit) { onDispose { contentViewModel.onPanelShapeInWindowChanged(null) } } LaunchedEffectWithLifecycle(key1 = Unit) { contentViewModel.detectShadeModeChanges() } Box(modifier = modifier.graphicsLayer { alpha = contentAlphaFromBrightnessMirror }) { OverlayShade( panelElement = QuickSettingsShade.Elements.Panel, Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.android.systemui.window.domain.interactor.windowRootViewBlurInteractor import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.launch import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -85,6 +86,7 @@ class QuickSettingsSceneContentViewModelTest : SysuiTestCase() { windowRootViewBlurInteractor = windowRootViewBlurInteractor, ) underTest.activateIn(testScope) testScope.backgroundScope.launch { underTest.detectShadeModeChanges() } disableDualShade() } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsShadeOverlayContentViewModelTest.kt +2 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import com.android.systemui.statusbar.policy.configurationController import com.android.systemui.testKosmos import com.android.systemui.window.data.repository.fakeWindowRootViewBlurRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.launch import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading @@ -80,6 +81,7 @@ class QuickSettingsShadeOverlayContentViewModelTest : SysuiTestCase() { enableDualShade() runCurrent() underTest.activateIn(testScope) testScope.backgroundScope.launch { underTest.detectShadeModeChanges() } } @Test Loading
packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneContentViewModel.kt +26 −19 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.withContext /** * Models UI state needed for rendering the content of the quick settings scene. Loading Loading @@ -94,29 +95,35 @@ constructor( launch { qsContainerViewModel.activate() } launch(context = mainDispatcher) { awaitCancellation() } } /** * Monitors changes to the shade mode that would make this scene stale, and snaps to the * appropriate scene/overlay instead. * * This function must only run while the scene is shown. Therefore, it shouldn't be part of * [onActivated()] while this scene uses `alwaysCompose`. */ suspend fun detectShadeModeChanges(): Nothing { shadeModeInteractor.shadeMode.collect { shadeMode -> withContext(mainDispatcher) { val loggingReason = "Unfold while on Quick Settings" when (shadeMode) { is ShadeMode.Split -> sceneInteractor.snapToScene( Scenes.Shade, loggingReason = "Unfold while on Quick Settings", ) is ShadeMode.Split -> sceneInteractor.snapToScene(Scenes.Shade, loggingReason) is ShadeMode.Dual -> { val loggingReason = "Unfold or rotate while on Quick Settings" sceneInteractor.snapToScene(SceneFamilies.Home, loggingReason) sceneInteractor.instantlyShowOverlay( Overlays.QuickSettingsShade, loggingReason, ) } else -> Unit } } } awaitCancellation() } } @AssistedFactory Loading