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

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

Merge "Revert "Finish sync for activities under a drawn shared starting window"" into main

parents f8957114 10c840c7
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -2492,14 +2492,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Creating SnapshotStartingData");
        mStartingData = new SnapshotStartingData(mWmService, snapshot, typeParams);
        if ((!mStyleFillsParent && task.getChildCount() > 1)
                || task.forAllLeafTaskFragments(TaskFragment::isEmbedded)) {
            // Case 1:
            // If it is moving a Task{[0]=main activity, [1]=translucent activity} to front, use
            // shared starting window so that the transition doesn't need to wait for the activity
            // behind the translucent activity. Also, onFirstWindowDrawn will check all visible
            // activities are drawn in the task to remove the snapshot starting window.
            // Case 2:
        if (task.forAllLeafTaskFragments(TaskFragment::isEmbedded)) {
            // Associate with the task so if this activity is resized by task fragment later, the
            // starting window can keep the same bounds as the task.
            associateStartingDataWithTask();
@@ -10622,13 +10615,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    @Override
    boolean isSyncFinished(BLASTSyncEngine.SyncGroup group) {
        if (task != null && task.mSharedStartingData != null) {
            final WindowState startingWin = task.topStartingWindow();
            if (startingWin != null && startingWin.isSyncFinished(group)) {
                // The sync is ready if a drawn starting window covered the task.
                return true;
            }
        }
        if (!super.isSyncFinished(group)) return false;
        if (mDisplayContent != null && mDisplayContent.mUnknownAppVisibilityController
                .isVisibilityUnknown(this)) {
+5 −6
Original line number Diff line number Diff line
@@ -1411,13 +1411,12 @@ class Task extends TaskFragment {
        return isUidPresent;
    }

    WindowState topStartingWindow() {
        return getWindow(w -> w.mAttrs.type == TYPE_APPLICATION_STARTING);
    }

    ActivityRecord topActivityContainsStartingWindow() {
        final WindowState startingWindow = topStartingWindow();
        return startingWindow != null ? startingWindow.mActivityRecord : null;
        if (getParent() == null) {
            return null;
        }
        return getActivity((r) -> r.getWindow(window ->
                window.getBaseType() == TYPE_APPLICATION_STARTING) != null);
    }

    /**
+0 −20
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.wm;

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

import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
@@ -137,25 +136,6 @@ public class SyncEngineTests extends WindowTestsBase {
        assertTrue(r.isSyncFinished(r.getSyncGroup()));
    }

    @Test
    public void testFinishSyncByStartingWindow() {
        final ActivityRecord taskRoot = new ActivityBuilder(mAtm).setCreateTask(true).build();
        final Task task = taskRoot.getTask();
        final ActivityRecord translucentTop = new ActivityBuilder(mAtm).setTask(task)
                .setActivityTheme(android.R.style.Theme_Translucent).build();
        createWindow(null, TYPE_BASE_APPLICATION, taskRoot, "win");
        final WindowState startingWindow = createWindow(null, TYPE_APPLICATION_STARTING,
                translucentTop, "starting");
        startingWindow.mStartingData = new SnapshotStartingData(mWm, null, 0);
        task.mSharedStartingData = startingWindow.mStartingData;
        task.prepareSync();

        final BLASTSyncEngine.SyncGroup group = mock(BLASTSyncEngine.SyncGroup.class);
        assertFalse(task.isSyncFinished(group));
        startingWindow.onSyncFinishedDrawing();
        assertTrue(task.isSyncFinished(group));
    }

    @Test
    public void testInvisibleSyncCallback() {
        TestWindowContainer mockWC = new TestWindowContainer(mWm, true /* waiter */);