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
This commit is contained in:
Louis Chang
2021-08-17 14:19:37 +08:00
parent 103c305438
commit 0ae8f3504b

View File

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