am 242a5004: Merge "Don\'t exceed max. allowed recent document tasks for an app." into mnc-dev

* commit '242a500491a2ce14910f31a751c47bc72f986e97':
  Don't exceed max. allowed recent document tasks for an app.
This commit is contained in:
Stefan Kuhne
2015-05-20 18:50:52 +00:00
committed by Android Git Automerger

View File

@@ -435,9 +435,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
*/ */
int trimForTaskLocked(TaskRecord task, boolean doTrim) { int trimForTaskLocked(TaskRecord task, boolean doTrim) {
int recentsCount = size(); int recentsCount = size();
final Intent intent = task.intent; final boolean document = task.intent != null && task.intent.isDocument();
final boolean document = intent != null && intent.isDocument();
int maxRecents = task.maxRecents - 1; int maxRecents = task.maxRecents - 1;
for (int i = 0; i < recentsCount; i++) { for (int i = 0; i < recentsCount; i++) {
final TaskRecord tr = get(i); final TaskRecord tr = get(i);
@@ -448,12 +446,11 @@ class RecentTasks extends ArrayList<TaskRecord> {
if (i > MAX_RECENT_BITMAPS) { if (i > MAX_RECENT_BITMAPS) {
tr.freeLastThumbnail(); tr.freeLastThumbnail();
} }
final Intent trIntent = tr.intent; if (task.realActivity == null || tr.realActivity == null ||
if ((task.affinity == null || !task.affinity.equals(tr.affinity)) && !task.realActivity.equals(tr.realActivity)) {
(intent == null || !intent.filterEquals(trIntent))) {
continue; continue;
} }
final boolean trIsDocument = trIntent != null && trIntent.isDocument(); final boolean trIsDocument = tr.intent != null && tr.intent.isDocument();
if (document && trIsDocument) { if (document && trIsDocument) {
// These are the same document activity (not necessarily the same doc). // These are the same document activity (not necessarily the same doc).
if (maxRecents > 0) { if (maxRecents > 0) {