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

Commit 94b48e8c authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Wait for relaunching activity to finish sync" into udc-dev

parents c2970d74 6a776fc5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10608,6 +10608,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
        }
        if (!isVisibleRequested()) return true;
        if (mPendingRelaunchCount > 0) return false;
        // Wait for attach. That is the earliest time where we know if there will be an associated
        // display rotation. If we don't wait, the starting-window can finishDrawing first and
        // cause the display rotation to end-up in a following transition.
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.wm;

import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.times;
@@ -119,6 +120,22 @@ public class SyncEngineTests extends WindowTestsBase {
        assertTrue(mockWC.onSyncFinishedDrawing());
        bse.onSurfacePlacement();
        verify(listener, times(1)).onTransactionReady(eq(id), notNull());

        // The sync is not finished for a relaunching activity.
        id = startSyncSet(bse, listener);
        final ActivityRecord r = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final WindowState w = mock(WindowState.class);
        doReturn(true).when(w).isVisibleRequested();
        doReturn(true).when(w).fillsParent();
        doReturn(true).when(w).isSyncFinished(any());
        r.mChildren.add(w);
        bse.addToSyncSet(id, r);
        r.onSyncFinishedDrawing();
        assertTrue(r.isSyncFinished(r.getSyncGroup()));
        r.startRelaunching();
        assertFalse(r.isSyncFinished(r.getSyncGroup()));
        r.finishRelaunching();
        assertTrue(r.isSyncFinished(r.getSyncGroup()));
    }

    @Test