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

Commit 1b4bb3c4 authored by Gustav Sennton's avatar Gustav Sennton Committed by Android (Google) Code Review
Browse files

Merge "Fix Launcher flicker during Desktop > Splitscreen transition" into main

parents 1c1c73dd 44aa7482
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -817,9 +817,19 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                        // the pausing apps.
                        t.setLayer(target.leash, layer);
                    } else if (taskInfo != null && taskInfo.topActivityType == ACTIVITY_TYPE_HOME) {
                        if (DesktopExperienceFlags
                                .ENABLE_DESKTOP_SPLITSCREEN_TRANSITION_BUGFIX.isTrue()) {
                            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                                    "  hiding home taskId=%d", taskInfo.taskId);
                            // Hide the Home task (Launcher) so that it doesn't cause a flicker by
                            // appearing before the animation itself starts.
                            // TODO: b/399160023 remove this when we stop using transition-type
                            //  checks in transition utils.
                            t.hide(target.leash);
                        } else {
                            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                                    "  not handling home taskId=%d", taskInfo.taskId);
                        // do nothing
                        }
                    } else if (TransitionUtil.isOpeningType(change.getMode())) {
                        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                                "  adding opening leaf taskId=%d", taskInfo.taskId);
@@ -1873,6 +1883,11 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                onFinishInner(null /* wct */);
            }
        };

        @VisibleForTesting
        ArrayMap<SurfaceControl, SurfaceControl> getLeashMapForTesting() {
            return mLeashMap;
        }
    };

    /** Utility class to track the state of a task as-seen by recents. */
+23 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;

import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_RECENTS_TRANSITIONS_CORNERS_BUGFIX;
import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_SPLITSCREEN_TRANSITION_BUGFIX;
import static com.android.window.flags.Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND;
import static com.android.wm.shell.Flags.FLAG_ENABLE_PIP2;
import static com.android.wm.shell.Flags.FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION;
@@ -263,6 +264,23 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
        assertThat(listener.getState()).isEqualTo(TRANSITION_STATE_ANIMATING);
    }

    @Test
    @EnableFlags(FLAG_ENABLE_DESKTOP_SPLITSCREEN_TRANSITION_BUGFIX)
    public void testStartAnimation_hidesHomeTask() {
        final IBinder transition = startRecentsTransition(/* synthetic= */ false);
        RecentsTransitionHandler.RecentsController controller =
                mRecentsTransitionHandler.findController(transition);
        SurfaceControl.Transaction startT = mock(SurfaceControl.Transaction.class);
        SurfaceControl homeLeash = new SurfaceControl();

        mRecentsTransitionHandler.startAnimation(
                transition, createTransitionInfo(homeLeash), startT, new StubTransaction(),
                mock(Transitions.TransitionFinishCallback.class));
        mMainExecutor.flushAll();

        verify(startT).hide(controller.getLeashMapForTesting().get(homeLeash));
    }

    @Test
    public void testFinishTransition_updatesStateListeners() {
        final TestTransitionStateListener listener = new TestTransitionStateListener();
@@ -640,6 +658,10 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
    }

    private TransitionInfo createTransitionInfo() {
        return createTransitionInfo(new SurfaceControl());
    }

    private TransitionInfo createTransitionInfo(SurfaceControl homeLeash) {
        final ActivityManager.RunningTaskInfo homeTask = new TestRunningTaskInfoBuilder()
                .setTopActivityType(ACTIVITY_TYPE_HOME)
                .build();
@@ -647,7 +669,7 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
                .setTopActivityType(ACTIVITY_TYPE_STANDARD)
                .build();
        final TransitionInfo.Change homeChange = new TransitionInfo.Change(
                homeTask.token, new SurfaceControl());
                homeTask.token, homeLeash);
        homeChange.setMode(TRANSIT_TO_FRONT);
        homeChange.setTaskInfo(homeTask);
        final TransitionInfo.Change appChange = new TransitionInfo.Change(