Move TaskInfo comparison from TaskOrganizerController to TaskInfo

Bug: 170216257
Test: atest WMShellUnitTests
Change-Id: I7ef6913172f57fbfad116a04e9e324ed9dc6535a
This commit is contained in:
Mariia Sandrikova
2020-11-18 16:47:05 +00:00
parent ebaa18e292
commit 1b44edeea9
2 changed files with 32 additions and 26 deletions

View File

@@ -36,6 +36,7 @@ import android.util.Log;
import android.window.WindowContainerToken;
import java.util.ArrayList;
import java.util.Objects;
/**
* Stores information about a particular Task.
@@ -287,6 +288,36 @@ public class TaskInfo {
return parentTaskId != INVALID_TASK_ID;
}
/**
* Returns {@code true} if parameters that are important for task organizers have changed
* and {@link com.android.server.wm.TaskOrginizerController} needs to notify listeners
* about that.
* @hide
*/
public boolean equalsForTaskOrganizer(@Nullable TaskInfo that) {
if (that == null) {
return false;
}
return topActivityType == that.topActivityType
&& isResizeable == that.isResizeable
&& Objects.equals(positionInParent, that.positionInParent)
&& equalsLetterboxParams(that)
&& pictureInPictureParams == that.pictureInPictureParams
&& getWindowingMode() == that.getWindowingMode()
&& Objects.equals(taskDescription, that.taskDescription);
}
private boolean equalsLetterboxParams(TaskInfo that) {
return Objects.equals(letterboxActivityBounds, that.letterboxActivityBounds)
&& Objects.equals(
getConfiguration().windowConfiguration.getBounds(),
that.getConfiguration().windowConfiguration.getBounds())
&& Objects.equals(
getConfiguration().windowConfiguration.getMaxBounds(),
that.getConfiguration().windowConfiguration.getMaxBounds())
&& Objects.equals(parentBounds, that.parentBounds);
}
/**
* Reads the TaskInfo from a parcel.
*/