Reset floating split task view after remote animation finished

Move reseting floating task view for entering split after remote
animation finished to prevent the floating task view disappear before
opening split task view being visible and causing flicker.

Bug: 199377815
Test: Manual check the flicker disappear
Change-Id: I4a864335972842570c61291a7a0c423edeb74578
This commit is contained in:
Jerry Chang
2021-09-13 12:08:07 +08:00
committed by Vinit Nayak
parent e37b51b30f
commit d3ceb3dc88
5 changed files with 83 additions and 40 deletions
@@ -16,17 +16,20 @@
package com.android.quickstep.util;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import android.app.ActivityThread;
import android.graphics.Rect;
import android.os.Handler;
import android.os.IBinder;
import android.view.RemoteAnimationAdapter;
import android.view.SurfaceControl;
import android.window.TransitionInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
import com.android.quickstep.SystemUiProxy;
@@ -47,13 +50,15 @@ import java.util.function.Consumer;
*/
public class SplitSelectStateController {
private final Handler mHandler;
private final SystemUiProxy mSystemUiProxy;
private @StagePosition int mStagePosition;
private Task mInitialTask;
private Task mSecondTask;
private Rect mInitialBounds;
public SplitSelectStateController(SystemUiProxy systemUiProxy) {
public SplitSelectStateController(Handler handler, SystemUiProxy systemUiProxy) {
mHandler = handler;
mSystemUiProxy = systemUiProxy;
}
@@ -70,9 +75,9 @@ public class SplitSelectStateController {
/**
* To be called after second task selected
*/
public void setSecondTaskId(Task taskView) {
public void setSecondTaskId(Task taskView, Consumer<Boolean> callback) {
mSecondTask = taskView;
launchTasks(mInitialTask, mSecondTask, mStagePosition, null /*callback*/);
launchTasks(mInitialTask, mSecondTask, mStagePosition, callback);
}
/**
@@ -151,22 +156,27 @@ public class SplitSelectStateController {
public void onAnimationStart(int transit, RemoteAnimationTargetCompat[] apps,
RemoteAnimationTargetCompat[] wallpapers, RemoteAnimationTargetCompat[] nonApps,
Runnable finishedCallback) {
TaskViewUtils.composeRecentsSplitLaunchAnimatorLegacy(mInitialTask,
mSecondTask, apps, wallpapers, nonApps, () -> {
finishedCallback.run();
if (mSuccessCallback != null) {
mSuccessCallback.accept(true);
}
});
postAsyncCallback(mHandler,
() -> TaskViewUtils.composeRecentsSplitLaunchAnimatorLegacy(mInitialTask,
mSecondTask, apps, wallpapers, nonApps, () -> {
finishedCallback.run();
if (mSuccessCallback != null) {
mSuccessCallback.accept(true);
}
}));
// After successful launch, call resetState
resetState();
}
@Override
public void onAnimationCancelled() {
if (mSuccessCallback != null) {
mSuccessCallback.accept(false);
}
postAsyncCallback(mHandler, () -> {
if (mSuccessCallback != null) {
mSuccessCallback.accept(false);
}
});
resetState();
}
}