Don't rely on stale DP.isLeftRightSplit for app pair landscape launch
* If phone auto-rotate is on but launcher rotation is off, if you
launch app pair holding phone horizontally the apps will launch in
landscape but DeviceProfile will report portrait.
* Now we see if all the leaf tasks have their top bounds be 0 to
determine leftRight split-ness
* Animation is still wonky, but acceptable for this edge case for now
Fixes: 356763330
Test: No crash, app pairs launch fine in normal portrait and landscape
Flag: EXEMPT bugfix
Change-Id: I0a067b50751b919bda5446c3e36055e58222bcab
diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
index fa5a67a..256e29e 100644
--- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
+++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt
@@ -731,16 +731,19 @@
val mainRootCandidate = splitRoots.first
// Will contain changes (1) and (2) in diagram above
val leafRoots: List<Change> = splitRoots.second
+ // Don't rely on DP.isLeftRightSplit because if launcher is portrait apps could still
+ // launch in landscape if system auto-rotate is enabled and phone is held horizontally
+ val isLeftRightSplit = leafRoots.all { it.endAbsBounds.top == 0 }
// Find the place where our left/top app window meets the divider (used for the
// launcher side animation)
val leftTopApp =
leafRoots.single { change ->
- (dp.isLeftRightSplit && change.endAbsBounds.left == 0) ||
- (!dp.isLeftRightSplit && change.endAbsBounds.top == 0)
+ (isLeftRightSplit && change.endAbsBounds.left == 0) ||
+ (!isLeftRightSplit && change.endAbsBounds.top == 0)
}
val dividerPos =
- if (dp.isLeftRightSplit) leftTopApp.endAbsBounds.right
+ if (isLeftRightSplit) leftTopApp.endAbsBounds.right
else leftTopApp.endAbsBounds.bottom
// Create a new floating view in Launcher, positioned above the launching icon