Loading apct-tests/perftests/core/src/android/wm/RecentsAnimationPerfTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.hamcrest.core.AnyOf.anyOf; import static org.hamcrest.core.Is.is; import android.app.Activity; import android.app.ActivityManager.TaskSnapshot; import android.app.ActivityTaskManager; import android.app.IActivityTaskManager; import android.content.ComponentName; Loading Loading @@ -216,7 +217,7 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase { } @Override public void onAnimationCanceled(boolean deferredWithScreenshot) throws RemoteException { public void onAnimationCanceled(TaskSnapshot taskSnapshot) throws RemoteException { Assume.assumeNoException( new AssertionError("onAnimationCanceled should not be called")); } Loading core/java/android/view/IRecentsAnimationRunner.aidl +7 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.app.ActivityManager; import android.graphics.Rect; import android.view.RemoteAnimationTarget; import android.view.IRecentsAnimationController; Loading @@ -33,16 +34,16 @@ oneway interface IRecentsAnimationRunner { * wallpaper not drawing in time, or the handler not finishing the animation within a predefined * amount of time. * * @param deferredWithScreenshot If set to {@code true}, the contents of the task will be * replaced with a screenshot, such that the runner's leash is * still active. As soon as the runner doesn't need the leash * anymore, it must call * {@link IRecentsAnimationController#cleanupScreenshot). * @param taskSnapshot If the snapshot is null, the animation will be cancelled and the leash * will be inactive immediately. Otherwise, the contents of the task will be * replaced with {@param taskSnapshot}, such that the runner's leash is * still active. As soon as the runner doesn't need the leash anymore, it * must call {@link IRecentsAnimationController#cleanupScreenshot). * * @see {@link RecentsAnimationController#cleanupScreenshot} */ @UnsupportedAppUsage void onAnimationCanceled(boolean deferredWithScreenshot) = 1; void onAnimationCanceled(in @nullable ActivityManager.TaskSnapshot taskSnapshot) = 1; /** * Called when the system is ready for the handler to start animating all the visible tasks. Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +3 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.annotation.NonNull; import android.app.ActivityManager; import android.app.ActivityManager.RecentTaskInfo; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.TaskSnapshot; import android.app.ActivityOptions; import android.app.ActivityTaskManager; import android.app.AppGlobals; Loading Loading @@ -235,9 +236,9 @@ public class ActivityManagerWrapper { } @Override public void onAnimationCanceled(boolean deferredWithScreenshot) { public void onAnimationCanceled(TaskSnapshot taskSnapshot) { animationHandler.onAnimationCanceled( deferredWithScreenshot ? new ThumbnailData() : null); taskSnapshot != null ? new ThumbnailData(taskSnapshot) : null); } }; } Loading services/core/java/com/android/server/wm/RecentsAnimation.java +1 −1 Original line number Diff line number Diff line Loading @@ -460,7 +460,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, */ static void notifyAnimationCancelBeforeStart(IRecentsAnimationRunner recentsAnimationRunner) { try { recentsAnimationRunner.onAnimationCanceled(false /* deferredWithScreenshot */); recentsAnimationRunner.onAnimationCanceled(null /* taskSnapshot */); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation before start", e); } Loading services/core/java/com/android/server/wm/RecentsAnimationController.java +35 −18 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_OPENING; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static com.android.server.wm.AnimationAdapterProto.REMOTE; Loading Loading @@ -525,18 +525,23 @@ public class RecentsAnimationController implements DeathRecipient { // Screen shot previous task when next task starts transition and notify the runner. // We will actually finish the animation once the runner calls cleanUpScreenshot(). final Task task = mPendingAnimations.get(0).mTask; screenshotRecentTask(task, reorderMode, runSynchronously); final TaskSnapshot taskSnapshot = screenshotRecentTask(task, reorderMode, runSynchronously); try { mRunner.onAnimationCanceled(true /* deferredWithScreenshot */); mRunner.onAnimationCanceled(taskSnapshot); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation", e); } if (taskSnapshot == null) { mCallbacks.onAnimationFinished(reorderMode, runSynchronously, false /* sendUserLeaveHint */); } } else { // Otherwise, notify the runner and clean up the animation immediately // Note: In the fallback case, this can trigger multiple onAnimationCancel() calls // to the runner if we this actually triggers cancel twice on the caller try { mRunner.onAnimationCanceled(false /* deferredWithScreenshot */); mRunner.onAnimationCanceled(null /* taskSnapshot */); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation", e); } Loading Loading @@ -587,9 +592,21 @@ public class RecentsAnimationController implements DeathRecipient { return mRequestDeferCancelUntilNextTransition && mCancelDeferredWithScreenshot; } void screenshotRecentTask(Task task, @ReorderMode int reorderMode, boolean runSynchronously) { final TaskScreenshotAnimatable animatable = TaskScreenshotAnimatable.create(task); if (animatable != null) { TaskSnapshot screenshotRecentTask(Task task, @ReorderMode int reorderMode, boolean runSynchronously) { final TaskSnapshotController snapshotController = mService.mTaskSnapshotController; final ArraySet<Task> tasks = Sets.newArraySet(task); snapshotController.snapshotTasks(tasks); snapshotController.addSkipClosingAppSnapshotTasks(tasks); final TaskSnapshot taskSnapshot = snapshotController.getSnapshot(task.mTaskId, task.mUserId, false /* restoreFromDisk */, false /* reducedResolution */); if (taskSnapshot == null) { return null; } final TaskScreenshotAnimatable animatable = new TaskScreenshotAnimatable(task, new SurfaceControl.ScreenshotGraphicBuffer(taskSnapshot.getSnapshot(), taskSnapshot.getColorSpace(), false /* containsSecureLayers */)); mRecentScreenshotAnimator = new SurfaceAnimator( animatable, () -> { Loading @@ -600,7 +617,7 @@ public class RecentsAnimationController implements DeathRecipient { false /* sendUserLeaveHint */); }, mService); mRecentScreenshotAnimator.transferAnimation(task.mSurfaceAnimator); } return taskSnapshot; } void cleanupAnimation(@ReorderMode int reorderMode) { Loading Loading
apct-tests/perftests/core/src/android/wm/RecentsAnimationPerfTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.hamcrest.core.AnyOf.anyOf; import static org.hamcrest.core.Is.is; import android.app.Activity; import android.app.ActivityManager.TaskSnapshot; import android.app.ActivityTaskManager; import android.app.IActivityTaskManager; import android.content.ComponentName; Loading Loading @@ -216,7 +217,7 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase { } @Override public void onAnimationCanceled(boolean deferredWithScreenshot) throws RemoteException { public void onAnimationCanceled(TaskSnapshot taskSnapshot) throws RemoteException { Assume.assumeNoException( new AssertionError("onAnimationCanceled should not be called")); } Loading
core/java/android/view/IRecentsAnimationRunner.aidl +7 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.app.ActivityManager; import android.graphics.Rect; import android.view.RemoteAnimationTarget; import android.view.IRecentsAnimationController; Loading @@ -33,16 +34,16 @@ oneway interface IRecentsAnimationRunner { * wallpaper not drawing in time, or the handler not finishing the animation within a predefined * amount of time. * * @param deferredWithScreenshot If set to {@code true}, the contents of the task will be * replaced with a screenshot, such that the runner's leash is * still active. As soon as the runner doesn't need the leash * anymore, it must call * {@link IRecentsAnimationController#cleanupScreenshot). * @param taskSnapshot If the snapshot is null, the animation will be cancelled and the leash * will be inactive immediately. Otherwise, the contents of the task will be * replaced with {@param taskSnapshot}, such that the runner's leash is * still active. As soon as the runner doesn't need the leash anymore, it * must call {@link IRecentsAnimationController#cleanupScreenshot). * * @see {@link RecentsAnimationController#cleanupScreenshot} */ @UnsupportedAppUsage void onAnimationCanceled(boolean deferredWithScreenshot) = 1; void onAnimationCanceled(in @nullable ActivityManager.TaskSnapshot taskSnapshot) = 1; /** * Called when the system is ready for the handler to start animating all the visible tasks. Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityManagerWrapper.java +3 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.annotation.NonNull; import android.app.ActivityManager; import android.app.ActivityManager.RecentTaskInfo; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.TaskSnapshot; import android.app.ActivityOptions; import android.app.ActivityTaskManager; import android.app.AppGlobals; Loading Loading @@ -235,9 +236,9 @@ public class ActivityManagerWrapper { } @Override public void onAnimationCanceled(boolean deferredWithScreenshot) { public void onAnimationCanceled(TaskSnapshot taskSnapshot) { animationHandler.onAnimationCanceled( deferredWithScreenshot ? new ThumbnailData() : null); taskSnapshot != null ? new ThumbnailData(taskSnapshot) : null); } }; } Loading
services/core/java/com/android/server/wm/RecentsAnimation.java +1 −1 Original line number Diff line number Diff line Loading @@ -460,7 +460,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, */ static void notifyAnimationCancelBeforeStart(IRecentsAnimationRunner recentsAnimationRunner) { try { recentsAnimationRunner.onAnimationCanceled(false /* deferredWithScreenshot */); recentsAnimationRunner.onAnimationCanceled(null /* taskSnapshot */); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation before start", e); } Loading
services/core/java/com/android/server/wm/RecentsAnimationController.java +35 −18 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ import static android.view.RemoteAnimationTarget.MODE_CLOSING; import static android.view.RemoteAnimationTarget.MODE_OPENING; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static com.android.server.wm.AnimationAdapterProto.REMOTE; Loading Loading @@ -525,18 +525,23 @@ public class RecentsAnimationController implements DeathRecipient { // Screen shot previous task when next task starts transition and notify the runner. // We will actually finish the animation once the runner calls cleanUpScreenshot(). final Task task = mPendingAnimations.get(0).mTask; screenshotRecentTask(task, reorderMode, runSynchronously); final TaskSnapshot taskSnapshot = screenshotRecentTask(task, reorderMode, runSynchronously); try { mRunner.onAnimationCanceled(true /* deferredWithScreenshot */); mRunner.onAnimationCanceled(taskSnapshot); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation", e); } if (taskSnapshot == null) { mCallbacks.onAnimationFinished(reorderMode, runSynchronously, false /* sendUserLeaveHint */); } } else { // Otherwise, notify the runner and clean up the animation immediately // Note: In the fallback case, this can trigger multiple onAnimationCancel() calls // to the runner if we this actually triggers cancel twice on the caller try { mRunner.onAnimationCanceled(false /* deferredWithScreenshot */); mRunner.onAnimationCanceled(null /* taskSnapshot */); } catch (RemoteException e) { Slog.e(TAG, "Failed to cancel recents animation", e); } Loading Loading @@ -587,9 +592,21 @@ public class RecentsAnimationController implements DeathRecipient { return mRequestDeferCancelUntilNextTransition && mCancelDeferredWithScreenshot; } void screenshotRecentTask(Task task, @ReorderMode int reorderMode, boolean runSynchronously) { final TaskScreenshotAnimatable animatable = TaskScreenshotAnimatable.create(task); if (animatable != null) { TaskSnapshot screenshotRecentTask(Task task, @ReorderMode int reorderMode, boolean runSynchronously) { final TaskSnapshotController snapshotController = mService.mTaskSnapshotController; final ArraySet<Task> tasks = Sets.newArraySet(task); snapshotController.snapshotTasks(tasks); snapshotController.addSkipClosingAppSnapshotTasks(tasks); final TaskSnapshot taskSnapshot = snapshotController.getSnapshot(task.mTaskId, task.mUserId, false /* restoreFromDisk */, false /* reducedResolution */); if (taskSnapshot == null) { return null; } final TaskScreenshotAnimatable animatable = new TaskScreenshotAnimatable(task, new SurfaceControl.ScreenshotGraphicBuffer(taskSnapshot.getSnapshot(), taskSnapshot.getColorSpace(), false /* containsSecureLayers */)); mRecentScreenshotAnimator = new SurfaceAnimator( animatable, () -> { Loading @@ -600,7 +617,7 @@ public class RecentsAnimationController implements DeathRecipient { false /* sendUserLeaveHint */); }, mService); mRecentScreenshotAnimator.transferAnimation(task.mSurfaceAnimator); } return taskSnapshot; } void cleanupAnimation(@ReorderMode int reorderMode) { Loading