diff options
author | Kevin <kevhan@google.com> | 2019-05-10 11:04:08 -0700 |
---|---|---|
committer | Kevin <kevhan@google.com> | 2019-05-13 12:06:10 -0700 |
commit | 8bab8fa3911e7a6a919e37be70388f3a517ce3f2 (patch) | |
tree | c7287025545f5232e7c81de6e469e8a8b7988c97 /go/quickstep/src | |
parent | 8f1ac1efeb5862dcabc1382755232f74ad207012 (diff) | |
download | android_packages_apps_Trebuchet-8bab8fa3911e7a6a919e37be70388f3a517ce3f2.tar.gz android_packages_apps_Trebuchet-8bab8fa3911e7a6a919e37be70388f3a517ce3f2.tar.bz2 android_packages_apps_Trebuchet-8bab8fa3911e7a6a919e37be70388f3a517ce3f2.zip |
Fallback recents should wait for remote anim ready
Hook into the remote animation API on the recents view for the
fallback recents code path. This ensures the views are attached before
attempting the layout animation.
Bug: 132112131
Test: Set separate default launcher, go to recents from app, views
animate correctly
Change-Id: Id73f18e5f864e1970f954c7ec633e25e466d832e
Diffstat (limited to 'go/quickstep/src')
-rw-r--r-- | go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java index c03222db1..64ee1a9f4 100644 --- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -15,6 +15,7 @@ */ package com.android.quickstep; +import static com.android.launcher3.Utilities.postAsyncCallback; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.quickstep.views.IconRecentsView.REMOTE_APP_TO_OVERVIEW_DURATION; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; @@ -22,12 +23,17 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MOD import android.animation.AnimatorSet; import android.animation.ValueAnimator; +import android.app.ActivityOptions; +import android.os.Handler; import android.util.Log; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.LauncherAnimationRunner; import com.android.quickstep.util.RemoteAnimationProvider; import com.android.quickstep.util.RemoteAnimationTargetSet; import com.android.quickstep.views.IconRecentsView; +import com.android.systemui.shared.system.ActivityOptionsCompat; +import com.android.systemui.shared.system.RemoteAnimationAdapterCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** @@ -139,6 +145,29 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple return anim; } + @Override + public ActivityOptions toActivityOptions(Handler handler, long duration) { + LauncherAnimationRunner runner = new LauncherAnimationRunner(handler, + false /* startAtFrontOfQueue */) { + + @Override + public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats, + AnimationResult result) { + IconRecentsView recentsView = mRecentsView; + if (!recentsView.isReadyForRemoteAnim()) { + recentsView.setOnReadyForRemoteAnimCallback(() -> postAsyncCallback(handler, + () -> onCreateAnimation(targetCompats, result)) + ); + return; + } + result.setAnimation(createWindowAnimation(targetCompats)); + } + }; + return ActivityOptionsCompat.makeRemoteAnimation( + new RemoteAnimationAdapterCompat(runner, duration, + 0 /* statusBarTransitionDelay */)); + } + /** * Get duration of animation from app to overview. * |