Add ability to get tasks per displayId
Automotive usually have multiple displays and getting top x tasks might still miss the most recent running task (excluding the recents activity itself). Bug: 271497478 Bug: 271166940 Test: manual Change-Id: I45cb7bee7be10a0ab883ee056291e263da8f522f
This commit is contained in:
@@ -18,7 +18,6 @@ package com.android.systemui.shared.system;
|
||||
|
||||
import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
|
||||
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
|
||||
import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
|
||||
import static android.app.ActivityTaskManager.getService;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
@@ -45,6 +44,7 @@ import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.IRecentsAnimationController;
|
||||
import android.view.IRecentsAnimationRunner;
|
||||
import android.view.RemoteAnimationTarget;
|
||||
@@ -111,6 +111,13 @@ public class ActivityManagerWrapper {
|
||||
return tasks.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #getRunningTasks(boolean , int)
|
||||
*/
|
||||
public ActivityManager.RunningTaskInfo[] getRunningTasks(boolean filterOnlyVisibleRecents) {
|
||||
return getRunningTasks(filterOnlyVisibleRecents, Display.INVALID_DISPLAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* We ask for {@link #NUM_RECENT_ACTIVITIES_REQUEST} activities because when in split screen,
|
||||
* we'll get back 2 activities for each split app and one for launcher. Launcher might be more
|
||||
@@ -120,10 +127,12 @@ public class ActivityManagerWrapper {
|
||||
* @return an array of up to {@link #NUM_RECENT_ACTIVITIES_REQUEST} running tasks
|
||||
* filtering only for tasks that can be visible in the recent tasks list.
|
||||
*/
|
||||
public ActivityManager.RunningTaskInfo[] getRunningTasks(boolean filterOnlyVisibleRecents) {
|
||||
public ActivityManager.RunningTaskInfo[] getRunningTasks(boolean filterOnlyVisibleRecents,
|
||||
int displayId) {
|
||||
// Note: The set of running tasks from the system is ordered by recency
|
||||
List<ActivityManager.RunningTaskInfo> tasks =
|
||||
mAtm.getTasks(NUM_RECENT_ACTIVITIES_REQUEST, filterOnlyVisibleRecents);
|
||||
mAtm.getTasks(NUM_RECENT_ACTIVITIES_REQUEST,
|
||||
filterOnlyVisibleRecents, /* keepInExtras= */ false, displayId);
|
||||
return tasks.toArray(new RunningTaskInfo[tasks.size()]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user