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

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

Merge "Add a reference to the snapshot when calling takeTaskSnapshot." into main

parents a95e6b12 62764dfa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4125,8 +4125,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                // be retrieved by recents. While if updateCache is false, the real snapshot will
                // always be taken and the snapshot won't be put into SnapshotPersister.
                if (updateCache) {
                    supplier = mWindowManager.mTaskSnapshotController
                            .getRecordSnapshotSupplier(task);
                    supplier = mWindowManager.mTaskSnapshotController.getRecordSnapshotSupplier(
                            task, TaskSnapshot.REFERENCE_WRITE_TO_PARCEL);
                } else {
                    return mWindowManager.mTaskSnapshotController.snapshot(task);
                }
+9 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.wm;

import static android.window.TaskSnapshot.REFERENCE_NONE;

import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_SCREENSHOT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;

@@ -134,7 +136,7 @@ class TaskSnapshotController extends AbsAppSnapshotController<Task, TaskSnapshot
        if (shouldDisableSnapshots()) {
            return;
        }
        final SnapshotSupplier supplier = getRecordSnapshotSupplier(task);
        final SnapshotSupplier supplier = getRecordSnapshotSupplier(task, REFERENCE_NONE);
        if (supplier == null) {
            return;
        }
@@ -152,8 +154,12 @@ class TaskSnapshotController extends AbsAppSnapshotController<Task, TaskSnapshot
     * {@link AbsAppSnapshotController.SnapshotSupplier#handleSnapshot} to complete the entire
     * record request.
     */
    SnapshotSupplier getRecordSnapshotSupplier(Task task) {
    SnapshotSupplier getRecordSnapshotSupplier(Task task,
            @TaskSnapshot.ReferenceFlags int initialUsage) {
        return recordSnapshotInner(task, true /* allowAppTheme */, snapshot -> {
            if (initialUsage != REFERENCE_NONE) {
                snapshot.addReference(initialUsage);
            }
            if (!task.isActivityTypeHome()) {
                mPersister.persistSnapshot(task.mTaskId, task.mUserId, snapshot);
                task.onSnapshotChanged(snapshot);
@@ -166,7 +172,7 @@ class TaskSnapshotController extends AbsAppSnapshotController<Task, TaskSnapshot
     */
    @Nullable
    TaskSnapshot getSnapshot(int taskId, boolean isLowResolution) {
        return getSnapshot(taskId, false /* isLowResolution */, TaskSnapshot.REFERENCE_NONE);
        return getSnapshot(taskId, false /* isLowResolution */, REFERENCE_NONE);
    }

    /**