Search in sources :

Example 1 with GroupTask

use of com.android.quickstep.util.GroupTask in project android_packages_apps_Launcher3 by AOSPA.

the class RecentTasksListTest method loadTasksInBackground_moreThanKeys_hasValidTaskDescription.

@Test
public void loadTasksInBackground_moreThanKeys_hasValidTaskDescription() {
    String taskDescription = "Wheeee!";
    ActivityManager.RecentTaskInfo task1 = new ActivityManager.RecentTaskInfo();
    task1.taskDescription = new ActivityManager.TaskDescription(taskDescription);
    ActivityManager.RecentTaskInfo task2 = new ActivityManager.RecentTaskInfo();
    task2.taskDescription = new ActivityManager.TaskDescription();
    GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo(task1, task2, null);
    when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt())).thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos)));
    List<GroupTask> taskList = mRecentTasksList.loadTasksInBackground(Integer.MAX_VALUE, -1, false);
    assertEquals(1, taskList.size());
    assertEquals(taskDescription, taskList.get(0).task1.taskDescription.getLabel());
    assertNull(taskList.get(0).task2.taskDescription.getLabel());
}
Also used : GroupedRecentTaskInfo(com.android.wm.shell.util.GroupedRecentTaskInfo) GroupedRecentTaskInfo(com.android.wm.shell.util.GroupedRecentTaskInfo) GroupTask(com.android.quickstep.util.GroupTask) ActivityManager(android.app.ActivityManager) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 2 with GroupTask

use of com.android.quickstep.util.GroupTask in project android_packages_apps_Launcher3 by AOSPA.

the class RecentsModel method onTaskStackChangedBackground.

@Override
public void onTaskStackChangedBackground() {
    if (!mThumbnailCache.isPreloadingEnabled()) {
        // Skip if we aren't preloading
        return;
    }
    int currentUserId = Process.myUserHandle().getIdentifier();
    if (!checkCurrentOrManagedUserId(currentUserId, mContext)) {
        // Skip if we are not the current user
        return;
    }
    // Keep the cache up to date with the latest thumbnails
    ActivityManager.RunningTaskInfo runningTask = ActivityManagerWrapper.getInstance().getRunningTask();
    int runningTaskId = runningTask != null ? runningTask.id : -1;
    mTaskList.getTaskKeys(mThumbnailCache.getCacheSize(), taskGroups -> {
        for (GroupTask group : taskGroups) {
            if (group.containsTask(runningTaskId)) {
                // time the user next enters overview
                continue;
            }
            mThumbnailCache.updateThumbnailInCache(group.task1);
            mThumbnailCache.updateThumbnailInCache(group.task2);
        }
    });
}
Also used : GroupTask(com.android.quickstep.util.GroupTask) ActivityManager(android.app.ActivityManager)

Example 3 with GroupTask

use of com.android.quickstep.util.GroupTask in project android_packages_apps_Launcher3 by AOSPA.

the class FallbackRecentsView method applyLoadPlan.

@Override
protected void applyLoadPlan(ArrayList<GroupTask> taskGroups) {
    // When quick-switching on 3p-launcher, we add a "stub" tile corresponding to Launcher
    // as well. This tile is never shown as we have setCurrentTaskHidden, but allows use to
    // track the index of the next task appropriately, as if we are switching on any other app.
    // TODO(b/195607777) Confirm home task info is front-most task and not mixed in with others
    int runningTaskId = getTaskIdsForRunningTaskView()[0];
    if (mHomeTaskInfo != null && mHomeTaskInfo.taskId == runningTaskId && !taskGroups.isEmpty()) {
        // Check if the task list has running task
        boolean found = false;
        for (GroupTask group : taskGroups) {
            if (group.containsTask(runningTaskId)) {
                found = true;
                break;
            }
        }
        if (!found) {
            ArrayList<GroupTask> newList = new ArrayList<>(taskGroups.size() + 1);
            newList.addAll(taskGroups);
            newList.add(new GroupTask(Task.from(new TaskKey(mHomeTaskInfo), mHomeTaskInfo, false), null, null));
            taskGroups = newList;
        }
    }
    super.applyLoadPlan(taskGroups);
}
Also used : ArrayList(java.util.ArrayList) GroupTask(com.android.quickstep.util.GroupTask) TaskKey(com.android.systemui.shared.recents.model.Task.TaskKey)

