Skip to content

Commit 1a41725

Browse files
yangyankai1bgcngm
authored andcommitted
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. Signed-off-by: yangyankai1 <yangyankai1@xiaomi.com> Change-Id: Ia4d5b875a6592b6448af7500626b5a273bd96dc3
1 parent 73c1924 commit 1a41725

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

services/core/java/com/android/server/wm/ActivityStarter.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,13 +2023,6 @@ private void complyActivityFlags(Task targetTask, ActivityRecord reusedActivity,
20232023
final ActivityRecord top = targetTask.performClearTaskForReuseLocked(mStartActivity,
20242024
mLaunchFlags);
20252025

2026-
// The above code can remove {@code reusedActivity} from the task, leading to the
2027-
// {@code ActivityRecord} removing its reference to the {@code Task}. The task
2028-
// reference is needed in the call below to {@link setTargetStackAndMoveToFrontIfNeeded}
2029-
if (targetTaskTop.getTask() == null) {
2030-
targetTask.addChild(targetTaskTop);
2031-
}
2032-
20332026
if (top != null) {
20342027
if (top.isRootOfTask()) {
20352028
// Activity aliases may mean we use different intents for the top activity,

0 commit comments

Comments
 (0)