Prevent early recent trimming of distinct documents.

Prevent early trimming of documents with distinct
intents. Otherwise when launching a document
from a given activity, existing recent entries
will always be pruned even if they are distinct
documents. We don't have to worry about overflowing
recents, a seperate codepath (from addLocked)
takes care of second pass trimming when we have
exceeded our total max recents.

Bug: 25460953
Change-Id: I71f8c3d46570df2c999f0d986e05515074e0a098
This commit is contained in:
Robert Carr
2015-11-10 13:44:02 -08:00
parent 0a61b36013
commit 7cb57e199f

View File

@@ -462,10 +462,12 @@ class RecentTasks extends ArrayList<TaskRecord> {
final boolean sameActivity = task.realActivity != null
&& tr.realActivity != null
&& task.realActivity.equals(tr.realActivity);
if (!sameActivity) {
// If the document is open in another app or is not the same
// document, we don't need to trim it.
if (!sameActivity || !sameIntent) {
continue;
}
if (maxRecents > 0 && !doTrim) {
// Otherwise only trim if we are over our max recents for this task
} else if (maxRecents > 0 && !doTrim) {
--maxRecents;
continue;
}