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

Commit 76b853b2 authored by Massimo Carli's avatar Massimo Carli
Browse files

[81/n] Skip Rechability Transitions in Observer

When the user double-taps a Change of type
TRANSIT_MOVE_LETTERBOX_REACHABILITY is created.

The transition is handled in LetterboxAnimationHandler
where the Letterbox Surfaces bounds are animated.
Nothing triggered by DelegateLetterboxTransitionObserver
should be done in addition to that.

Flag: EXEMPT Refactoring
Fix: 431893696
Bug: 430486865
Test: atest WMShellUnitTests:DelegateLetterboxTransitionObserverTest

Change-Id: Ibc0a3f05f1e1d8de3ca1bca89574945fcea852e4
parent a254dd28
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) {