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

Commit 06b4c417 authored by yangyankai1's avatar yangyankai1 Committed by Louis Chang
Browse files

No need to 'addChild' when start 'FLAG_ACTIVITY_CLEAR_TOP' Activity.



Android R refactor Activity launchMode:'FLAG_ACTIVITY_CLEAR_TOP',
'singleTop','singleInstance'. After Android R restructure, the
'addChild' method leads to Activity leaks. No need to 'addChild'
in the current Android version anymore.

Test: build pass, feature pass.
TestCase: Start a Activity twice with flag 'FLAG_ACTIVITY_CLEAR_TOP'.
Reproductivity: always.

Bug: 178734693
Signed-off-by: default avataryangyankai1 <yangyankai1@xiaomi.com>
Change-Id: Ia4d5b875a6592b6448af7500626b5a273bd96dc3
Merged-In: Ia4d5b875a6592b6448af7500626b5a273bd96dc3
parent b9de6898
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -2098,13 +2098,6 @@ class ActivityStarter {
            final ActivityRecord top = targetTask.performClearTaskForReuseLocked(mStartActivity,
                    mLaunchFlags);

            // The above code can remove {@code reusedActivity} from the task, leading to the
            // {@code ActivityRecord} removing its reference to the {@code Task}. The task
            // reference is needed in the call below to {@link setTargetStackAndMoveToFrontIfNeeded}
            if (targetTaskTop.getTask() == null) {
                targetTask.addChild(targetTaskTop);
            }

            if (top != null) {
                if (top.isRootOfTask()) {
                    // Activity aliases may mean we use different intents for the top activity,