Add task visibility to TaskInfo.

Bug: 165794880
Test: Task visibility is pushed to WM shell.
Change-Id: If518a72c658ffe55b60c82afadfc92b1e7bd2738
This commit is contained in:
Garfield Tan
2020-11-18 12:26:14 -08:00
parent 649ed103cd
commit 42767054cc
2 changed files with 17 additions and 3 deletions

View File

@@ -214,7 +214,6 @@ public class TaskInfo {
*/
public int parentTaskId;
/**
* Parent bounds.
* @hide
@@ -227,6 +226,12 @@ public class TaskInfo {
*/
public boolean isFocused;
/**
* Whether this task is visible.
* @hide
*/
public boolean isVisible;
TaskInfo() {
// Do nothing
}
@@ -311,7 +316,8 @@ public class TaskInfo {
&& pictureInPictureParams == that.pictureInPictureParams
&& getWindowingMode() == that.getWindowingMode()
&& Objects.equals(taskDescription, that.taskDescription)
&& isFocused == that.isFocused;
&& isFocused == that.isFocused
&& isVisible == that.isVisible;
}
private boolean equalsLetterboxParams(TaskInfo that) {
@@ -358,6 +364,7 @@ public class TaskInfo {
parentTaskId = source.readInt();
parentBounds = source.readTypedObject(Rect.CREATOR);
isFocused = source.readBoolean();
isVisible = source.readBoolean();
}
/**
@@ -394,6 +401,7 @@ public class TaskInfo {
dest.writeInt(parentTaskId);
dest.writeTypedObject(parentBounds, flags);
dest.writeBoolean(isFocused);
dest.writeBoolean(isVisible);
}
@Override
@@ -413,12 +421,13 @@ public class TaskInfo {
+ " topActivityType=" + topActivityType
+ " pictureInPictureParams=" + pictureInPictureParams
+ " topActivityInfo=" + topActivityInfo
+ " launchCookies" + launchCookies
+ " launchCookies=" + launchCookies
+ " letterboxActivityBounds=" + letterboxActivityBounds
+ " positionInParent=" + positionInParent
+ " parentTaskId=" + parentTaskId
+ " parentBounds=" + parentBounds
+ " isFocused=" + isFocused
+ " isVisible=" + isVisible
+ "}";
}
}

View File

@@ -4099,6 +4099,7 @@ class Task extends WindowContainer<WindowContainer> {
? rootTask.mTaskId
: INVALID_TASK_ID;
info.isFocused = isFocused();
info.isVisible = hasVisibleChildren();
}
@Nullable PictureInPictureParams getPictureInPictureParams() {
@@ -5764,6 +5765,10 @@ class Task extends WindowContainer<WindowContainer> {
starting, configChanges, preserveWindows, notifyClients, userLeaving),
true /* traverseTopToBottom */);
// Notify WM shell that task visibilities may have changed
forAllTasks(task -> task.dispatchTaskInfoChangedIfNeeded(/* force */ false),
true /* traverseTopToBottom */);
if (mTranslucentActivityWaiting != null &&
mUndrawnActivitiesBelowTopTranslucent.isEmpty()) {
// Nothing is getting drawn or everything was already visible, don't wait for