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

Commit 9d0ce426 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Limit number of recents entries for an app to maxRecents allowed.

am: 847167fe

Change-Id: Ib97c8226fc18de59802aacd55b161a3188cab5b8
parents 59b82942 847167fe
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -653,13 +653,18 @@ class RecentTasks extends ArrayList<TaskRecord> {
                            && task.realActivity.equals(tr.realActivity);
                    // If the document is open in another app or is not the same
                    // document, we don't need to trim it.
                    if (!sameActivity || !sameIntentFilter || multiTasksAllowed) {
                    if (!sameActivity) {
                        continue;
                    // Otherwise only trim if we are over our max recents for this task
                    } else if (maxRecents > 0 && !doTrim) {
                    } else if (maxRecents > 0) {
                        --maxRecents;
                        if (!doTrim || !sameIntentFilter || multiTasksAllowed) {
                            // We don't want to trim if we are not over the max allowed entries and
                            // the caller doesn't want us to trim, the tasks are not of the same
                            // intent filter, or multiple entries fot the task is allowed.
                            continue;
                        }
                    }
                    // Hit the maximum number of documents for this task. Fall through
                    // and remove this document from recents.
                } else if (document || trIsDocument) {