Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef3207ae authored by Vinit Nayak's avatar Vinit Nayak
Browse files

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
parent 4394cc77
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -731,16 +731,19 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
        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