diff options
6 files changed, 20 insertions, 15 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index ac629d066d7d..642813f36a58 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -499,14 +499,14 @@ package android.app { method public int describeContents(); method public int getActivityType(); method @Nullable public android.graphics.Rect getAppBounds(); - method public android.graphics.Rect getBounds(); + method @NonNull public android.graphics.Rect getBounds(); method @NonNull public android.graphics.Rect getMaxBounds(); method public int getRotation(); method public int getWindowingMode(); method public static boolean isFloating(int); method public void setActivityType(int); method public void setAppBounds(@Nullable android.graphics.Rect); - method public void setBounds(android.graphics.Rect); + method public void setBounds(@Nullable android.graphics.Rect); method public void setMaxBounds(@Nullable android.graphics.Rect); method public void setRotation(int); method public void setTo(android.app.WindowConfiguration); diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java index bf238c399ad3..019a1a8cb2a6 100644 --- a/core/java/android/app/WindowConfiguration.java +++ b/core/java/android/app/WindowConfiguration.java @@ -267,12 +267,13 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu } }; - // TODO(b/297672475): make this take @Nullable /** * Sets the bounds to the provided {@link Rect}. + * Passing {@code null} sets the bounds {@link Rect} to empty. + * * @param rect the new bounds value. */ - public void setBounds(Rect rect) { + public void setBounds(@Nullable Rect rect) { if (rect == null) { mBounds.setEmpty(); return; @@ -282,8 +283,10 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu } /** - * Set {@link #mAppBounds} to the input Rect. - * @param rect The rect value to set {@link #mAppBounds} to. + * Sets the app bounds to the provided {@link Rect}. + * Passing {@code null} sets the bounds to {@code null}. + * + * @param rect the new app bounds value. * @see #getAppBounds() */ public void setAppBounds(@Nullable Rect rect) { @@ -297,7 +300,9 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu /** * Sets the maximum bounds to the provided {@link Rect}. - * @param rect the new bounds value. + * Passing {@code null} sets the bounds {@link Rect} to empty. + * + * @param rect the new max bounds value. * @see #getMaxBounds() */ public void setMaxBounds(@Nullable Rect rect) { @@ -364,8 +369,8 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu return mAppBounds; } - // TODO(b/297672475): make this return @NonNull /** @see #setBounds(Rect) */ + @NonNull public Rect getBounds() { return mBounds; } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtilityTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtilityTest.kt index de46b31879ed..5c0e04aecf6c 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtilityTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragPositioningCallbackUtilityTest.kt @@ -76,7 +76,7 @@ class DragPositioningCallbackUtilityTest { minHeight = MIN_HEIGHT defaultMinSize = DEFAULT_MIN displayId = DISPLAY_ID - configuration.windowConfiguration.bounds = STARTING_BOUNDS + configuration.windowConfiguration.setBounds(STARTING_BOUNDS) } mockWindowDecoration.mDisplay = mockDisplay whenever(mockDisplay.displayId).thenAnswer { DISPLAY_ID } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt index 6f0599aa8243..c0c4498e3ebf 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/FluidResizeTaskPositionerTest.kt @@ -88,7 +88,7 @@ class FluidResizeTaskPositionerTest : ShellTestCase() { minHeight = MIN_HEIGHT defaultMinSize = DEFAULT_MIN displayId = DISPLAY_ID - configuration.windowConfiguration.bounds = STARTING_BOUNDS + configuration.windowConfiguration.setBounds(STARTING_BOUNDS) } mockWindowDecoration.mDisplay = mockDisplay whenever(mockDisplay.displayId).thenAnswer { DISPLAY_ID } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt index 3465ddd9d101..8913453aa578 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/VeiledResizeTaskPositionerTest.kt @@ -104,7 +104,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() { minHeight = MIN_HEIGHT defaultMinSize = DEFAULT_MIN displayId = DISPLAY_ID - configuration.windowConfiguration.bounds = STARTING_BOUNDS + configuration.windowConfiguration.setBounds(STARTING_BOUNDS) } mockDesktopWindowDecoration.mDisplay = mockDisplay whenever(mockDisplay.displayId).thenAnswer { DISPLAY_ID } diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotPolicyImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotPolicyImplTest.kt index ee61f5736263..587da2d5d677 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotPolicyImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotPolicyImplTest.kt @@ -140,7 +140,7 @@ class ScreenshotPolicyImplTest : SysuiTestCase() { private val pipTask = RootTaskInfo().apply { configuration.windowConfiguration.apply { windowingMode = WINDOWING_MODE_PINNED - bounds = Rect(628, 1885, 1038, 2295) + setBounds(Rect(628, 1885, 1038, 2295)) activityType = ACTIVITY_TYPE_STANDARD } displayId = DISPLAY_ID @@ -164,7 +164,7 @@ class ScreenshotPolicyImplTest : SysuiTestCase() { private val fullScreenWorkProfileTask = RootTaskInfo().apply { configuration.windowConfiguration.apply { windowingMode = WINDOWING_MODE_FULLSCREEN - bounds = Rect(0, 0, 1080, 2400) + setBounds(Rect(0, 0, 1080, 2400)) activityType = ACTIVITY_TYPE_STANDARD } displayId = DISPLAY_ID @@ -188,7 +188,7 @@ class ScreenshotPolicyImplTest : SysuiTestCase() { private val launcherTask = RootTaskInfo().apply { configuration.windowConfiguration.apply { windowingMode = WINDOWING_MODE_FULLSCREEN - bounds = Rect(0, 0, 1080, 2400) + setBounds(Rect(0, 0, 1080, 2400)) activityType = ACTIVITY_TYPE_HOME } displayId = DISPLAY_ID @@ -212,7 +212,7 @@ class ScreenshotPolicyImplTest : SysuiTestCase() { private val emptyTask = RootTaskInfo().apply { configuration.windowConfiguration.apply { windowingMode = WINDOWING_MODE_FULLSCREEN - bounds = Rect(0, 0, 1080, 2400) + setBounds(Rect(0, 0, 1080, 2400)) activityType = ACTIVITY_TYPE_UNDEFINED } displayId = DISPLAY_ID |