Prevent exception when quick switching between two split pairs
When switching in between two split pairs just quick enough, it is
possible to send the second entering split transition while it is
animating the first entering split transition which is merged to a
recents-during-split transition. The split parents might not be
collected into the second transition because the split parents are
already visible at that time, and there is no recents transition to
merge to. So updates to not throwing when there is no split parent when
composing a recents-to-split animation.
Bug: 236226779
Test: repro steps of the bug and the Launcher won't throw
Change-Id: I3a595722721186e8de7d60c9fb8c099ec799804a
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 499a260..1238819 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -473,16 +473,14 @@
throw new IllegalStateException(
"Expected task to be showing, but it is " + mode);
}
- if (change.getParent() == null) {
- throw new IllegalStateException("Initiating multi-split launch but the split"
- + "root of " + taskId + " is already visible or has broken hierarchy.");
- }
}
if (taskId == initialTaskId) {
- splitRoot1 = transitionInfo.getChange(change.getParent());
+ splitRoot1 = change.getParent() == null ? change :
+ transitionInfo.getChange(change.getParent());
}
if (taskId == secondTaskId) {
- splitRoot2 = transitionInfo.getChange(change.getParent());
+ splitRoot2 = change.getParent() == null ? change :
+ transitionInfo.getChange(change.getParent());
}
}