Loading core/java/android/app/IActivityTaskManager.aidl +8 −1 Original line number Diff line number Diff line Loading @@ -261,6 +261,9 @@ interface IActivityTaskManager { void cancelTaskWindowTransition(int taskId); /** * Fetches the snapshot for the task with the given id, taking a new snapshot if it is not in * the task snapshot cache and it is requested. * * @param taskId the id of the task to retrieve the sAutoapshots for * @param isLowResolution if set, if the snapshot needs to be loaded from disk, this will load * a reduced resolution of it, which is much faster Loading @@ -272,10 +275,14 @@ interface IActivityTaskManager { int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded); /** * Requests for a new snapshot to be taken for the task with the given id, storing it in the * 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 * @return a graphic buffer representing a screenshot of a task */ android.window.TaskSnapshot takeTaskSnapshot(int taskId); android.window.TaskSnapshot takeTaskSnapshot(int taskId, boolean updateCache); /** * Return the user id of last resumed activity. Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +3 −2 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { try { for (int i = 0; i < mPausingTasks.size(); ++i) { snapshots[i] = ActivityTaskManager.getService().takeTaskSnapshot( mPausingTasks.get(0).mTaskInfo.taskId); mPausingTasks.get(0).mTaskInfo.taskId, false /* updateCache */); } } catch (RemoteException e) { taskIds = null; Loading Loading @@ -671,7 +671,8 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { try { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "[%d] RecentsController.screenshotTask: taskId=%d", mInstanceId, taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId, true /* updateCache */); } catch (RemoteException e) { Slog.e(TAG, "Failed to screenshot task", e); } Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +2 −1 Original line number Diff line number Diff line Loading @@ -352,7 +352,8 @@ public class RemoteTransitionCompat { @Override public TaskSnapshot screenshotTask(int taskId) { try { return ActivityTaskManager.getService().takeTaskSnapshot(taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId, true /* updateCache */); } catch (RemoteException e) { Log.e(TAG, "Failed to screenshot task", e); } Loading packages/SystemUI/src/com/android/systemui/screenshot/ImageCaptureImpl.kt +3 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,9 @@ open class ImageCaptureImpl @Inject constructor( } override suspend fun captureTask(taskId: Int): Bitmap? { val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId) } ?: return null val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId, false /* updateCache */) } ?: return null return Bitmap.wrapHardwareBuffer(snapshot.hardwareBuffer, snapshot.colorSpace) } } services/core/java/com/android/server/wm/ActivityTaskManagerService.java +9 −4 Original line number Diff line number Diff line Loading @@ -3789,7 +3789,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId); taskSnapshot = takeTaskSnapshot(taskId, false /* updateCache */); } return taskSnapshot; } finally { Loading @@ -3798,7 +3798,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot takeTaskSnapshot(int taskId) { public TaskSnapshot takeTaskSnapshot(int taskId, boolean updateCache) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "takeTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3809,8 +3809,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Slog.w(TAG, "takeTaskSnapshot: taskId=" + taskId + " not found or not visible"); return null; } return mWindowManager.mTaskSnapshotController.captureSnapshot( task, true /* snapshotHome */); if (updateCache) { return mWindowManager.mTaskSnapshotController.recordSnapshot(task, true /* snapshotHome */); } else { return mWindowManager.mTaskSnapshotController.captureSnapshot(task, true /* snapshotHome */); } } } finally { Binder.restoreCallingIdentity(ident); Loading Loading
core/java/android/app/IActivityTaskManager.aidl +8 −1 Original line number Diff line number Diff line Loading @@ -261,6 +261,9 @@ interface IActivityTaskManager { void cancelTaskWindowTransition(int taskId); /** * Fetches the snapshot for the task with the given id, taking a new snapshot if it is not in * the task snapshot cache and it is requested. * * @param taskId the id of the task to retrieve the sAutoapshots for * @param isLowResolution if set, if the snapshot needs to be loaded from disk, this will load * a reduced resolution of it, which is much faster Loading @@ -272,10 +275,14 @@ interface IActivityTaskManager { int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded); /** * Requests for a new snapshot to be taken for the task with the given id, storing it in the * 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 * @return a graphic buffer representing a screenshot of a task */ android.window.TaskSnapshot takeTaskSnapshot(int taskId); android.window.TaskSnapshot takeTaskSnapshot(int taskId, boolean updateCache); /** * Return the user id of last resumed activity. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +3 −2 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { try { for (int i = 0; i < mPausingTasks.size(); ++i) { snapshots[i] = ActivityTaskManager.getService().takeTaskSnapshot( mPausingTasks.get(0).mTaskInfo.taskId); mPausingTasks.get(0).mTaskInfo.taskId, false /* updateCache */); } } catch (RemoteException e) { taskIds = null; Loading Loading @@ -671,7 +671,8 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { try { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "[%d] RecentsController.screenshotTask: taskId=%d", mInstanceId, taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId, true /* updateCache */); } catch (RemoteException e) { Slog.e(TAG, "Failed to screenshot task", e); } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +2 −1 Original line number Diff line number Diff line Loading @@ -352,7 +352,8 @@ public class RemoteTransitionCompat { @Override public TaskSnapshot screenshotTask(int taskId) { try { return ActivityTaskManager.getService().takeTaskSnapshot(taskId); return ActivityTaskManager.getService().takeTaskSnapshot(taskId, true /* updateCache */); } catch (RemoteException e) { Log.e(TAG, "Failed to screenshot task", e); } Loading
packages/SystemUI/src/com/android/systemui/screenshot/ImageCaptureImpl.kt +3 −1 Original line number Diff line number Diff line Loading @@ -48,7 +48,9 @@ open class ImageCaptureImpl @Inject constructor( } override suspend fun captureTask(taskId: Int): Bitmap? { val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId) } ?: return null val snapshot = withContext(bgContext) { atmService.takeTaskSnapshot(taskId, false /* updateCache */) } ?: return null return Bitmap.wrapHardwareBuffer(snapshot.hardwareBuffer, snapshot.colorSpace) } }
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +9 −4 Original line number Diff line number Diff line Loading @@ -3789,7 +3789,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId); taskSnapshot = takeTaskSnapshot(taskId, false /* updateCache */); } return taskSnapshot; } finally { Loading @@ -3798,7 +3798,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot takeTaskSnapshot(int taskId) { public TaskSnapshot takeTaskSnapshot(int taskId, boolean updateCache) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "takeTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3809,8 +3809,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Slog.w(TAG, "takeTaskSnapshot: taskId=" + taskId + " not found or not visible"); return null; } return mWindowManager.mTaskSnapshotController.captureSnapshot( task, true /* snapshotHome */); if (updateCache) { return mWindowManager.mTaskSnapshotController.recordSnapshot(task, true /* snapshotHome */); } else { return mWindowManager.mTaskSnapshotController.captureSnapshot(task, true /* snapshotHome */); } } } finally { Binder.restoreCallingIdentity(ident); Loading