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

Commit 2ab53cf2 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Also consider task intent when trimming recent tasks

7cbfcd88 we stopped comparing
the tasks realActivity when trimming recent task. This led to
task with the same intent been duplicated in the recents list.
We now consider the task intent when deciding when to trim like
we did pre 510e5542.

Bug: 22812470
Bug: 22564474
Bug: 18642190
Change-Id: I90b3ab9cf7a06b4691099f697e723d8a54def9fa
parent 8dbd4848
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;
                }