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
This commit is contained in:
Kevin 2019-05-10 11:04:08 -07:00
parent 8f1ac1efeb
commit 8bab8fa391
1 changed files with 29 additions and 0 deletions

View File

@ -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.
*