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

Commit 510e5542 authored by Stefan Kuhne's avatar Stefan Kuhne
Browse files

Don't exceed max. allowed recent document tasks for an app.

We were exceeding the maximum allowed recents document tasks entry
for an application package because the full Intent object was been
compared for equality which will be different for each task. Now
we are only comparing that the task components match which is
sufficient to determining that the task belongs to the same
application package.

Bug: 18642190
Change-Id: I831b0fcffb876d51e9439e7a7a4c75bb0881db7c
parent 1f21d2a8
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -435,9 +435,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
     */
    int trimForTaskLocked(TaskRecord task, boolean doTrim) {
        int recentsCount = size();
        final Intent intent = task.intent;
        final boolean document = intent != null && intent.isDocument();

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