Skip to content
Snippets Groups Projects
Commit e91a99d9 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Ignore all glanceable hub touches when notification shade is open" into main

parents 46d8cead e724c7ea
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import androidx.lifecycle.LifecycleOwner
import com.android.systemui.bouncer.ui.BouncerDialogFactory
import com.android.systemui.bouncer.ui.viewmodel.BouncerViewModel
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.communal.widgets.WidgetConfigurator
import com.android.systemui.keyboard.stickykeys.ui.viewmodel.StickyKeysIndicatorViewModel
import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint
......@@ -104,7 +105,7 @@ object ComposeFacade : BaseComposeFacade {
throwComposeUnavailableError()
}
override fun createCommunalContainer(context: Context, viewModel: BaseCommunalViewModel): View {
override fun createCommunalContainer(context: Context, viewModel: CommunalViewModel): View {
throwComposeUnavailableError()
}
......
......@@ -40,6 +40,7 @@ import com.android.systemui.common.ui.compose.windowinsets.ScreenDecorProvider
import com.android.systemui.communal.ui.compose.CommunalContainer
import com.android.systemui.communal.ui.compose.CommunalHub
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.communal.widgets.WidgetConfigurator
import com.android.systemui.keyboard.stickykeys.ui.view.createStickyKeyIndicatorView
import com.android.systemui.keyboard.stickykeys.ui.viewmodel.StickyKeysIndicatorViewModel
......@@ -161,7 +162,7 @@ object ComposeFacade : BaseComposeFacade {
}
}
override fun createCommunalContainer(context: Context, viewModel: BaseCommunalViewModel): View {
override fun createCommunalContainer(context: Context, viewModel: CommunalViewModel): View {
return ComposeView(context).apply {
setContent { PlatformTheme { CommunalContainer(viewModel = viewModel) } }
}
......
......@@ -23,7 +23,9 @@ import com.android.compose.animation.scene.transitions
import com.android.compose.animation.scene.updateSceneTransitionLayoutState
import com.android.systemui.communal.shared.model.CommunalSceneKey
import com.android.systemui.communal.shared.model.ObservableCommunalTransitionState
import com.android.systemui.communal.ui.compose.extensions.allowGestures
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.transform
......@@ -51,7 +53,7 @@ val sceneTransitions = transitions {
@Composable
fun CommunalContainer(
modifier: Modifier = Modifier,
viewModel: BaseCommunalViewModel,
viewModel: CommunalViewModel,
) {
val currentScene: SceneKey by
viewModel.currentScene
......@@ -63,6 +65,7 @@ fun CommunalContainer(
onChangeScene = { viewModel.onSceneChanged(it.toCommunalSceneKey()) },
transitions = sceneTransitions,
)
val touchesAllowed by viewModel.touchesAllowed.collectAsState(initial = false)
// This effect exposes the SceneTransitionLayout's observable transition state to the rest of
// the system, and unsets it when the view is disposed to avoid a memory leak.
......@@ -75,7 +78,7 @@ fun CommunalContainer(
SceneTransitionLayout(
state = sceneTransitionLayoutState,
modifier = modifier.fillMaxSize(),
modifier = modifier.fillMaxSize().allowGestures(allowed = touchesAllowed),
swipeSourceDetector = FixedSizeEdgeDetector(ContainerDimensions.EdgeSwipeSize),
) {
scene(
......
......@@ -45,6 +45,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.log.logcatLogBuffer
import com.android.systemui.media.controls.ui.MediaHierarchyManager
import com.android.systemui.media.controls.ui.MediaHost
import com.android.systemui.shade.domain.interactor.shadeInteractor
import com.android.systemui.smartspace.data.repository.FakeSmartspaceRepository
import com.android.systemui.smartspace.data.repository.fakeSmartspaceRepository
import com.android.systemui.testKosmos
......@@ -102,6 +103,7 @@ class CommunalViewModelTest : SysuiTestCase() {
testScope,
kosmos.communalInteractor,
kosmos.communalTutorialInteractor,
kosmos.shadeInteractor,
mediaHost,
logcatLogBuffer("CommunalViewModelTest"),
)
......
......@@ -28,6 +28,8 @@ import com.android.systemui.media.controls.ui.MediaHierarchyManager
import com.android.systemui.media.controls.ui.MediaHost
import com.android.systemui.media.controls.ui.MediaHostState
import com.android.systemui.media.dagger.MediaModule
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.util.kotlin.BooleanFlowOperators.not
import javax.inject.Inject
import javax.inject.Named
import kotlinx.coroutines.CoroutineScope
......@@ -51,6 +53,7 @@ constructor(
@Application private val scope: CoroutineScope,
private val communalInteractor: CommunalInteractor,
tutorialInteractor: CommunalTutorialInteractor,
shadeInteractor: ShadeInteractor,
@Named(MediaModule.COMMUNAL_HUB) mediaHost: MediaHost,
@CommunalLog logBuffer: LogBuffer,
) : BaseCommunalViewModel(communalInteractor, mediaHost) {
......@@ -81,6 +84,9 @@ constructor(
override val isPopupOnDismissCtaShowing: Flow<Boolean> =
_isPopupOnDismissCtaShowing.asStateFlow()
/** Whether touches should be disabled in communal */
val touchesAllowed: Flow<Boolean> = not(shadeInteractor.isAnyFullyExpanded)
init {
// Initialize our media host for the UMO. This only needs to happen once and must be done
// before the MediaHierarchyManager attempts to move the UMO to the hub.
......@@ -114,6 +120,7 @@ constructor(
}
private var delayedHidePopupJob: Job? = null
private fun schedulePopupHiding() {
cancelDelayedPopupHiding()
delayedHidePopupJob =
......
......@@ -25,6 +25,7 @@ import androidx.lifecycle.LifecycleOwner
import com.android.systemui.bouncer.ui.BouncerDialogFactory
import com.android.systemui.bouncer.ui.viewmodel.BouncerViewModel
import com.android.systemui.communal.ui.viewmodel.BaseCommunalViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalViewModel
import com.android.systemui.communal.widgets.WidgetConfigurator
import com.android.systemui.keyboard.stickykeys.ui.viewmodel.StickyKeysIndicatorViewModel
import com.android.systemui.keyguard.shared.model.LockscreenSceneBlueprint
......@@ -116,7 +117,7 @@ interface BaseComposeFacade {
): View
/** Creates a container that hosts the communal UI and handles gesture transitions. */
fun createCommunalContainer(context: Context, viewModel: BaseCommunalViewModel): View
fun createCommunalContainer(context: Context, viewModel: CommunalViewModel): View
/** Creates a [View] that represents the Lockscreen. */
fun createLockscreen(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment