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

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

Merge "Remove task snapshot once the task is move to front." into main

parents 116ad772 1272e67d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -539,7 +539,7 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
        if (usf != null) {
            mUserSavedFiles.get(userId).remove(code);
            mSavedFilesInOrder.remove(usf);
            mPersister.removeSnap(code, userId);
            mPersister.removeSnapshot(code, userId);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class BaseAppSnapshotPersister {
     * @param id The id of task that has been removed.
     * @param userId The id of the user the task belonged to.
     */
    void removeSnap(int id, int userId) {
    void removeSnapshot(int id, int userId) {
        synchronized (mLock) {
            mSnapshotPersistQueue.sendToQueueLocked(mSnapshotPersistQueue
                    .createDeleteWriteQueueItem(id, userId, mPersistInfoProvider));
+13 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT;

import android.os.Trace;
import android.view.WindowManager;
import android.window.TaskSnapshot;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -126,6 +127,18 @@ class SnapshotController {
        }
        mActivitySnapshotController.handleTransitionFinish(windows);
        mActivitySnapshotController.endSnapshotProcess();
        // Remove task snapshot if it is visible at the end of transition.
        for (int i = changeInfos.size() - 1; i >= 0; --i) {
            final WindowContainer wc = changeInfos.get(i).mContainer;
            final Task task = wc.asTask();
            if (task != null && wc.isVisibleRequested()) {
                final TaskSnapshot snapshot = mTaskSnapshotController.getSnapshot(task.mTaskId,
                        task.mUserId, false /* restoreFromDisk */, false /* isLowResolution */);
                if (snapshot != null) {
                    mTaskSnapshotController.removeAndDeleteSnapshot(task.mTaskId, task.mUserId);
                }
            }
        }
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
    }

+1 −1
Original line number Diff line number Diff line
@@ -1333,7 +1333,7 @@ class Task extends TaskFragment {

        clearRootProcess();

        mAtmService.mWindowManager.mTaskSnapshotController.notifyTaskRemovedFromRecents(
        mAtmService.mWindowManager.mTaskSnapshotController.removeAndDeleteSnapshot(
                mTaskId, mUserId);
    }

+2 −2
Original line number Diff line number Diff line
@@ -284,9 +284,9 @@ class TaskSnapshotController extends AbsAppSnapshotController<Task, TaskSnapshot
        }
    }

    void notifyTaskRemovedFromRecents(int taskId, int userId) {
    void removeAndDeleteSnapshot(int taskId, int userId) {
        mCache.onIdRemoved(taskId);
        mPersister.onTaskRemovedFromRecents(taskId, userId);
        mPersister.removeSnapshot(taskId, userId);
    }

    void removeSnapshotCache(int taskId) {
Loading