Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa4c9f7a authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android Git Automerger
Browse files

am 5e4be98e: am f8576979: Merge "Also consider task intent when trimming recent tasks" into mnc-dev

* commit '5e4be98e':
  Also consider task intent when trimming recent tasks
parents 66dd6ee9 5e4be98e
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -435,7 +435,8 @@ class RecentTasks extends ArrayList<TaskRecord> {
     */
    int trimForTaskLocked(TaskRecord task, boolean doTrim) {
        int recentsCount = size();
        final boolean document = task.intent != null && task.intent.isDocument();
        final Intent intent = task.intent;
        final boolean document = intent != null && intent.isDocument();
        int maxRecents = task.maxRecents - 1;
        for (int i = 0; i < recentsCount; i++) {
            final TaskRecord tr = get(i);
@@ -446,12 +447,13 @@ class RecentTasks extends ArrayList<TaskRecord> {
                if (i > MAX_RECENT_BITMAPS) {
                    tr.freeLastThumbnail();
                }
                final Intent trIntent = tr.intent;
                final boolean sameAffinity =
                        task.affinity != null && task.affinity.equals(tr.affinity);
                final boolean trIsDocument = tr.intent != null && tr.intent.isDocument();
                final boolean sameIntent = (intent != null && intent.filterEquals(trIntent));
                final boolean trIsDocument = trIntent != null && trIntent.isDocument();
                final boolean bothDocuments = document && trIsDocument;
                if (!sameAffinity && !bothDocuments) {
                    // Not the same affinity and not documents. Move along...
                if (!sameAffinity && !sameIntent && !bothDocuments) {
                    continue;
                }