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

Commit e5d3663e authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "[81/n] Skip Rechability Transitions in Observer" into main

parents 92442f4a 76b853b2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.wm.shell.compatui.letterbox.lifecycle.LetterboxLifecycleEvent
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT
import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.transition.Transitions.TRANSIT_MOVE_LETTERBOX_REACHABILITY

/**
 * The [TransitionObserver] to handle Letterboxing events in Shell delegating to a
@@ -58,6 +59,10 @@ class DelegateLetterboxTransitionObserver(
        startTransaction: SurfaceControl.Transaction,
        finishTransaction: SurfaceControl.Transaction
    ) {
        if (info.type == TRANSIT_MOVE_LETTERBOX_REACHABILITY) {
            // Reachability transitions are handled in LetterboxAnimationHandler
            return
        }
        info.changes.forEach { change ->
            if (letterboxLifecycleEventFactory.canHandle(change)) {
                letterboxLifecycleEventFactory.createLifecycleEvent(change)?.let { event ->
+21 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.wm.shell.compatui.letterbox.lifecycle.LetterboxLifecycleContr
import com.android.wm.shell.compatui.letterbox.lifecycle.LetterboxLifecycleEvent
import com.android.wm.shell.sysui.ShellInit
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.transition.Transitions.TRANSIT_MOVE_LETTERBOX_REACHABILITY
import com.android.wm.shell.util.executeTransitionObserverTest
import java.util.function.Consumer
import org.junit.Test
@@ -72,6 +73,24 @@ class DelegateLetterboxTransitionObserverTest : ShellTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_APP_COMPAT_REFACTORING)
    fun `LetterboxLifecycleController ignores Changes about Reachability`() {
        runTestScenario { r ->
            executeTransitionObserverTest(observerFactory = r.observerFactory) {
                r.invokeShellInit()
                transitionInfo {
                    type = TRANSIT_MOVE_LETTERBOX_REACHABILITY
                    addChange { }
                }
                validateOnTransitionReady {
                    r.checkLifecycleControllerInvoked(times = 0)
                }
            }
        }
    }

    @Test
    @EnableFlags(Flags.FLAG_APP_COMPAT_REFACTORING)
    fun `LetterboxLifecycleController not used with no changes`() {
        runTestScenario { r ->
            executeTransitionObserverTest(observerFactory = r.observerFactory) {
@@ -86,6 +105,7 @@ class DelegateLetterboxTransitionObserverTest : ShellTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_APP_COMPAT_REFACTORING)
    fun `LetterboxLifecycleController used with a single change`() {
        runTestScenario { r ->
            executeTransitionObserverTest(observerFactory = r.observerFactory) {
@@ -101,6 +121,7 @@ class DelegateLetterboxTransitionObserverTest : ShellTestCase() {
    }

    @Test
    @EnableFlags(Flags.FLAG_APP_COMPAT_REFACTORING)
    fun `LetterboxLifecycleController used for each change`() {
        runTestScenario { r ->
            executeTransitionObserverTest(observerFactory = r.observerFactory) {