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

Commit 82578104 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Find pending AppearedActivity first" into main

parents 3d7c275c 517947c8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -323,8 +323,16 @@ class TaskContainer {

    @Nullable
    TaskFragmentContainer getContainerWithActivity(@NonNull IBinder activityToken) {
        return getContainer(container -> container.hasAppearedActivity(activityToken)
                || container.hasPendingAppearedActivity(activityToken));
        // When the new activity is launched to the topmost TF because the source activity
        // was in that TF, and the source activity is finished before resolving the new activity,
        // we will try to see if the new activity match a rule with the split activities below.
        // If matched, it can be reparented.
        final TaskFragmentContainer taskFragmentContainer
                = getContainer(container -> container.hasPendingAppearedActivity(activityToken));
        if (taskFragmentContainer != null) {
            return taskFragmentContainer;
        }
        return getContainer(container -> container.hasAppearedActivity(activityToken));
    }

    @Nullable
+2 −1
Original line number Diff line number Diff line
@@ -535,7 +535,8 @@ public class TaskFragmentContainerTest {
        // container1.
        container2.setInfo(mTransaction, mInfo);

        assertTrue(container2.hasActivity(mActivity.getActivityToken()));
        assertTrue(container1.hasActivity(mActivity.getActivityToken()));
        assertFalse(container2.hasActivity(mActivity.getActivityToken()));
        // When the pending appeared record is removed from container1, we respect the appeared
        // record in container2.
        container1.removePendingAppearedActivity(mActivity.getActivityToken());