diff options
| author | 2016-04-22 16:27:39 -0700 | |
|---|---|---|
| committer | 2016-04-22 16:27:39 -0700 | |
| commit | e8d5f650413dd6e0043f7dcb2e41bbb5df9832fb (patch) | |
| tree | 780fb386f137f4f8e9f61a2dc4c8f1b27c26e8e1 | |
| parent | 6e685dc3c519526a0f38ec5ee9e81e1f57e0fa36 (diff) | |
Allow multiple recent entries for task with FLAG_ACTIVITY_MULTIPLE_TASK
The caller wants multiple task in this case regardless of if it is the
same activity or intent filter. So allow it.
Bug: 28293748
Change-Id: I97f7900657975291f301cb4dc0a8af93ff6b70ea
| -rw-r--r-- | services/core/java/com/android/server/am/RecentTasks.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java index fb1cda7edb54..88faee73322f 100644 --- a/services/core/java/com/android/server/am/RecentTasks.java +++ b/services/core/java/com/android/server/am/RecentTasks.java @@ -16,6 +16,9 @@ package com.android.server.am; +import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; +import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RECENTS; import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_TASKS; import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_RECENTS; @@ -624,10 +627,16 @@ class RecentTasks extends ArrayList<TaskRecord> { final Intent trIntent = tr.intent; final boolean sameAffinity = task.affinity != null && task.affinity.equals(tr.affinity); - final boolean sameIntent = (intent != null && intent.filterEquals(trIntent)); + final boolean sameIntentFilter = intent != null && intent.filterEquals(trIntent); + boolean multiTasksAllowed = false; + final int flags = intent.getFlags(); + if ((flags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NEW_DOCUMENT)) != 0 + && (flags & FLAG_ACTIVITY_MULTIPLE_TASK) != 0) { + multiTasksAllowed = true; + } final boolean trIsDocument = trIntent != null && trIntent.isDocument(); final boolean bothDocuments = document && trIsDocument; - if (!sameAffinity && !sameIntent && !bothDocuments) { + if (!sameAffinity && !sameIntentFilter && !bothDocuments) { continue; } @@ -638,7 +647,7 @@ class RecentTasks extends ArrayList<TaskRecord> { && task.realActivity.equals(tr.realActivity); // If the document is open in another app or is not the same // document, we don't need to trim it. - if (!sameActivity || !sameIntent) { + if (!sameActivity || !sameIntentFilter || multiTasksAllowed) { continue; // Otherwise only trim if we are over our max recents for this task } else if (maxRecents > 0 && !doTrim) { |