From b546f7e0d830c2be96eb6ded1c16d49b2429e6c9 Mon Sep 17 00:00:00 2001 From: Chong Zhang Date: Wed, 5 Aug 2015 14:21:36 -0700 Subject: [PATCH] Only launch an activity in an existing task if activity types match Activities with FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK flags, when sharing the home activity's task, could cause the home activity to be cleared. Later when home is launched again, a reset of the task will be triggered each time. Don't put an activity into a task unless the activity types match. (This covers both home and recents activities.) bug: 21880868 Change-Id: Ida26d187a6552914826bf45e537a731b3a15ea70 --- services/core/java/com/android/server/am/ActivityStack.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index e6c8d4382ab50..4ac290c6c4785 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -542,6 +542,10 @@ final class ActivityStack { if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping " + task + ": mismatch root " + r); continue; } + if (r.mActivityType != target.mActivityType) { + if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping " + task + ": mismatch activity type"); + continue; + } final Intent taskIntent = task.intent; final Intent affinityIntent = task.affinityIntent;