Merge "Return right activities in getTopVisibleActivities method" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d401d88fe1
@@ -178,6 +178,9 @@ public abstract class ActivityTaskManagerInternal {
|
|||||||
/**
|
/**
|
||||||
* Returns the top activity from each of the currently visible root tasks, and the related task
|
* Returns the top activity from each of the currently visible root tasks, and the related task
|
||||||
* id. The first entry will be the focused activity.
|
* id. The first entry will be the focused activity.
|
||||||
|
*
|
||||||
|
* <p>NOTE: If the top activity is in the split screen, the other activities in the same split
|
||||||
|
* screen will also be returned.
|
||||||
*/
|
*/
|
||||||
public abstract List<ActivityAssistInfo> getTopVisibleActivities();
|
public abstract List<ActivityAssistInfo> getTopVisibleActivities();
|
||||||
|
|
||||||
|
|||||||
@@ -1746,9 +1746,13 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
/**
|
/**
|
||||||
* @return a list of pairs, containing activities and their task id which are the top ones in
|
* @return a list of pairs, containing activities and their task id which are the top ones in
|
||||||
* each visible root task. The first entry will be the focused activity.
|
* each visible root task. The first entry will be the focused activity.
|
||||||
|
*
|
||||||
|
* <p>NOTE: If the top activity is in the split screen, the other activities in the same split
|
||||||
|
* screen will also be returned.
|
||||||
*/
|
*/
|
||||||
List<ActivityAssistInfo> getTopVisibleActivities() {
|
List<ActivityAssistInfo> getTopVisibleActivities() {
|
||||||
final ArrayList<ActivityAssistInfo> topVisibleActivities = new ArrayList<>();
|
final ArrayList<ActivityAssistInfo> topVisibleActivities = new ArrayList<>();
|
||||||
|
final ArrayList<ActivityAssistInfo> activityAssistInfos = new ArrayList<>();
|
||||||
final Task topFocusedRootTask = getTopDisplayFocusedRootTask();
|
final Task topFocusedRootTask = getTopDisplayFocusedRootTask();
|
||||||
// Traverse all displays.
|
// Traverse all displays.
|
||||||
forAllRootTasks(rootTask -> {
|
forAllRootTasks(rootTask -> {
|
||||||
@@ -1756,11 +1760,21 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
if (rootTask.shouldBeVisible(null /* starting */)) {
|
if (rootTask.shouldBeVisible(null /* starting */)) {
|
||||||
final ActivityRecord top = rootTask.getTopNonFinishingActivity();
|
final ActivityRecord top = rootTask.getTopNonFinishingActivity();
|
||||||
if (top != null) {
|
if (top != null) {
|
||||||
ActivityAssistInfo visibleActivity = new ActivityAssistInfo(top);
|
activityAssistInfos.clear();
|
||||||
|
activityAssistInfos.add(new ActivityAssistInfo(top));
|
||||||
|
// Check if the activity on the split screen.
|
||||||
|
final Task adjacentTask = top.getTask().getAdjacentTask();
|
||||||
|
if (adjacentTask != null) {
|
||||||
|
final ActivityRecord adjacentActivityRecord =
|
||||||
|
adjacentTask.getTopNonFinishingActivity();
|
||||||
|
if (adjacentActivityRecord != null) {
|
||||||
|
activityAssistInfos.add(new ActivityAssistInfo(adjacentActivityRecord));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (rootTask == topFocusedRootTask) {
|
if (rootTask == topFocusedRootTask) {
|
||||||
topVisibleActivities.add(0, visibleActivity);
|
topVisibleActivities.addAll(0, activityAssistInfos);
|
||||||
} else {
|
} else {
|
||||||
topVisibleActivities.add(visibleActivity);
|
topVisibleActivities.addAll(activityAssistInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user