mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 23:36:47 +00:00
Call split finish callback if split invocation fails
Bug: 295981634 Test: Splitting w/ Google TV widget no longer keeps placeholder views on screen Flag: ENABLE_SPLIT_WORKSPACE_TO_WORKSPACE Change-Id: I1d4df9deb9aaaaeef3741a05130429d0091293e8
This commit is contained in:
@@ -37,6 +37,7 @@ import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.UiThread;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ActivityThread;
|
||||
@@ -603,13 +604,13 @@ public class SplitSelectStateController {
|
||||
|
||||
private final int mInitialTaskId;
|
||||
private final int mSecondTaskId;
|
||||
private Consumer<Boolean> mSuccessCallback;
|
||||
private Consumer<Boolean> mFinishCallback;
|
||||
|
||||
RemoteSplitLaunchTransitionRunner(int initialTaskId, int secondTaskId,
|
||||
@Nullable Consumer<Boolean> callback) {
|
||||
mInitialTaskId = initialTaskId;
|
||||
mSecondTaskId = secondTaskId;
|
||||
mSuccessCallback = callback;
|
||||
mFinishCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -628,11 +629,7 @@ public class SplitSelectStateController {
|
||||
TaskViewUtils.composeRecentsSplitLaunchAnimator(mLaunchingTaskView, mStateManager,
|
||||
mDepthController, mInitialTaskId, mSecondTaskId, info, t, () -> {
|
||||
finishAdapter.run();
|
||||
if (mSuccessCallback != null) {
|
||||
mSuccessCallback.accept(true);
|
||||
mSuccessCallback = null;
|
||||
}
|
||||
resetState();
|
||||
cleanup(true /*success*/);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -645,6 +642,22 @@ public class SplitSelectStateController {
|
||||
@Override
|
||||
public void onTransitionConsumed(IBinder transition, boolean aborted)
|
||||
throws RemoteException {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
cleanup(false /*success*/);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Must be called on UI thread.
|
||||
* @param success if launching the split apps occurred successfully or not
|
||||
*/
|
||||
@UiThread
|
||||
private void cleanup(boolean success) {
|
||||
if (mFinishCallback != null) {
|
||||
mFinishCallback.accept(success);
|
||||
mFinishCallback = null;
|
||||
}
|
||||
resetState();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user