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

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

am f2f29dc4: am 18c87a1e: am 7dcad6a5: am e99f20f5: Merge "Don\'t duplicate...

am f2f29dc4: am 18c87a1e: am 7dcad6a5: am e99f20f5: Merge "Don\'t duplicate recent tasks of the same affinity." into mnc-dev

* commit 'f2f29dc4':
  Don't duplicate recent tasks of the same affinity.
parents 0ca81c89 f2f29dc4
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -446,13 +446,23 @@ class RecentTasks extends ArrayList<TaskRecord> {
                if (i > MAX_RECENT_BITMAPS) {
                    tr.freeLastThumbnail();
                }
                if (task.realActivity == null || tr.realActivity == null ||
                        !task.realActivity.equals(tr.realActivity)) {
                final boolean sameAffinity =
                        task.affinity != null && task.affinity.equals(tr.affinity);
                final boolean trIsDocument = tr.intent != null && tr.intent.isDocument();
                final boolean bothDocuments = document && trIsDocument;
                if (!sameAffinity && !bothDocuments) {
                    // Not the same affinity and not documents. Move along...
                    continue;
                }

                if (bothDocuments) {
                    // Do these documents belong to the same activity?
                    final boolean sameActivity = task.realActivity != null
                            && tr.realActivity != null
                            && task.realActivity.equals(tr.realActivity);
                    if (!sameActivity) {
                        continue;
                    }
                final boolean trIsDocument = tr.intent != null && tr.intent.isDocument();
                if (document && trIsDocument) {
                    // These are the same document activity (not necessarily the same doc).
                    if (maxRecents > 0) {
                        --maxRecents;
                        continue;