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

Commit bbe36a86 authored by Shivam Agrawal's avatar Shivam Agrawal
Browse files

Do Not Report Activities that are Finishing

...in TaskFragment

There may be a delay between when an activity is marked
to finish and when the WM hierarchy actually removes the
activity from the TaskFragment. In between this delay,
the TaskFragmentInfo will change because the runningActivityCount
will change, triggering an onTaskFragmentInfoChanged.
This callback is unncessary because there will be another
callback soon once the activity is removed from the hierarchy.

Bug: b/205901017
Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests
Change-Id: I64e08acc2a745f6f242996e99240fe4a8f0dea97
parent 2436b2a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ class TaskFragmentContainer {
        ActivityThread activityThread = ActivityThread.currentActivityThread();
        for (IBinder token : mInfo.getActivities()) {
            Activity activity = activityThread.getActivity(token);
            if (activity != null && !allActivities.contains(activity)) {
            if (activity != null && !activity.isFinishing() && !allActivities.contains(activity)) {
                allActivities.add(activity);
            }
        }
+6 −7
Original line number Diff line number Diff line
@@ -2173,14 +2173,13 @@ class TaskFragment extends WindowContainer<WindowContainer> {
    TaskFragmentInfo getTaskFragmentInfo() {
        List<IBinder> childActivities = new ArrayList<>();
        for (int i = 0; i < getChildCount(); i++) {
            WindowContainer wc = getChildAt(i);
            if (mTaskFragmentOrganizerUid != INVALID_UID
                    && wc.asActivityRecord() != null
                    && wc.asActivityRecord().info.processName.equals(
                            mTaskFragmentOrganizerProcessName)
                    && wc.asActivityRecord().getUid() == mTaskFragmentOrganizerUid) {
            final WindowContainer wc = getChildAt(i);
            final ActivityRecord ar = wc.asActivityRecord();
            if (mTaskFragmentOrganizerUid != INVALID_UID && ar != null
                    && ar.info.processName.equals(mTaskFragmentOrganizerProcessName)
                    && ar.getUid() == mTaskFragmentOrganizerUid && !ar.finishing) {
                // Only includes Activities that belong to the organizer process for security.
                childActivities.add(wc.asActivityRecord().token);
                childActivities.add(ar.token);
            }
        }
        final Point positionInParent = new Point();