Merge "Fix logic around launchTask in the live tile case" into ub-launcher3-master

This commit is contained in:
Tracy Zhou 2020-10-01 00:49:14 +00:00 committed by Android (Google) Code Review
commit 8d14dbe041
2 changed files with 8 additions and 19 deletions

View File

@ -2161,7 +2161,12 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
tv.notifyTaskLaunchFailed(TAG); tv.notifyTaskLaunchFailed(TAG);
} }
}; };
tv.launchTask(false, onLaunchResult, getHandler()); if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
finishRecentsAnimation(false /* toRecents */, null);
onLaunchResult.accept(true /* success */);
} else {
tv.launchTask(false, onLaunchResult, getHandler());
}
Task task = tv.getTask(); Task task = tv.getTask();
if (task != null) { if (task != null) {
mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo()) mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo())

View File

@ -217,6 +217,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
} }
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (isRunningTask()) { if (isRunningTask()) {
// TODO: Replace this animation with createRecentsWindowAnimator
createLaunchAnimationForRunningTask().start(); createLaunchAnimationForRunningTask().start();
} else { } else {
launchTask(true /* animate */); launchTask(true /* animate */);
@ -364,10 +365,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
final PendingAnimation pendingAnimation = getRecentsView().createTaskLaunchAnimation( final PendingAnimation pendingAnimation = getRecentsView().createTaskLaunchAnimation(
this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR); this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR);
AnimatorPlaybackController currentAnimation = pendingAnimation.createPlaybackController(); AnimatorPlaybackController currentAnimation = pendingAnimation.createPlaybackController();
currentAnimation.setEndAction(() -> { currentAnimation.setEndAction(() -> pendingAnimation.finish(true));
pendingAnimation.finish(true);
launchTask(false);
});
return currentAnimation; return currentAnimation;
} }
@ -390,20 +388,6 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
public void launchTask(boolean animate, boolean freezeTaskList, Consumer<Boolean> resultCallback, public void launchTask(boolean animate, boolean freezeTaskList, Consumer<Boolean> resultCallback,
Handler resultCallbackHandler) { Handler resultCallbackHandler) {
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (isRunningTask()) {
getRecentsView().finishRecentsAnimation(false /* toRecents */,
() -> resultCallbackHandler.post(() -> resultCallback.accept(true)));
} else {
launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler);
}
} else {
launchTaskInternal(animate, freezeTaskList, resultCallback, resultCallbackHandler);
}
}
private void launchTaskInternal(boolean animate, boolean freezeTaskList,
Consumer<Boolean> resultCallback, Handler resultCallbackHandler) {
if (mTask != null) { if (mTask != null) {
final ActivityOptions opts; final ActivityOptions opts;
TestLogging.recordEvent( TestLogging.recordEvent(