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

Commit 0ae8f350 authored by Louis Chang's avatar Louis Chang
Browse files

Prevent repeatedly resuming/pausing activities in split

The embedding activity was repeatedly pausing/resuming
when the app is targeting SDK before Q. That's because
we were only comparing the z-order of the root task.
However, both of the two activities in split are in the
same task.

Update the topmost activity by comparing the z-order of
the activities.

Bug: 196923917
Test: start app with targetSDK prior Q in split
Change-Id: Ib6ffb12439689f38e83e320a0c9e739829e0f8fc
parent 103c3054
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -730,12 +730,15 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
            canUpdate = true;
            canUpdate = true;
        }
        }


        // Compare the z-order of ActivityStacks if both activities landed on same display.
        // Update the topmost activity if the activity has higher z-order than the current
        if (display == topDisplay
        // top-resumed activity.
                && mPreQTopResumedActivity.getRootTask().compareTo(
        if (!canUpdate) {
                        activity.getRootTask()) <= 0) {
            final ActivityRecord ar = topDisplay.getActivity(r -> r == activity,
                    true /* traverseTopToBottom */, mPreQTopResumedActivity);
            if (ar != null && ar != mPreQTopResumedActivity) {
                canUpdate = true;
                canUpdate = true;
            }
            }
        }


        if (canUpdate) {
        if (canUpdate) {
            // Make sure the previous top activity in the process no longer be resumed.
            // Make sure the previous top activity in the process no longer be resumed.