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

Commit 9d64135a authored by Tony Wickham's avatar Tony Wickham
Browse files

Add isVisible to Task

This is needed to determine whether a running task in Desktop is
minimized.

Also revert ag/27144586 to now include minimized tasks in
getRecentTasks().

Bug: 333872717
Bug: 315354060
Flag: com.android.launcher3.enable_recents_in_taskbar
Test: RecentTasksControllerTest + see other CLs in topic
Change-Id: I9631cc28ead4437ecf6e4689b839e14674c429cc
parent d8af6469
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -409,10 +409,6 @@ public class RecentTasksController implements TaskStackListenerCallback,
            if (DesktopModeStatus.canEnterDesktopMode(mContext)
                    && mDesktopModeTaskRepository.isPresent()
                    && mDesktopModeTaskRepository.get().isActiveTask(taskInfo.taskId)) {
                if (mDesktopModeTaskRepository.get().isMinimizedTask(taskInfo.taskId)) {
                    // Minimized freeform tasks should not be shown at all.
                    continue;
                }
                // Freeform tasks will be added as a separate entry
                if (mostRecentFreeformTaskIndex == Integer.MAX_VALUE) {
                    mostRecentFreeformTaskIndex = recentTasks.size();
+5 −5
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ public class RecentTasksControllerTest extends ShellTestCase {
    }

    @Test
    public void testGetRecentTasks_proto2Enabled_ignoresMinimizedFreeformTasks() {
    public void testGetRecentTasks_proto2Enabled_includesMinimizedFreeformTasks() {
        ActivityManager.RecentTaskInfo t1 = makeTaskInfo(1);
        ActivityManager.RecentTaskInfo t2 = makeTaskInfo(2);
        ActivityManager.RecentTaskInfo t3 = makeTaskInfo(3);
@@ -415,8 +415,7 @@ public class RecentTasksControllerTest extends ShellTestCase {
        ArrayList<GroupedRecentTaskInfo> recentTasks = mRecentTasksController.getRecentTasks(
                MAX_VALUE, RECENT_IGNORE_UNAVAILABLE, 0);

        // 2 freeform tasks should be grouped into one, 1 task should be skipped, 3 total recents
        // entries
        // 3 freeform tasks should be grouped into one, 2 single tasks, 3 total recents entries
        assertEquals(3, recentTasks.size());
        GroupedRecentTaskInfo freeformGroup = recentTasks.get(0);
        GroupedRecentTaskInfo singleGroup1 = recentTasks.get(1);
@@ -428,9 +427,10 @@ public class RecentTasksControllerTest extends ShellTestCase {
        assertEquals(GroupedRecentTaskInfo.TYPE_SINGLE, singleGroup2.getType());

        // Check freeform group entries
        assertEquals(2, freeformGroup.getTaskInfoList().size());
        assertEquals(3, freeformGroup.getTaskInfoList().size());
        assertEquals(t1, freeformGroup.getTaskInfoList().get(0));
        assertEquals(t5, freeformGroup.getTaskInfoList().get(1));
        assertEquals(t3, freeformGroup.getTaskInfoList().get(1));
        assertEquals(t5, freeformGroup.getTaskInfoList().get(2));

        // Check single entries
        assertEquals(t2, singleGroup1.getTaskInfo1());
+4 −0
Original line number Diff line number Diff line
@@ -246,6 +246,9 @@ public class Task {
    public ActivityManager.RecentTaskInfo.PersistedTaskSnapshotData lastSnapshotData =
            new ActivityManager.RecentTaskInfo.PersistedTaskSnapshotData();

    @ViewDebug.ExportedProperty(category="recents")
    public boolean isVisible;

    public Task() {
        // Do nothing
    }
@@ -279,6 +282,7 @@ public class Task {
        lastSnapshotData.set(other.lastSnapshotData);
        positionInParent = other.positionInParent;
        appBounds = other.appBounds;
        isVisible = other.isVisible;
    }

    /**