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

Commit 6deccd8e authored by Alex Chau's avatar Alex Chau
Browse files

Don't return TYPE_RECENTS task in TopTaskTracker.getCachedTopTask

- We have no use-case to show TYPE_RECENTS (NexusLauncher or RecentsActivity) in Overview, stripping TYPE_RECENTS avoids accidentally showing RecentsAcitivty as a tile on swipe up

Fix: 355263037
Test: manually verify it doesn't break 3P Launcher; the bug itself cannot be verified as it cannot be easily reproduced
Flag: EXEMPT BUG_FIX
Change-Id: Id1b8e43dc7ddb9ad9c781b9a860fe4fba97d4be6
parent b41def03
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -206,12 +206,17 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
            Collections.addAll(mOrderedTaskList, tasks);
        }

        // Strip the pinned task
        ArrayList<RunningTaskInfo> tasks = new ArrayList<>(mOrderedTaskList);
        tasks.removeIf(t -> t.taskId == mPinnedTaskId);
        // Strip the pinned task and recents task
        tasks.removeIf(t -> t.taskId == mPinnedTaskId || isRecentsTask(t));
        return new CachedTaskInfo(tasks);
    }

    private static boolean isRecentsTask(RunningTaskInfo task) {
        return task != null && task.configuration.windowConfiguration
                .getActivityType() == ACTIVITY_TYPE_RECENTS;
    }

    /**
     * Class to provide information about a task which can be safely cached and do not change
     * during the lifecycle of the task.
@@ -267,8 +272,7 @@ public class TopTaskTracker extends ISplitScreenListener.Stub
        }

        public boolean isRecentsTask() {
            return mTopTask != null && mTopTask.configuration.windowConfiguration
                    .getActivityType() == ACTIVITY_TYPE_RECENTS;
            return TopTaskTracker.isRecentsTask(mTopTask);
        }

        /**