Fix back to split pair from overview with shell-transition hang.

Prevent it throws index out of bounds exception when entering split pair
from overview panel. And make sure to update split screen state properly
when enter split transition got merged to other transition.

Fix: 210852531
Bug: 206487881
Test: Trigger split screen, swipe up to overview, verified it won't hang
      when select split pair from overview panel.
Change-Id: Ifc5c224b7185224b811e6e2e7fa5d798c99bc6b1
This commit is contained in:
Jerry Chang
2021-12-20 11:09:56 +00:00
parent 7843221505
commit 8959d0b139
2 changed files with 22 additions and 5 deletions

View File

@@ -1207,6 +1207,27 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
return out;
}
@Override
public void onTransitionMerged(@NonNull IBinder transition) {
// Once the pending enter transition got merged, make sure to bring divider bar visible and
// clear the pending transition from cache to prevent mess-up the following state.
if (transition == mSplitTransitions.mPendingEnter) {
mSplitLayout.init();
setDividerVisibility(true, null /* transaction */);
setSplitsVisible(true);
mShouldUpdateRecents = true;
updateRecentTasksSplitPair();
if (!mLogger.hasStartedSession()) {
mLogger.logEnter(mSplitLayout.getDividerPositionAsFraction(),
getMainStagePosition(), mMainStage.getTopChildTaskUid(),
getSideStagePosition(), mSideStage.getTopChildTaskUid(),
mSplitLayout.isLandscape());
}
mSplitTransitions.mPendingEnter = null;
}
}
@Override
public boolean startAnimation(@NonNull IBinder transition,
@NonNull TransitionInfo info,

View File

@@ -246,10 +246,6 @@ public class RemoteTransitionCompat implements Parcelable {
if (mPausingTasks.contains(openingTasks.get(i).getContainer())) {
++pauseMatches;
}
if (openingTasks.get(i).getContainer().equals(mPausingTasks.get(i))) {
// In this case, we are "returning" to an already running app, so just consume
// the merge and do nothing.
}
}
if (pauseMatches > 0) {
if (pauseMatches != mPausingTasks.size()) {
@@ -275,9 +271,9 @@ public class RemoteTransitionCompat implements Parcelable {
t.reparent(target.leash.mSurfaceControl, mInfo.getRootLeash());
t.setLayer(target.leash.mSurfaceControl, layer);
t.hide(target.leash.mSurfaceControl);
t.apply();
targets[i] = target;
}
t.apply();
recents.onTasksAppeared(targets);
return true;
}