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

Commit 28924344 authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Fix swipe to hub sometimes not working" into main

parents 4d9cc9d0 3ecb0627
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ fun CommunalContainer(
    val coroutineScope = rememberCoroutineScope()
    val currentSceneKey: SceneKey by
        viewModel.currentScene.collectAsStateWithLifecycle(CommunalScenes.Blank)
    val touchesAllowed by viewModel.touchesAllowed.collectAsStateWithLifecycle(initialValue = false)
    val touchesAllowed by viewModel.touchesAllowed.collectAsStateWithLifecycle()
    val showGestureIndicator by
        viewModel.showGestureIndicator.collectAsStateWithLifecycle(initialValue = false)
    val backgroundType by
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@ class CommunalViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            CommunalViewModel(
                kosmos.testDispatcher,
                testScope,
                kosmos.testScope.backgroundScope,
                context.resources,
                kosmos.keyguardTransitionInteractor,
                kosmos.keyguardInteractor,
+10 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.communal.domain.model.CommunalContentModel
import com.android.systemui.communal.shared.model.CommunalBackgroundType
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor
@@ -55,6 +56,8 @@ import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
@@ -64,6 +67,7 @@ import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch

/** The default view model used for showing the communal hub. */
@@ -74,6 +78,7 @@ class CommunalViewModel
constructor(
    @Main val mainDispatcher: CoroutineDispatcher,
    @Application private val scope: CoroutineScope,
    @Background private val bgScope: CoroutineScope,
    @Main private val resources: Resources,
    keyguardTransitionInteractor: KeyguardTransitionInteractor,
    keyguardInteractor: KeyguardInteractor,
@@ -303,8 +308,12 @@ constructor(
     *
     * This is needed because the notification shade does not block touches in blank areas and these
     * fall through to the glanceable hub, which we don't want.
     *
     * Using a StateFlow as the value does not necessarily change when hub becomes available.
     */
    val touchesAllowed: Flow<Boolean> = not(shadeInteractor.isAnyFullyExpanded)
    val touchesAllowed: StateFlow<Boolean> =
        not(shadeInteractor.isAnyFullyExpanded)
            .stateIn(bgScope, SharingStarted.Eagerly, initialValue = false)

    // TODO(b/339667383): remove this temporary swipe gesture handle
    /**