Loading quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +28 −5 Original line number Diff line number Diff line Loading @@ -28,12 +28,15 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.os.Handler; import android.os.RemoteException; import android.view.IRemoteAnimationFinishedCallback; import android.view.RemoteAnimationTarget; import androidx.annotation.BinderThread; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import com.android.systemui.animation.RemoteAnimationDelegate; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import java.lang.ref.WeakReference; Loading Loading @@ -89,7 +92,7 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { Runnable r = () -> { finishExistingAnimation(); mAnimationResult = new AnimationResult(() -> mAnimationResult = null, runnable); getFactory().onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets, getFactory().onAnimationStart(transit, appTargets, wallpaperTargets, nonAppTargets, mAnimationResult); }; if (mStartAtFrontOfQueue) { Loading Loading @@ -124,7 +127,11 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { }); } public static final class AnimationResult { /** * Used by RemoteAnimationFactory implementations to run the actual animation and its lifecycle * callbacks. */ public static final class AnimationResult extends IRemoteAnimationFinishedCallback.Stub { private final Runnable mSyncFinishRunnable; private final Runnable mASyncFinishRunnable; Loading Loading @@ -199,25 +206,41 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { } } } /** * When used as a simple IRemoteAnimationFinishedCallback, this method is used to run the * animation finished runnable. */ @Override public void onAnimationFinished() throws RemoteException { mASyncFinishRunnable.run(); } } /** * Used with LauncherAnimationRunner as an interface for the runner to call back to the * implementation. */ @FunctionalInterface public interface RemoteAnimationFactory { public interface RemoteAnimationFactory extends RemoteAnimationDelegate<AnimationResult> { /** * Called on the UI thread when the animation targets are received. The implementation must * call {@link AnimationResult#setAnimation} with the target animation to be run. */ void onCreateAnimation(int transit, @Override @UiThread void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, LauncherAnimationRunner.AnimationResult result); @Override @UiThread default void onAnimationCancelled(boolean isKeyguardOccluded) { onAnimationCancelled(); } /** * Called when the animation is cancelled. This can happen with or without * the create being called. Loading quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -1665,7 +1665,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } @Override public void onCreateAnimation(int transit, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, Loading Loading @@ -1707,7 +1707,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } @Override public void onCreateAnimation(int transit, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, Loading quickstep/src/com/android/quickstep/RecentsActivity.java +19 −23 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { mActivityLaunchAnimationRunner = new RemoteAnimationFactory() { @Override public void onCreateAnimation(int transit, RemoteAnimationTarget[] appTargets, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, AnimationResult result) { mHandler.removeCallbacks(mAnimationStartTimeoutRunnable); Loading Loading @@ -407,13 +407,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { } private final RemoteAnimationFactory mAnimationToHomeFactory = new RemoteAnimationFactory() { @Override public void onCreateAnimation(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, AnimationResult result) { AnimatorPlaybackController controller = getStateManager() .createAnimationToNewWorkspace(RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); (transit, appTargets, wallpaperTargets, nonAppTargets, result) -> { AnimatorPlaybackController controller = getStateManager().createAnimationToNewWorkspace( RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); controller.dispatchOnStart(); RemoteAnimationTargets targets = new RemoteAnimationTargets( Loading @@ -427,7 +424,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { result.setAnimation(anim, RecentsActivity.this, () -> getStateManager().goToState(RecentsState.HOME, false), true /* skipFirstFrame */); } }; @Override Loading Loading
quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +28 −5 Original line number Diff line number Diff line Loading @@ -28,12 +28,15 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.os.Handler; import android.os.RemoteException; import android.view.IRemoteAnimationFinishedCallback; import android.view.RemoteAnimationTarget; import androidx.annotation.BinderThread; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import com.android.systemui.animation.RemoteAnimationDelegate; import com.android.systemui.shared.system.RemoteAnimationRunnerCompat; import java.lang.ref.WeakReference; Loading Loading @@ -89,7 +92,7 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { Runnable r = () -> { finishExistingAnimation(); mAnimationResult = new AnimationResult(() -> mAnimationResult = null, runnable); getFactory().onCreateAnimation(transit, appTargets, wallpaperTargets, nonAppTargets, getFactory().onAnimationStart(transit, appTargets, wallpaperTargets, nonAppTargets, mAnimationResult); }; if (mStartAtFrontOfQueue) { Loading Loading @@ -124,7 +127,11 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { }); } public static final class AnimationResult { /** * Used by RemoteAnimationFactory implementations to run the actual animation and its lifecycle * callbacks. */ public static final class AnimationResult extends IRemoteAnimationFinishedCallback.Stub { private final Runnable mSyncFinishRunnable; private final Runnable mASyncFinishRunnable; Loading Loading @@ -199,25 +206,41 @@ public class LauncherAnimationRunner extends RemoteAnimationRunnerCompat { } } } /** * When used as a simple IRemoteAnimationFinishedCallback, this method is used to run the * animation finished runnable. */ @Override public void onAnimationFinished() throws RemoteException { mASyncFinishRunnable.run(); } } /** * Used with LauncherAnimationRunner as an interface for the runner to call back to the * implementation. */ @FunctionalInterface public interface RemoteAnimationFactory { public interface RemoteAnimationFactory extends RemoteAnimationDelegate<AnimationResult> { /** * Called on the UI thread when the animation targets are received. The implementation must * call {@link AnimationResult#setAnimation} with the target animation to be run. */ void onCreateAnimation(int transit, @Override @UiThread void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, LauncherAnimationRunner.AnimationResult result); @Override @UiThread default void onAnimationCancelled(boolean isKeyguardOccluded) { onAnimationCancelled(); } /** * Called when the animation is cancelled. This can happen with or without * the create being called. Loading
quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -1665,7 +1665,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } @Override public void onCreateAnimation(int transit, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, Loading Loading @@ -1707,7 +1707,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } @Override public void onCreateAnimation(int transit, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, Loading
quickstep/src/com/android/quickstep/RecentsActivity.java +19 −23 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { mActivityLaunchAnimationRunner = new RemoteAnimationFactory() { @Override public void onCreateAnimation(int transit, RemoteAnimationTarget[] appTargets, public void onAnimationStart(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, AnimationResult result) { mHandler.removeCallbacks(mAnimationStartTimeoutRunnable); Loading Loading @@ -407,13 +407,10 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { } private final RemoteAnimationFactory mAnimationToHomeFactory = new RemoteAnimationFactory() { @Override public void onCreateAnimation(int transit, RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets, RemoteAnimationTarget[] nonAppTargets, AnimationResult result) { AnimatorPlaybackController controller = getStateManager() .createAnimationToNewWorkspace(RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); (transit, appTargets, wallpaperTargets, nonAppTargets, result) -> { AnimatorPlaybackController controller = getStateManager().createAnimationToNewWorkspace( RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION); controller.dispatchOnStart(); RemoteAnimationTargets targets = new RemoteAnimationTargets( Loading @@ -427,7 +424,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { result.setAnimation(anim, RecentsActivity.this, () -> getStateManager().goToState(RecentsState.HOME, false), true /* skipFirstFrame */); } }; @Override Loading