diff options
| author | 2023-11-09 15:36:31 +0800 | |
|---|---|---|
| committer | 2023-11-09 08:43:13 +0000 | |
| commit | 0760a96c6936bcaf42a64597305ff3e646345c17 (patch) | |
| tree | 7fa0ce9f5168c7b3cf1e5f0479e56ffecdff513e | |
| parent | f4356a7a1a642a8cb4c30cc79e95ade9a0f2d96e (diff) | |
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
| -rw-r--r-- | core/java/android/app/IActivityTaskManager.aidl | 5 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityTaskManagerService.java | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl index 1f8784bf72dd..df6badcffe8e 100644 --- a/core/java/android/app/IActivityTaskManager.aidl +++ b/core/java/android/app/IActivityTaskManager.aidl @@ -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); diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index f462efc00ce6..7a100fceb901 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -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 { |