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

Commit 1c821c11 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Clean up StartingWindowRecord from record manager once it is removed." into udc-qpr-dev

parents 65a98f76 0c45c90a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -35,13 +35,14 @@ class SnapshotWindowCreator {
    void makeTaskSnapshotWindow(StartingWindowInfo startingWindowInfo, TaskSnapshot snapshot) {
        final int taskId = startingWindowInfo.taskInfo.taskId;
        // Remove any existing starting window for this task before adding.
        mStartingWindowRecordManager.removeWindow(taskId, true);
        mStartingWindowRecordManager.removeWindow(taskId);
        final TaskSnapshotWindow surface = TaskSnapshotWindow.create(startingWindowInfo,
                startingWindowInfo.appToken, snapshot, mMainExecutor,
                () -> mStartingWindowRecordManager.removeWindow(taskId, true));
                () -> mStartingWindowRecordManager.removeWindow(taskId));
        if (surface != null) {
            final SnapshotWindowRecord tView = new SnapshotWindowRecord(surface,
                    startingWindowInfo.taskInfo.topActivityType, mMainExecutor);
                    startingWindowInfo.taskInfo.topActivityType, mMainExecutor,
                    taskId, mStartingWindowRecordManager);
            mStartingWindowRecordManager.addRecord(taskId, tView);
        }
    }
@@ -50,8 +51,9 @@ class SnapshotWindowCreator {
        private final TaskSnapshotWindow mTaskSnapshotWindow;

        SnapshotWindowRecord(TaskSnapshotWindow taskSnapshotWindow,
                int activityType, ShellExecutor removeExecutor) {
            super(activityType, removeExecutor);
                int activityType, ShellExecutor removeExecutor, int id,
                StartingSurfaceDrawer.StartingWindowRecordManager recordManager) {
            super(activityType, removeExecutor, id, recordManager);
            mTaskSnapshotWindow = taskSnapshotWindow;
            mBGColor = mTaskSnapshotWindow.getBackgroundColor();
        }
+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ class SplashscreenWindowCreator extends AbsSplashWindowCreator {
            }
        }
        if (shouldSaveView) {
            mStartingWindowRecordManager.removeWindow(taskId, true);
            mStartingWindowRecordManager.removeWindow(taskId);
            saveSplashScreenRecord(appToken, taskId, view, suggestType);
        }
        return shouldSaveView;
+15 −5
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ public class StartingSurfaceDrawer {
        final SnapshotRecord record = sRecord instanceof SnapshotRecord
                ? (SnapshotRecord) sRecord : null;
        if (record != null && record.hasImeSurface()) {
            records.removeWindow(taskId, true);
            records.removeWindow(taskId);
        }
    }

@@ -256,10 +256,15 @@ public class StartingSurfaceDrawer {

        @WindowConfiguration.ActivityType protected final int mActivityType;
        protected final ShellExecutor mRemoveExecutor;
        private final int mTaskId;
        private final StartingWindowRecordManager mRecordManager;

        SnapshotRecord(int activityType, ShellExecutor removeExecutor) {
        SnapshotRecord(int activityType, ShellExecutor removeExecutor, int taskId,
                StartingWindowRecordManager recordManager) {
            mActivityType = activityType;
            mRemoveExecutor = removeExecutor;
            mTaskId = taskId;
            mRecordManager = recordManager;
        }

        @Override
@@ -301,6 +306,7 @@ public class StartingSurfaceDrawer {
        @CallSuper
        protected void removeImmediately() {
            mRemoveExecutor.removeCallbacks(mScheduledRunnable);
            mRecordManager.onRecordRemoved(mTaskId);
        }
    }

@@ -316,7 +322,7 @@ public class StartingSurfaceDrawer {
                taskIds[i] = mStartingWindowRecords.keyAt(i);
            }
            for (int i = taskSize - 1; i >= 0; --i) {
                removeWindow(taskIds[i], true);
                removeWindow(taskIds[i]);
            }
        }

@@ -335,9 +341,13 @@ public class StartingSurfaceDrawer {
            }
        }

        void removeWindow(int taskId, boolean immediately) {
        void removeWindow(int taskId) {
            mTmpRemovalInfo.taskId = taskId;
            removeWindow(mTmpRemovalInfo, immediately);
            removeWindow(mTmpRemovalInfo, true/* immediately */);
        }

        void onRecordRemoved(int taskId) {
            mStartingWindowRecords.remove(taskId);
        }

        StartingWindowRecord getRecord(int taskId) {
+5 −3
Original line number Diff line number Diff line
@@ -92,7 +92,8 @@ class WindowlessSnapshotWindowCreator {

        final SnapshotWindowRecord record = new SnapshotWindowRecord(mViewHost, wlw.mChildSurface,
                taskDescription.getBackgroundColor(), snapshot.hasImeSurface(),
                runningTaskInfo.topActivityType, removeExecutor);
                runningTaskInfo.topActivityType, removeExecutor,
                taskId, mStartingWindowRecordManager);
        mStartingWindowRecordManager.addRecord(taskId, record);
        info.notifyAddComplete(wlw.mChildSurface);
    }
@@ -104,8 +105,9 @@ class WindowlessSnapshotWindowCreator {

        SnapshotWindowRecord(SurfaceControlViewHost viewHost, SurfaceControl childSurface,
                int bgColor, boolean hasImeSurface, int activityType,
                ShellExecutor removeExecutor) {
            super(activityType, removeExecutor);
                ShellExecutor removeExecutor, int id,
                StartingSurfaceDrawer.StartingWindowRecordManager recordManager) {
            super(activityType, removeExecutor, id, recordManager);
            mViewHost = viewHost;
            mChildSurface = childSurface;
            mBGColor = bgColor;