Merge "Fix launch failed when split non-resizable app" into tm-qpr-dev am: 0bee0bb81f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21552446

Change-Id: I9e7d467ad7eb83b587d7b67e4828e34a5067c6b9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tony Huang
2023-02-28 12:20:47 +00:00
committed by Automerger Merge Worker
2 changed files with 6 additions and 21 deletions

View File

@@ -936,7 +936,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
new IRemoteAnimationFinishedCallback.Stub() { new IRemoteAnimationFinishedCallback.Stub() {
@Override @Override
public void onAnimationFinished() throws RemoteException { public void onAnimationFinished() throws RemoteException {
onRemoteAnimationFinishedOrCancelled(false /* cancel */, evictWct); onRemoteAnimationFinishedOrCancelled(evictWct);
finishedCallback.onAnimationFinished(); finishedCallback.onAnimationFinished();
} }
}; };
@@ -952,7 +952,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
@Override @Override
public void onAnimationCancelled(boolean isKeyguardOccluded) { public void onAnimationCancelled(boolean isKeyguardOccluded) {
onRemoteAnimationFinishedOrCancelled(true /* cancel */, evictWct); onRemoteAnimationFinishedOrCancelled(evictWct);
try { try {
adapter.getRunner().onAnimationCancelled(isKeyguardOccluded); adapter.getRunner().onAnimationCancelled(isKeyguardOccluded);
} catch (RemoteException e) { } catch (RemoteException e) {
@@ -973,15 +973,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
} }
private void onRemoteAnimationFinishedOrCancelled(boolean cancel, private void onRemoteAnimationFinishedOrCancelled(WindowContainerTransaction evictWct) {
WindowContainerTransaction evictWct) {
mIsSplitEntering = false; mIsSplitEntering = false;
mShouldUpdateRecents = true; mShouldUpdateRecents = true;
mSplitRequest = null; mSplitRequest = null;
// If any stage has no child after animation finished, it means that split will display // 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 // 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. // 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(() -> mMainExecutor.execute(() ->
exitSplitScreen(mMainStage.getChildCount() == 0 exitSplitScreen(mMainStage.getChildCount() == 0
? mSideStage : mMainStage, EXIT_REASON_UNKNOWN)); ? 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 // 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 // updates to splits in the recents until we enter split again
if (shouldBreakPairedTaskInRecents(exitReason) && mShouldUpdateRecents) { if (shouldBreakPairedTaskInRecents(exitReason) && mShouldUpdateRecents) {
recentTasks.removeSplitPair(mMainStage.getLastVisibleTaskId()); recentTasks.removeSplitPair(mMainStage.getTopVisibleChildTaskId());
recentTasks.removeSplitPair(mSideStage.getLastVisibleTaskId()); recentTasks.removeSplitPair(mSideStage.getTopVisibleChildTaskId());
} }
}); });
mShouldUpdateRecents = false; mShouldUpdateRecents = false;

View File

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