Loading packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.qs.ui.composable import android.view.ViewGroup import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.tween import androidx.compose.animation.expandVertically Loading Loading @@ -122,6 +123,13 @@ private fun SceneScope.QuickSettingsScene( // TODO(b/280887232): implement the real UI. Box(modifier = modifier.fillMaxSize()) { val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsState() BackHandler( enabled = isCustomizing, ) { viewModel.qsSceneAdapter.requestCloseCustomizer() } val collapsedHeaderHeight = with(LocalDensity.current) { ShadeHeader.Dimensions.CollapsedHeight.roundToPx() } val lifecycleOwner = LocalLifecycleOwner.current Loading packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt +12 −0 Original line number Diff line number Diff line Loading @@ -496,4 +496,16 @@ class QSSceneAdapterImplTest : SysuiTestCase() { runCurrent() verify(qsImpl!!).setInSplitShade(true) } @Test fun requestCloseCustomizer() = testScope.runTest { val qsImpl by collectLastValue(underTest.qsImpl) underTest.inflate(context) runCurrent() underTest.requestCloseCustomizer() verify(qsImpl!!).closeCustomizer() } } packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt +4 −14 Original line number Diff line number Diff line Loading @@ -133,18 +133,13 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { } @Test fun destinationsCustomizing() = fun destinationsCustomizing_noDestinations() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) val destinations by collectLastValue(underTest.destinationScenes) qsFlexiglassAdapter.setCustomizing(true) assertThat(destinations) .isEqualTo( mapOf( Back to UserActionResult(Scenes.QuickSettings), ) ) assertThat(destinations).isEmpty() } @Test Loading @@ -164,18 +159,13 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { } @Test fun destinations_whenCustomizing_inSplitShade() = fun destinations_whenCustomizing_inSplitShade_noDestinations() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, true) val destinations by collectLastValue(underTest.destinationScenes) qsFlexiglassAdapter.setCustomizing(true) assertThat(destinations) .isEqualTo( mapOf( Back to UserActionResult(Scenes.QuickSettings), ) ) assertThat(destinations).isEmpty() } @Test Loading packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt +7 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ interface QSSceneAdapter { val isQsFullyCollapsed: Boolean get() = true /** Request that the customizer be closed. Possibly animating it. */ fun requestCloseCustomizer() sealed interface State { val isVisible: Boolean Loading Loading @@ -277,6 +280,10 @@ constructor( bottomNavBarSize.emit(padding) } override fun requestCloseCustomizer() { qsImpl.value?.closeCustomizer() } private fun QSImpl.applyState(state: QSSceneAdapter.State) { setQsVisible(state.isVisible) setExpanded(state.isVisible && state.expansion > 0f) Loading packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt +3 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import androidx.lifecycle.LifecycleOwner import com.android.compose.animation.scene.Back import com.android.compose.animation.scene.Swipe import com.android.compose.animation.scene.SwipeDirection import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.FooterActionsController Loading @@ -47,7 +46,9 @@ constructor( val destinationScenes = qsSceneAdapter.isCustomizing.map { customizing -> if (customizing) { mapOf<UserAction, UserActionResult>(Back to UserActionResult(Scenes.QuickSettings)) // TODO(b/332749288) Empty map so there are no back handlers and back can close // customizer emptyMap() // TODO(b/330200163) Add an Up from Bottom to be able to collapse the shade // while customizing } else { Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/qs/ui/composable/QuickSettingsScene.kt +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.qs.ui.composable import android.view.ViewGroup import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.tween import androidx.compose.animation.expandVertically Loading Loading @@ -122,6 +123,13 @@ private fun SceneScope.QuickSettingsScene( // TODO(b/280887232): implement the real UI. Box(modifier = modifier.fillMaxSize()) { val isCustomizing by viewModel.qsSceneAdapter.isCustomizing.collectAsState() BackHandler( enabled = isCustomizing, ) { viewModel.qsSceneAdapter.requestCloseCustomizer() } val collapsedHeaderHeight = with(LocalDensity.current) { ShadeHeader.Dimensions.CollapsedHeight.roundToPx() } val lifecycleOwner = LocalLifecycleOwner.current Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/adapter/QSSceneAdapterImplTest.kt +12 −0 Original line number Diff line number Diff line Loading @@ -496,4 +496,16 @@ class QSSceneAdapterImplTest : SysuiTestCase() { runCurrent() verify(qsImpl!!).setInSplitShade(true) } @Test fun requestCloseCustomizer() = testScope.runTest { val qsImpl by collectLastValue(underTest.qsImpl) underTest.inflate(context) runCurrent() underTest.requestCloseCustomizer() verify(qsImpl!!).closeCustomizer() } }
packages/SystemUI/multivalentTests/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModelTest.kt +4 −14 Original line number Diff line number Diff line Loading @@ -133,18 +133,13 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { } @Test fun destinationsCustomizing() = fun destinationsCustomizing_noDestinations() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, false) val destinations by collectLastValue(underTest.destinationScenes) qsFlexiglassAdapter.setCustomizing(true) assertThat(destinations) .isEqualTo( mapOf( Back to UserActionResult(Scenes.QuickSettings), ) ) assertThat(destinations).isEmpty() } @Test Loading @@ -164,18 +159,13 @@ class QuickSettingsSceneViewModelTest : SysuiTestCase() { } @Test fun destinations_whenCustomizing_inSplitShade() = fun destinations_whenCustomizing_inSplitShade_noDestinations() = testScope.runTest { overrideResource(R.bool.config_use_split_notification_shade, true) val destinations by collectLastValue(underTest.destinationScenes) qsFlexiglassAdapter.setCustomizing(true) assertThat(destinations) .isEqualTo( mapOf( Back to UserActionResult(Scenes.QuickSettings), ) ) assertThat(destinations).isEmpty() } @Test Loading
packages/SystemUI/src/com/android/systemui/qs/ui/adapter/QSSceneAdapter.kt +7 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ interface QSSceneAdapter { val isQsFullyCollapsed: Boolean get() = true /** Request that the customizer be closed. Possibly animating it. */ fun requestCloseCustomizer() sealed interface State { val isVisible: Boolean Loading Loading @@ -277,6 +280,10 @@ constructor( bottomNavBarSize.emit(padding) } override fun requestCloseCustomizer() { qsImpl.value?.closeCustomizer() } private fun QSImpl.applyState(state: QSSceneAdapter.State) { setQsVisible(state.isVisible) setExpanded(state.isVisible && state.expansion > 0f) Loading
packages/SystemUI/src/com/android/systemui/qs/ui/viewmodel/QuickSettingsSceneViewModel.kt +3 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import androidx.lifecycle.LifecycleOwner import com.android.compose.animation.scene.Back import com.android.compose.animation.scene.Swipe import com.android.compose.animation.scene.SwipeDirection import com.android.compose.animation.scene.UserAction import com.android.compose.animation.scene.UserActionResult import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.FooterActionsController Loading @@ -47,7 +46,9 @@ constructor( val destinationScenes = qsSceneAdapter.isCustomizing.map { customizing -> if (customizing) { mapOf<UserAction, UserActionResult>(Back to UserActionResult(Scenes.QuickSettings)) // TODO(b/332749288) Empty map so there are no back handlers and back can close // customizer emptyMap() // TODO(b/330200163) Add an Up from Bottom to be able to collapse the shade // while customizing } else { Loading