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

Commit 90b8bc9e authored by Shawn Lee's avatar Shawn Lee Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Reimplement closing guts on outside touch in flexiglass" into main

parents 1e2e150c c08f36a5
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.scene.ui.composable

import androidx.compose.foundation.gestures.awaitEachGesture
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
@@ -28,6 +30,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import com.android.compose.animation.scene.MutableSceneTransitionLayoutState
import com.android.compose.animation.scene.SceneKey
import com.android.compose.animation.scene.SceneTransitionLayout
@@ -100,7 +103,13 @@ fun SceneContainer(
    }

    Box(
        modifier = Modifier.fillMaxSize(),
        modifier =
            Modifier.fillMaxSize().pointerInput(Unit) {
                awaitEachGesture {
                    awaitFirstDown(false)
                    viewModel.onSceneContainerUserInputStarted()
                }
            },
    ) {
        SceneTransitionLayout(state = state, modifier = modifier.fillMaxSize()) {
            sceneByKey.forEach { (sceneKey, composableScene) ->
+2 −2
Original line number Diff line number Diff line
@@ -401,10 +401,10 @@ class SceneInteractorTest : SysuiTestCase() {
            underTest.setVisible(false, "reason")
            val isVisible by collectLastValue(underTest.isVisible)
            assertThat(isVisible).isFalse()
            underTest.onRemoteUserInteractionStarted("reason")
            underTest.onRemoteUserInputStarted("reason")
            assertThat(isVisible).isTrue()

            underTest.onUserInteractionFinished()
            underTest.onUserInputFinished()

            assertThat(isVisible).isFalse()
        }
+1 −1
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ class SceneContainerViewModelTest : SysuiTestCase() {
            sceneInteractor.setVisible(false, "reason")
            runCurrent()
            assertThat(underTest.isVisible).isFalse()
            sceneInteractor.onRemoteUserInteractionStarted("reason")
            sceneInteractor.onRemoteUserInputStarted("reason")
            runCurrent()
            assertThat(underTest.isVisible).isTrue()

+45 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.shade.data.repository.shadeRepository
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds
import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimRounding
@@ -84,4 +85,48 @@ class NotificationStackAppearanceInteractorTest : SysuiTestCase() {
                )
            )
        }

    @Test
    fun shouldCloseGuts_userInputOngoing_currentGestureInGuts() =
        testScope.runTest {
            val shouldCloseGuts by collectLastValue(underTest.shouldCloseGuts)

            kosmos.sceneInteractor.onSceneContainerUserInputStarted()
            underTest.setCurrentGestureInGuts(true)

            assertThat(shouldCloseGuts).isFalse()
        }

    @Test
    fun shouldCloseGuts_userInputOngoing_currentGestureNotInGuts() =
        testScope.runTest {
            val shouldCloseGuts by collectLastValue(underTest.shouldCloseGuts)

            kosmos.sceneInteractor.onSceneContainerUserInputStarted()
            underTest.setCurrentGestureInGuts(false)

            assertThat(shouldCloseGuts).isTrue()
        }

    @Test
    fun shouldCloseGuts_userInputNotOngoing_currentGestureInGuts() =
        testScope.runTest {
            val shouldCloseGuts by collectLastValue(underTest.shouldCloseGuts)

            kosmos.sceneInteractor.onUserInputFinished()
            underTest.setCurrentGestureInGuts(true)

            assertThat(shouldCloseGuts).isFalse()
        }

    @Test
    fun shouldCloseGuts_userInputNotOngoing_currentGestureNotInGuts() =
        testScope.runTest {
            val shouldCloseGuts by collectLastValue(underTest.shouldCloseGuts)

            kosmos.sceneInteractor.onUserInputFinished()
            underTest.setCurrentGestureInGuts(false)

            assertThat(shouldCloseGuts).isFalse()
        }
}
+2 −2
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                        // If scene framework is enabled, set the scene container window to
                        // visible and let the touch "slip" into that window.
                        if (SceneContainerFlag.isEnabled()) {
                            mSceneInteractor.get().onRemoteUserInteractionStarted("launcher swipe");
                            mSceneInteractor.get().onRemoteUserInputStarted("launcher swipe");
                        } else {
                            mShadeViewControllerLazy.get().startInputFocusTransfer();
                        }
@@ -266,7 +266,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                if (SceneContainerFlag.isEnabled()) {
                    int action = event.getActionMasked();
                    if (action == ACTION_DOWN) {
                        mSceneInteractor.get().onRemoteUserInteractionStarted(
                        mSceneInteractor.get().onRemoteUserInputStarted(
                                "trackpad swipe");
                    } else if (action == ACTION_UP) {
                        mSceneInteractor.get().changeScene(
Loading