Loading core/java/android/app/IActivityTaskManager.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -263,9 +263,12 @@ interface IActivityTaskManager { * @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 * @param takeSnapshotIfNeeded if set, call {@link #takeTaskSnapshot} to trigger the snapshot if no cache exists. * @return a graphic buffer representing a screenshot of a task */ android.window.TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution); android.window.TaskSnapshot getTaskSnapshot( int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded); /** * @param taskId the id of the task to take a snapshot of Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class PipUtils { if (taskId <= 0) return null; try { return ActivityTaskManager.getService().getTaskSnapshot( taskId, isLowResolution); taskId, isLowResolution, false /* takeSnapshotIfNeeded */); } catch (RemoteException e) { Log.e(TAG, "Failed to get task snapshot, taskId=" + taskId, e); return null; Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +4 −2 Original line number Diff line number Diff line Loading @@ -137,12 +137,14 @@ public class ActivityManagerWrapper { } /** * @return the task snapshot for the given {@param taskId}. * @return a {@link ThumbnailData} with {@link TaskSnapshot} for the given {@param taskId}. * The snapshot will be triggered if no cached {@link TaskSnapshot} exists. */ public @NonNull ThumbnailData getTaskThumbnail(int taskId, boolean isLowResolution) { TaskSnapshot snapshot = null; try { snapshot = getService().getTaskSnapshot(taskId, isLowResolution); snapshot = getService().getTaskSnapshot(taskId, isLowResolution, true /* takeSnapshotIfNeeded */); } catch (RemoteException e) { Log.w(TAG, "Failed to retrieve task snapshot", e); } Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -3660,7 +3660,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution) { public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "getTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3674,8 +3675,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } // Don't call this while holding the lock as this operation might hit the disk. return mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId); } return taskSnapshot; } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -6648,7 +6653,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public TaskSnapshot getTaskSnapshotBlocking( int taskId, boolean isLowResolution) { return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution); return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution, false /* takeSnapshotIfNeeded */); } @Override Loading services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -1332,7 +1332,7 @@ public class RecentTasksTest extends WindowTestsBase { }); assertSecurityException(expectCallable, () -> mAtm.startActivityFromRecents(0, new Bundle())); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true)); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true, false)); assertSecurityException(expectCallable, () -> mAtm.registerTaskStackListener(null)); assertSecurityException(expectCallable, () -> mAtm.unregisterTaskStackListener(null)); Loading Loading
core/java/android/app/IActivityTaskManager.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -263,9 +263,12 @@ interface IActivityTaskManager { * @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 * @param takeSnapshotIfNeeded if set, call {@link #takeTaskSnapshot} to trigger the snapshot if no cache exists. * @return a graphic buffer representing a screenshot of a task */ android.window.TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution); android.window.TaskSnapshot getTaskSnapshot( int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded); /** * @param taskId the id of the task to take a snapshot of Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ public class PipUtils { if (taskId <= 0) return null; try { return ActivityTaskManager.getService().getTaskSnapshot( taskId, isLowResolution); taskId, isLowResolution, false /* takeSnapshotIfNeeded */); } catch (RemoteException e) { Log.e(TAG, "Failed to get task snapshot, taskId=" + taskId, e); return null; Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +4 −2 Original line number Diff line number Diff line Loading @@ -137,12 +137,14 @@ public class ActivityManagerWrapper { } /** * @return the task snapshot for the given {@param taskId}. * @return a {@link ThumbnailData} with {@link TaskSnapshot} for the given {@param taskId}. * The snapshot will be triggered if no cached {@link TaskSnapshot} exists. */ public @NonNull ThumbnailData getTaskThumbnail(int taskId, boolean isLowResolution) { TaskSnapshot snapshot = null; try { snapshot = getService().getTaskSnapshot(taskId, isLowResolution); snapshot = getService().getTaskSnapshot(taskId, isLowResolution, true /* takeSnapshotIfNeeded */); } catch (RemoteException e) { Log.w(TAG, "Failed to retrieve task snapshot", e); } Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +10 −4 Original line number Diff line number Diff line Loading @@ -3660,7 +3660,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution) { public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "getTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3674,8 +3675,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } // Don't call this while holding the lock as this operation might hit the disk. return mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId); } return taskSnapshot; } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -6648,7 +6653,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public TaskSnapshot getTaskSnapshotBlocking( int taskId, boolean isLowResolution) { return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution); return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution, false /* takeSnapshotIfNeeded */); } @Override Loading
services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -1332,7 +1332,7 @@ public class RecentTasksTest extends WindowTestsBase { }); assertSecurityException(expectCallable, () -> mAtm.startActivityFromRecents(0, new Bundle())); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true)); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true, false)); assertSecurityException(expectCallable, () -> mAtm.registerTaskStackListener(null)); assertSecurityException(expectCallable, () -> mAtm.unregisterTaskStackListener(null)); Loading