From f8b946632b57509c8e14f76e0044024d523d04e2 Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" Date: Wed, 3 Nov 2021 09:51:14 -0700 Subject: [PATCH] Add minWidth, minHeight and minTaskSize to TaskInfo Allows OEMs access to this info in order to send resize requests that comply with the minimal size policies without having to query state via WMS. Bug: 176970585 Test: builds Change-Id: I540e17312b02afd7c4092f32bdf671f473c736cd --- core/java/android/app/TaskInfo.java | 27 +++++++++++++++++++ .../core/java/com/android/server/wm/Task.java | 3 +++ 2 files changed, 30 insertions(+) diff --git a/core/java/android/app/TaskInfo.java b/core/java/android/app/TaskInfo.java index bd9b6e9521189..c0a578b35dfbf 100644 --- a/core/java/android/app/TaskInfo.java +++ b/core/java/android/app/TaskInfo.java @@ -218,6 +218,24 @@ public class TaskInfo { */ public boolean isResizeable; + /** + * Minimal width of the task when it's resizeable. + * @hide + */ + public int minWidth; + + /** + * Minimal height of the task when it's resizeable. + * @hide + */ + public int minHeight; + + /** + * The default minimal size of the task used when a minWidth or minHeight is not specified. + * @hide + */ + public int defaultMinSize; + /** * Relative position of the task's top left corner in the parent container. * @hide @@ -418,6 +436,9 @@ public class TaskInfo { displayCutoutInsets = source.readTypedObject(Rect.CREATOR); topActivityInfo = source.readTypedObject(ActivityInfo.CREATOR); isResizeable = source.readBoolean(); + minWidth = source.readInt(); + minHeight = source.readInt(); + defaultMinSize = source.readInt(); source.readBinderList(launchCookies); positionInParent = source.readTypedObject(Point.CREATOR); parentTaskId = source.readInt(); @@ -458,6 +479,9 @@ public class TaskInfo { dest.writeTypedObject(displayCutoutInsets, flags); dest.writeTypedObject(topActivityInfo, flags); dest.writeBoolean(isResizeable); + dest.writeInt(minWidth); + dest.writeInt(minHeight); + dest.writeInt(defaultMinSize); dest.writeBinderList(launchCookies); dest.writeTypedObject(positionInParent, flags); dest.writeInt(parentTaskId); @@ -483,6 +507,9 @@ public class TaskInfo { + " supportsMultiWindow=" + supportsMultiWindow + " resizeMode=" + resizeMode + " isResizeable=" + isResizeable + + " minWidth=" + minWidth + + " minHeight=" + minHeight + + " defaultMinSize=" + defaultMinSize + " token=" + token + " topActivityType=" + topActivityType + " pictureInPictureParams=" + pictureInPictureParams diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 9767c8ba7ac65..fa14107205260 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -3361,6 +3361,9 @@ class Task extends TaskFragment { info.resizeMode = top != null ? top.mResizeMode : mResizeMode; info.topActivityType = top.getActivityType(); info.isResizeable = isResizeable(); + info.minWidth = mMinWidth; + info.minHeight = mMinHeight; + info.defaultMinSize = mRootWindowContainer.mDefaultMinSizeOfResizeableTaskDp; info.positionInParent = getRelativePosition();