Fix launch failed when split non-resizable app

We already handled such case on onRemoteAnimationFinishedOrCancelled
but ignore remote animation cancelled case(Quikc switch) because
it was a workaround for another bug. And that bug was already
resolved so we could remove add cancel case back.

Also rollback previous remove split pair patch due to we want to
let all background split pair keep after fold or unfold.

Fix: 267245649
Test: manual
Test: pass existing tests
Change-Id: I6ce80e6fc8c42e7b29180fd1cbf3f735da60434d
This commit is contained in:
Tony Huang
2023-02-23 07:49:18 +00:00
parent c3a40b4925
commit b2f35cc29e
2 changed files with 6 additions and 21 deletions

View File

@@ -936,7 +936,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
new IRemoteAnimationFinishedCallback.Stub() {
@Override
public void onAnimationFinished() throws RemoteException {
onRemoteAnimationFinishedOrCancelled(false /* cancel */, evictWct);
onRemoteAnimationFinishedOrCancelled(evictWct);
finishedCallback.onAnimationFinished();
}
};
@@ -952,7 +952,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
@Override
public void onAnimationCancelled(boolean isKeyguardOccluded) {
onRemoteAnimationFinishedOrCancelled(true /* cancel */, evictWct);
onRemoteAnimationFinishedOrCancelled(evictWct);
try {
adapter.getRunner().onAnimationCancelled(isKeyguardOccluded);
} catch (RemoteException e) {
@@ -973,15 +973,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
}
private void onRemoteAnimationFinishedOrCancelled(boolean cancel,
WindowContainerTransaction evictWct) {
private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) {
mIsSplitEntering = false;
mShouldUpdateRecents = true;
mSplitRequest = null;
// If any stage has no child after animation finished, it means that split will display
// nothing, such status will happen if task and intent is same app but not support
// multi-instance, we should exit split and expand that app as full screen.
if (!cancel && (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0)) {
if (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0) {
mMainExecutor.execute(() ->
exitSplitScreen(mMainStage.getChildCount() == 0
? mSideStage : mMainStage, EXIT_REASON_UNKNOWN));
@@ -1236,8 +1235,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Notify recents if we are exiting in a way that breaks the pair, and disable further
// updates to splits in the recents until we enter split again
if (shouldBreakPairedTaskInRecents(exitReason) && mShouldUpdateRecents) {
recentTasks.removeSplitPair(mMainStage.getLastVisibleTaskId());
recentTasks.removeSplitPair(mSideStage.getLastVisibleTaskId());
recentTasks.removeSplitPair(mMainStage.getTopVisibleChildTaskId());
recentTasks.removeSplitPair(mSideStage.getTopVisibleChildTaskId());
}
});
mShouldUpdateRecents = false;

View File

@@ -92,7 +92,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
protected SurfaceControl mDimLayer;
protected SparseArray<ActivityManager.RunningTaskInfo> mChildrenTaskInfo = new SparseArray<>();
private final SparseArray<SurfaceControl> mChildrenLeashes = new SparseArray<>();
private int mLastVisibleTaskId = INVALID_TASK_ID;
// TODO(b/204308910): Extracts SplitDecorManager related code to common package.
private SplitDecorManager mSplitDecorManager;
@@ -123,13 +122,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
return contains(t -> t.token.asBinder() == binder);
}
/**
* Returns the last visible task's id.
*/
int getLastVisibleTaskId() {
return mLastVisibleTaskId;
}
/**
* Returns the top visible child task's id.
*/
@@ -229,9 +221,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
return;
}
mChildrenTaskInfo.put(taskInfo.taskId, taskInfo);
if (taskInfo.isVisible && taskInfo.taskId != mLastVisibleTaskId) {
mLastVisibleTaskId = taskInfo.taskId;
}
mCallbacks.onChildTaskStatusChanged(taskInfo.taskId, true /* present */,
taskInfo.isVisible);
if (!ENABLE_SHELL_TRANSITIONS) {
@@ -264,9 +253,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
} else if (mChildrenTaskInfo.contains(taskId)) {
mChildrenTaskInfo.remove(taskId);
mChildrenLeashes.remove(taskId);
if (taskId == mLastVisibleTaskId) {
mLastVisibleTaskId = INVALID_TASK_ID;
}
mCallbacks.onChildTaskStatusChanged(taskId, false /* present */, taskInfo.isVisible);
if (ENABLE_SHELL_TRANSITIONS) {
// Status is managed/synchronized by the transition lifecycle.