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

Commit 0760a96c authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Capture real snapshot of task for non cache case

The caller should be responsible to use the snapshot for proper cases.
E.g. one time animation.

For the caller related to recents app list, they are using
updateCache=true, so the standard snapshot policy (exclude secure
or disable-recent) is still followed.

Fix: 308881017
Fix: 309111443
Test: Invoke takeTaskSnapshot for a task with an activity
      uses setRecentsScreenshotEnabled(false)
Change-Id: I1410e64485755428f7431a1529a3d5e385c48796
parent f4356a7a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -269,7 +269,10 @@ interface IActivityTaskManager {
     * task snapshot cache only if requested.
     *
     * @param taskId the id of the task to take a snapshot of
     * @param updateCache whether to store the new snapshot in the system's task snapshot cache
     * @param updateCache Whether to store the new snapshot in the system's task snapshot cache.
     *                    If it is true, the snapshot can be either real content or app-theme mode
     *                    depending on the attributes of app. Otherwise, the snapshot will be taken
     *                    with real content.
     * @return a graphic buffer representing a screenshot of a task
     */
    android.window.TaskSnapshot takeTaskSnapshot(int taskId, boolean updateCache);
+5 −1
Original line number Diff line number Diff line
@@ -3859,10 +3859,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    Slog.w(TAG, "takeTaskSnapshot: taskId=" + taskId + " not found or not visible");
                    return null;
                }
                // Note that if updateCache is true, ActivityRecord#shouldUseAppThemeSnapshot will
                // be used to decide whether the task is allowed to be captured because that may
                // 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) {
                    return mWindowManager.mTaskSnapshotController.recordSnapshot(task);
                } else {
                    return mWindowManager.mTaskSnapshotController.captureSnapshot(task);
                    return mWindowManager.mTaskSnapshotController.snapshot(task);
                }
            }
        } finally {