Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e724c7ea authored by William Xiao's avatar William Xiao Committed by Lucas Silva
Browse files

Ignore all glanceable hub touches when notification shade is open

With the newest keyguard flags enabled, touches from the shade seem to
make it down to the glanceable hub. This bypasses our top-level touch
handling logic in GlanceableHubContainerController so this change just blocks
touches when the shade is open.

Bug: 323265343
Test: verified manually on device
Flag: ACONFIG com.android.systemui.communal_hub STAGING
Change-Id: If074e0453e5b3168e72ee0a213c1ab8df8788031
parent 60fdaef6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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()
    }

+2 −1
Original line number Diff line number Diff line
@@ -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) } }
        }
+5 −2
Original line number Diff line number Diff line
@@ -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(
+2 −0
Original line number Diff line number Diff line
@@ -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"),
            )
+7 −0
Original line number Diff line number Diff line
@@ -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 =
Loading