From 192f662963916ae437d8a06b2c3d3514b8fcdf41 Mon Sep 17 00:00:00 2001 From: Issei Suzuki Date: Thu, 4 Feb 2021 14:23:42 +0100 Subject: [PATCH] Make keyguard exit animation to remote animation. The change is disabled by default. To enable remote animation, one needs to set a property and to restart the WMS. % adb root % adb shell setprop persist.wm.enable_remote_keyguard_animation 1 % adb reboot Test: Existing tests pass. Bug: 175686676 Bug: 179122467 Exempt-From-Owner-Approval: The owner already gave +2 on the exactly same CL. Change-Id: I3054ce4bbb296f09ab8bc12595f2ad17b32db7b4 --- .../launcher3/LauncherAnimationRunner.java | 26 +++++++++++++++---- .../QuickstepAppTransitionManagerImpl.java | 11 +++++--- .../launcher3/WrappedAnimationRunnerImpl.java | 4 ++- .../WrappedLauncherAnimationRunner.java | 10 ++++--- .../android/quickstep/RecentsActivity.java | 7 +++-- .../util/RemoteAnimationProvider.java | 7 +++-- 6 files changed, 49 insertions(+), 16 deletions(-) diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java index 034d51ff38..588d676ac7 100644 --- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java @@ -56,17 +56,22 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo return mHandler; } - // Called only in R+ platform + // Called only in S+ platform @BinderThread - public void onAnimationStart(RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, Runnable runnable) { + public void onAnimationStart( + int transit, + RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, + Runnable runnable) { Runnable r = () -> { finishExistingAnimation(); mAnimationResult = new AnimationResult(() -> { UI_HELPER_EXECUTOR.execute(runnable); mAnimationResult = null; }); - onCreateAnimation(appTargets, wallpaperTargets, mAnimationResult); + onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets, + mAnimationResult); }; if (mStartAtFrontOfQueue) { postAtFrontOfQueueAsynchronously(mHandler, r); @@ -75,6 +80,14 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo } } + // Called only in R platform + @BinderThread + public void onAnimationStart(RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, Runnable runnable) { + onAnimationStart(0 /* transit */, appTargets, wallpaperTargets, + new RemoteAnimationTargetCompat[0], runnable); + } + // Called only in Q platform @BinderThread @Deprecated @@ -88,8 +101,11 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo */ @UiThread public abstract void onCreateAnimation( + int transit, RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result); + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, + AnimationResult result); @UiThread private void finishExistingAnimation() { diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index 876cabc61b..c4b696157c 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -866,8 +866,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans } @Override - public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, + public void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, LauncherAnimationRunner.AnimationResult result) { if (mLauncher.isDestroyed()) { AnimatorSet anim = new AnimatorSet(); @@ -880,7 +882,8 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans // If launcher is not resumed, wait until new async-frame after resume mLauncher.addOnResumeCallback(() -> postAsyncCallback(mHandler, () -> - onCreateAnimation(appTargets, wallpaperTargets, result))); + onCreateAnimation(transit, appTargets, wallpaperTargets, + nonAppTargets, result))); return; } @@ -964,8 +967,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans } @Override - public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, + public void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, LauncherAnimationRunner.AnimationResult result) { AnimatorSet anim = new AnimatorSet(); diff --git a/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java b/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java index da2aee4386..03cc28e49b 100644 --- a/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java +++ b/quickstep/src/com/android/launcher3/WrappedAnimationRunnerImpl.java @@ -26,7 +26,9 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; */ public interface WrappedAnimationRunnerImpl { Handler getHandler(); - void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, + void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, LauncherAnimationRunner.AnimationResult result); } diff --git a/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java index 1753b62ca3..1e1631bed9 100644 --- a/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/WrappedLauncherAnimationRunner.java @@ -46,11 +46,15 @@ public class WrappedLauncherAnimationRunner { } @Override - public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) { + public void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonAppTargets, + AnimationResult result) { AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, wallpaperTargets); anim.addListener(resetStateListener()); diff --git a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java index 19c6588877..3adb459aeb 100644 --- a/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java +++ b/quickstep/src/com/android/quickstep/util/RemoteAnimationProvider.java @@ -43,8 +43,11 @@ public abstract class RemoteAnimationProvider { } @Override - public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, - RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) { + public void onCreateAnimation(int transit, + RemoteAnimationTargetCompat[] appTargets, + RemoteAnimationTargetCompat[] wallpaperTargets, + RemoteAnimationTargetCompat[] nonApps, + AnimationResult result) { result.setAnimation(createWindowAnimation(appTargets, wallpaperTargets), context); } };