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

Commit 0e1d1e76 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Skip transition only when transferring starting from visible activity

Otherwise if the starting window is transferring when it is added but
not yet drawn, the first opening transition will be skipped.

Bug: 196636209
Test: ActivityRecordTests#testTransferStartingWindow,
     testTransferStartingWindowFromFinishingActivity

Change-Id: I1047944351e574cfd88fa1eb879d3b9bc55440c3
parent ca7eb3f9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3914,7 +3914,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (tStartingWindow != null && fromActivity.mStartingSurface != null) {
            // In this case, the starting icon has already been displayed, so start
            // letting windows get shown immediately without any more transitions.
            getDisplayContent().mSkipAppTransitionAnimation = true;
            if (fromActivity.mVisible) {
                mDisplayContent.mSkipAppTransitionAnimation = true;
            }

            ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Moving existing starting %s"
                    + " from %s to %s", tStartingWindow, fromActivity, this);
+6 −2
Original line number Diff line number Diff line
@@ -2509,8 +2509,10 @@ public class ActivityRecordTests extends WindowTestsBase {
    @Test
    public void testTransferStartingWindow() {
        registerTestStartingWindowOrganizer();
        final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final ActivityRecord activity2 = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final ActivityRecord activity1 = new ActivityBuilder(mAtm).setCreateTask(true)
                .setVisible(false).build();
        final ActivityRecord activity2 = new ActivityBuilder(mAtm).setCreateTask(true)
                .setVisible(false).build();
        activity1.addStartingWindow(mPackageName,
                android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true,
                false, false);
@@ -2519,6 +2521,7 @@ public class ActivityRecordTests extends WindowTestsBase {
                android.R.style.Theme, null, "Test", 0, 0, 0, 0, activity1,
                true, true, false, true, false, false);
        waitUntilHandlersIdle();
        assertFalse(mDisplayContent.mSkipAppTransitionAnimation);
        assertNoStartingWindow(activity1);
        assertHasStartingWindow(activity2);
    }
@@ -2626,6 +2629,7 @@ public class ActivityRecordTests extends WindowTestsBase {
                false /* newTask */, false /* isTaskSwitch */, null /* options */,
                null /* sourceRecord */);

        assertTrue(mDisplayContent.mSkipAppTransitionAnimation);
        assertNull(middle.mStartingWindow);
        assertHasStartingWindow(top);
        assertTrue(top.isVisible());