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

Commit 242a5004 authored by Stefan Kuhne's avatar Stefan Kuhne Committed by Android (Google) Code Review
Browse files

Merge "Don't exceed max. allowed recent document tasks for an app." into mnc-dev

parents b300d31b 510e5542
Loading
Loading
Loading
Loading
+4 −7
Original line number Original line Diff line number Diff line
@@ -435,9 +435,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
     */
     */
    int trimForTaskLocked(TaskRecord task, boolean doTrim) {
    int trimForTaskLocked(TaskRecord task, boolean doTrim) {
        int recentsCount = size();
        int recentsCount = size();
        final Intent intent = task.intent;
        final boolean document = task.intent != null && task.intent.isDocument();
        final boolean document = intent != null && intent.isDocument();

        int maxRecents = task.maxRecents - 1;
        int maxRecents = task.maxRecents - 1;
        for (int i = 0; i < recentsCount; i++) {
        for (int i = 0; i < recentsCount; i++) {
            final TaskRecord tr = get(i);
            final TaskRecord tr = get(i);
@@ -448,12 +446,11 @@ class RecentTasks extends ArrayList<TaskRecord> {
                if (i > MAX_RECENT_BITMAPS) {
                if (i > MAX_RECENT_BITMAPS) {
                    tr.freeLastThumbnail();
                    tr.freeLastThumbnail();
                }
                }
                final Intent trIntent = tr.intent;
                if (task.realActivity == null || tr.realActivity == null ||
                if ((task.affinity == null || !task.affinity.equals(tr.affinity)) &&
                        !task.realActivity.equals(tr.realActivity)) {
                        (intent == null || !intent.filterEquals(trIntent))) {
                    continue;
                    continue;
                }
                }
                final boolean trIsDocument = trIntent != null && trIntent.isDocument();
                final boolean trIsDocument = tr.intent != null && tr.intent.isDocument();
                if (document && trIsDocument) {
                if (document && trIsDocument) {
                    // These are the same document activity (not necessarily the same doc).
                    // These are the same document activity (not necessarily the same doc).
                    if (maxRecents > 0) {
                    if (maxRecents > 0) {