summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMariia Sandrikova <mariiasand@google.com>2020-11-18 16:47:05 +0000
committerMariia Sandrikova <mariiasand@google.com>2020-11-18 17:09:03 +0000
commit1b44edeea98b63fed3f34d43cccd05eecacb90ce (patch)
tree0c08a91d651c3418d9ac7596c6ea1ab6eed3886e /core/java
parentebaa18e292002b321e974049b11e9617e34f18f7 (diff)
Move TaskInfo comparison from TaskOrganizerController to TaskInfo
Bug: 170216257 Test: atest WMShellUnitTests Change-Id: I7ef6913172f57fbfad116a04e9e324ed9dc6535a
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/TaskInfo.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/java/android/app/TaskInfo.java b/core/java/android/app/TaskInfo.java
index 7fdf06f7233c..da8ac96ef40b 100644
--- a/core/java/android/app/TaskInfo.java
+++ b/core/java/android/app/TaskInfo.java
@@ -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.
@@ -288,6 +289,36 @@ public class TaskInfo {
}
/**
+ * 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.
*/
void readFromParcel(Parcel source) {