Example 4 with GroupTask

use of com.android.quickstep.util.GroupTask in project android_packages_apps_Launcher3 by ArrowOS.

the class RecentsModel method onTaskStackChangedBackground.

@Override
public void onTaskStackChangedBackground() {
    if (!mThumbnailCache.isPreloadingEnabled()) {
        // Skip if we aren't preloading
        return;
    }
    int currentUserId = Process.myUserHandle().getIdentifier();
    if (!checkCurrentOrManagedUserId(currentUserId, mContext)) {
        // Skip if we are not the current user
        return;
    }
    // Keep the cache up to date with the latest thumbnails
    ActivityManager.RunningTaskInfo runningTask = ActivityManagerWrapper.getInstance().getRunningTask();
    int runningTaskId = runningTask != null ? runningTask.id : -1;
    mTaskList.getTaskKeys(mThumbnailCache.getCacheSize(), taskGroups -> {
        for (GroupTask group : taskGroups) {
            if (group.containsTask(runningTaskId)) {
                // time the user next enters overview
                continue;
            }
            mThumbnailCache.updateThumbnailInCache(group.task1);
            mThumbnailCache.updateThumbnailInCache(group.task2);
        }
    });
}
Also used : GroupTask(com.android.quickstep.util.GroupTask) ActivityManager(android.app.ActivityManager)

Example 5 with GroupTask

use of com.android.quickstep.util.GroupTask in project android_packages_apps_Launcher3 by ArrowOS.

the class FallbackRecentsView method applyLoadPlan.

@Override
protected void applyLoadPlan(ArrayList<GroupTask> taskGroups) {
    // When quick-switching on 3p-launcher, we add a "stub" tile corresponding to Launcher
    // as well. This tile is never shown as we have setCurrentTaskHidden, but allows use to
    // track the index of the next task appropriately, as if we are switching on any other app.
    // TODO(b/195607777) Confirm home task info is front-most task and not mixed in with others
    int runningTaskId = getTaskIdsForRunningTaskView()[0];
    if (mHomeTaskInfo != null && mHomeTaskInfo.taskId == runningTaskId && !taskGroups.isEmpty()) {
        // Check if the task list has running task
        boolean found = false;
        for (GroupTask group : taskGroups) {
            if (group.containsTask(runningTaskId)) {
                found = true;
                break;
            }
        }
        if (!found) {
            ArrayList<GroupTask> newList = new ArrayList<>(taskGroups.size() + 1);
            newList.addAll(taskGroups);
            newList.add(new GroupTask(Task.from(new TaskKey(mHomeTaskInfo), mHomeTaskInfo, false), null, null));
            taskGroups = newList;
        }
    }
    super.applyLoadPlan(taskGroups);
}
Also used : ArrayList(java.util.ArrayList) GroupTask(com.android.quickstep.util.GroupTask) TaskKey(com.android.systemui.shared.recents.model.Task.TaskKey)

Aggregations

GroupTask (com.android.quickstep.util.GroupTask)28 ActivityManager (android.app.ActivityManager)16 GroupedRecentTaskInfo (com.android.wm.shell.util.GroupedRecentTaskInfo)16 SmallTest (androidx.test.filters.SmallTest)8 Task (com.android.systemui.shared.recents.model.Task)8 Test (org.junit.Test)8 Point (android.graphics.Point)4 TextPaint (android.text.TextPaint)4 SparseBooleanArray (android.util.SparseBooleanArray)4 VisibleForTesting (androidx.annotation.VisibleForTesting)4 SplitConfigurationOptions (com.android.launcher3.util.SplitConfigurationOptions)4 TaskKey (com.android.systemui.shared.recents.model.Task.TaskKey)4 ArrayList (java.util.ArrayList)4