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

Commit 517947c8 authored by tanxiaoyan's avatar tanxiaoyan
Browse files

Find pending AppearedActivity first



Bug: 369460497

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.

Change-Id: Ib5016fc5648f3f6d89b501e8d43014c915eb51e8
Signed-off-by: default avatartanxiaoyan <tanxiaoyan@xiaomi.com>
parent b4596695
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());