Loading core/java/android/app/IActivityTaskManager.aidl +1 −3 Original line number Diff line number Diff line Loading @@ -259,12 +259,10 @@ 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, boolean takeSnapshotIfNeeded); int taskId, boolean isLowResolution); /** * Requests for a new snapshot to be taken for the task with the given id, storing it in the Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipUtils.kt +1 −3 Original line number Diff line number Diff line Loading @@ -129,9 +129,7 @@ object PipUtils { @JvmStatic fun getTaskSnapshot(taskId: Int, isLowResolution: Boolean): TaskSnapshot? { return if (taskId <= 0) null else try { ActivityTaskManager.getService().getTaskSnapshot( taskId, isLowResolution, false /* takeSnapshotIfNeeded */ ) ActivityTaskManager.getService().getTaskSnapshot(taskId, isLowResolution) } catch (e: RemoteException) { Log.e(TAG, "Failed to get task snapshot, taskId=$taskId", e) null Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +2 −4 Original line number Diff line number Diff line Loading @@ -137,14 +137,12 @@ public class ActivityManagerWrapper { } /** * @return a {@link ThumbnailData} with {@link TaskSnapshot} for the given {@param taskId}. * The snapshot will be triggered if no cached {@link TaskSnapshot} exists. * @return the task snapshot for the given {@param taskId}. */ public @NonNull ThumbnailData getTaskThumbnail(int taskId, boolean isLowResolution) { TaskSnapshot snapshot = null; try { snapshot = getService().getTaskSnapshot(taskId, isLowResolution, true /* takeSnapshotIfNeeded */); snapshot = getService().getTaskSnapshot(taskId, isLowResolution); } catch (RemoteException e) { Log.w(TAG, "Failed to retrieve task snapshot", e); } Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +4 −9 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import static android.view.WindowManager.TRANSIT_PIP; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_DREAM; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS; Loading Loading @@ -3825,8 +3826,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded) { public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "getTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3840,12 +3840,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } // Don't call this while holding the lock as this operation might hit the disk. TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, return mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId, false /* updateCache */); } return taskSnapshot; } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -7064,8 +7060,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public TaskSnapshot getTaskSnapshotBlocking( int taskId, boolean isLowResolution) { return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution, false /* takeSnapshotIfNeeded */); return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution); } @Override Loading services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -1444,7 +1444,7 @@ public class RecentTasksTest extends WindowTestsBase { }); assertSecurityException(expectCallable, () -> mAtm.startActivityFromRecents(0, new Bundle())); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true, false)); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true)); assertSecurityException(expectCallable, () -> mAtm.registerTaskStackListener(null)); assertSecurityException(expectCallable, () -> mAtm.unregisterTaskStackListener(null)); Loading Loading
core/java/android/app/IActivityTaskManager.aidl +1 −3 Original line number Diff line number Diff line Loading @@ -259,12 +259,10 @@ 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, boolean takeSnapshotIfNeeded); int taskId, boolean isLowResolution); /** * Requests for a new snapshot to be taken for the task with the given id, storing it in the Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipUtils.kt +1 −3 Original line number Diff line number Diff line Loading @@ -129,9 +129,7 @@ object PipUtils { @JvmStatic fun getTaskSnapshot(taskId: Int, isLowResolution: Boolean): TaskSnapshot? { return if (taskId <= 0) null else try { ActivityTaskManager.getService().getTaskSnapshot( taskId, isLowResolution, false /* takeSnapshotIfNeeded */ ) ActivityTaskManager.getService().getTaskSnapshot(taskId, isLowResolution) } catch (e: RemoteException) { Log.e(TAG, "Failed to get task snapshot, taskId=$taskId", e) null Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +2 −4 Original line number Diff line number Diff line Loading @@ -137,14 +137,12 @@ public class ActivityManagerWrapper { } /** * @return a {@link ThumbnailData} with {@link TaskSnapshot} for the given {@param taskId}. * The snapshot will be triggered if no cached {@link TaskSnapshot} exists. * @return the task snapshot for the given {@param taskId}. */ public @NonNull ThumbnailData getTaskThumbnail(int taskId, boolean isLowResolution) { TaskSnapshot snapshot = null; try { snapshot = getService().getTaskSnapshot(taskId, isLowResolution, true /* takeSnapshotIfNeeded */); snapshot = getService().getTaskSnapshot(taskId, isLowResolution); } catch (RemoteException e) { Log.w(TAG, "Failed to retrieve task snapshot", e); } Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +4 −9 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import static android.view.WindowManager.TRANSIT_PIP; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_DREAM; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS; Loading Loading @@ -3825,8 +3826,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } @Override public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution, boolean takeSnapshotIfNeeded) { public TaskSnapshot getTaskSnapshot(int taskId, boolean isLowResolution) { mAmInternal.enforceCallingPermission(READ_FRAME_BUFFER, "getTaskSnapshot()"); final long ident = Binder.clearCallingIdentity(); try { Loading @@ -3840,12 +3840,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } // Don't call this while holding the lock as this operation might hit the disk. TaskSnapshot taskSnapshot = mWindowManager.mTaskSnapshotController.getSnapshot(taskId, return mWindowManager.mTaskSnapshotController.getSnapshot(taskId, task.mUserId, true /* restoreFromDisk */, isLowResolution); if (taskSnapshot == null && takeSnapshotIfNeeded) { taskSnapshot = takeTaskSnapshot(taskId, false /* updateCache */); } return taskSnapshot; } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -7064,8 +7060,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public TaskSnapshot getTaskSnapshotBlocking( int taskId, boolean isLowResolution) { return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution, false /* takeSnapshotIfNeeded */); return ActivityTaskManagerService.this.getTaskSnapshot(taskId, isLowResolution); } @Override Loading
services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -1444,7 +1444,7 @@ public class RecentTasksTest extends WindowTestsBase { }); assertSecurityException(expectCallable, () -> mAtm.startActivityFromRecents(0, new Bundle())); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true, false)); assertSecurityException(expectCallable, () -> mAtm.getTaskSnapshot(0, true)); assertSecurityException(expectCallable, () -> mAtm.registerTaskStackListener(null)); assertSecurityException(expectCallable, () -> mAtm.unregisterTaskStackListener(null)); Loading