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

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

Merge "Fix SnapshotRecord being overwritten when requesting a new one." into main

parents 487d8fa9 866120bb
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.window.StartingWindowRemovalInfo.DEFER_MODE_NORMAL;
import static android.window.StartingWindowRemovalInfo.DEFER_MODE_ROTATION;

import android.annotation.CallSuper;
import android.annotation.NonNull;
import android.app.TaskInfo;
import android.app.WindowConfiguration;
import android.content.Context;
@@ -306,7 +307,7 @@ public class StartingSurfaceDrawer {
        @CallSuper
        protected void removeImmediately() {
            mRemoveExecutor.removeCallbacks(mScheduledRunnable);
            mRecordManager.onRecordRemoved(mTaskId);
            mRecordManager.onRecordRemoved(this, mTaskId);
        }
    }

@@ -327,6 +328,11 @@ public class StartingSurfaceDrawer {
        }

        void addRecord(int taskId, StartingWindowRecord record) {
            final StartingWindowRecord original = mStartingWindowRecords.get(taskId);
            if (original != null) {
                mTmpRemovalInfo.taskId = taskId;
                original.removeIfPossible(mTmpRemovalInfo, true /* immediately */);
            }
            mStartingWindowRecords.put(taskId, record);
        }

@@ -346,9 +352,12 @@ public class StartingSurfaceDrawer {
            removeWindow(mTmpRemovalInfo, true/* immediately */);
        }

        void onRecordRemoved(int taskId) {
        void onRecordRemoved(@NonNull StartingWindowRecord record, int taskId) {
            final StartingWindowRecord currentRecord = mStartingWindowRecords.get(taskId);
            if (currentRecord == record) {
                mStartingWindowRecords.remove(taskId);
            }
        }

        StartingWindowRecord getRecord(int taskId) {
            return mStartingWindowRecords.get(taskId);