Loading core/java/android/app/WindowConfiguration.java +9 −1 Original line number Diff line number Diff line Loading @@ -495,7 +495,15 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu * @hide */ public boolean tasksAreFloating() { return mWindowingMode == WINDOWING_MODE_FREEFORM || mWindowingMode == WINDOWING_MODE_PINNED; return isFloating(mWindowingMode); } /** * Returns true if the windowingMode represents a floating window. * @hide */ public static boolean isFloating(int windowingMode) { return windowingMode == WINDOWING_MODE_FREEFORM || windowingMode == WINDOWING_MODE_PINNED; } /** Loading services/core/java/com/android/server/am/TaskRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -1820,7 +1820,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi final StackWindowController stackController = mStack.getWindowContainerController(); stackController.adjustConfigurationForBounds(bounds, insetBounds, mTmpNonDecorBounds, mTmpStableBounds, overrideWidth, overrideHeight, density, config, parentConfig); config, parentConfig, getWindowingMode()); } else { throw new IllegalArgumentException("Expected stack when calculating override config"); } Loading services/core/java/com/android/server/wm/StackWindowController.java +13 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import android.app.WindowConfiguration; import android.content.res.Configuration; import android.graphics.Rect; import android.os.Handler; Loading Loading @@ -244,12 +245,15 @@ public class StackWindowController } /** * Adjusts the screen size in dp's for the {@param config} for the given params. * Adjusts the screen size in dp's for the {@param config} for the given params. The provided * params represent the desired state of a configuration change. Since this utility is used * before mContainer has been updated, any relevant properties (like {@param windowingMode}) * need to be passed in. */ public void adjustConfigurationForBounds(Rect bounds, Rect insetBounds, Rect nonDecorBounds, Rect stableBounds, boolean overrideWidth, boolean overrideHeight, float density, Configuration config, Configuration parentConfig) { Configuration parentConfig, int windowingMode) { synchronized (mWindowMap) { final TaskStack stack = mContainer; final DisplayContent displayContent = stack.getDisplayContent(); Loading @@ -272,10 +276,10 @@ public class StackWindowController config.windowConfiguration.setAppBounds(!bounds.isEmpty() ? bounds : null); boolean intersectParentBounds = false; if (stack.getWindowConfiguration().tasksAreFloating()) { if (WindowConfiguration.isFloating(windowingMode)) { // Floating tasks should not be resized to the screen's bounds. if (stack.inPinnedWindowingMode() if (windowingMode == WindowConfiguration.WINDOWING_MODE_PINNED && bounds.width() == mTmpDisplayBounds.width() && bounds.height() == mTmpDisplayBounds.height()) { // If the bounds we are animating is the same as the fullscreen stack Loading Loading @@ -316,7 +320,7 @@ public class StackWindowController config.screenWidthDp = width; config.screenHeightDp = height; config.smallestScreenWidthDp = getSmallestWidthForTaskBounds( insetBounds != null ? insetBounds : bounds, density); insetBounds != null ? insetBounds : bounds, density, windowingMode); } } Loading @@ -338,11 +342,12 @@ public class StackWindowController } /** * Calculates the smallest width for a task given the {@param bounds}. * Calculates the smallest width for a task given the target {@param bounds} and * {@param windowingMode}. Avoid using values from mContainer since they can be out-of-date. * * @return the smallest width to be used in the Configuration, in dips */ private int getSmallestWidthForTaskBounds(Rect bounds, float density) { private int getSmallestWidthForTaskBounds(Rect bounds, float density, int windowingMode) { final DisplayContent displayContent = mContainer.getDisplayContent(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); Loading @@ -350,7 +355,7 @@ public class StackWindowController bounds.height() == displayInfo.logicalHeight)) { // If the bounds are fullscreen, return the value of the fullscreen configuration return displayContent.getConfiguration().smallestScreenWidthDp; } else if (mContainer.getWindowConfiguration().tasksAreFloating()) { } else if (WindowConfiguration.isFloating(windowingMode)) { // For floating tasks, calculate the smallest width from the bounds of the task return (int) (Math.min(bounds.width(), bounds.height()) / density); } else { Loading services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java +2 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,8 @@ public class WindowConfigurationTests extends WindowTestsBase { final WindowConfiguration winConfig = config.windowConfiguration; stackController.adjustConfigurationForBounds(bounds, null /*insetBounds*/, new Rect() /*nonDecorBounds*/, new Rect() /*stableBounds*/, false /*overrideWidth*/, false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig); false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig, windowingMode); // Assert that both expected and actual are null or are equal to each other assertEquals(expectedConfigBounds, winConfig.getAppBounds()); Loading services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static com.android.server.wm.WindowContainer.POSITION_TOP; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyBoolean; import static org.mockito.Mockito.anyFloat; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; Loading Loading @@ -72,7 +73,7 @@ public class WindowTestUtils { config.windowConfiguration.setBounds(bounds); return null; }).when(controller).adjustConfigurationForBounds(any(), any(), any(), any(), anyBoolean(), anyBoolean(), anyFloat(), any(), any()); anyBoolean(), anyBoolean(), anyFloat(), any(), any(), anyInt()); return controller; } Loading Loading
core/java/android/app/WindowConfiguration.java +9 −1 Original line number Diff line number Diff line Loading @@ -495,7 +495,15 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu * @hide */ public boolean tasksAreFloating() { return mWindowingMode == WINDOWING_MODE_FREEFORM || mWindowingMode == WINDOWING_MODE_PINNED; return isFloating(mWindowingMode); } /** * Returns true if the windowingMode represents a floating window. * @hide */ public static boolean isFloating(int windowingMode) { return windowingMode == WINDOWING_MODE_FREEFORM || windowingMode == WINDOWING_MODE_PINNED; } /** Loading
services/core/java/com/android/server/am/TaskRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -1820,7 +1820,7 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi final StackWindowController stackController = mStack.getWindowContainerController(); stackController.adjustConfigurationForBounds(bounds, insetBounds, mTmpNonDecorBounds, mTmpStableBounds, overrideWidth, overrideHeight, density, config, parentConfig); config, parentConfig, getWindowingMode()); } else { throw new IllegalArgumentException("Expected stack when calculating override config"); } Loading
services/core/java/com/android/server/wm/StackWindowController.java +13 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import android.app.WindowConfiguration; import android.content.res.Configuration; import android.graphics.Rect; import android.os.Handler; Loading Loading @@ -244,12 +245,15 @@ public class StackWindowController } /** * Adjusts the screen size in dp's for the {@param config} for the given params. * Adjusts the screen size in dp's for the {@param config} for the given params. The provided * params represent the desired state of a configuration change. Since this utility is used * before mContainer has been updated, any relevant properties (like {@param windowingMode}) * need to be passed in. */ public void adjustConfigurationForBounds(Rect bounds, Rect insetBounds, Rect nonDecorBounds, Rect stableBounds, boolean overrideWidth, boolean overrideHeight, float density, Configuration config, Configuration parentConfig) { Configuration parentConfig, int windowingMode) { synchronized (mWindowMap) { final TaskStack stack = mContainer; final DisplayContent displayContent = stack.getDisplayContent(); Loading @@ -272,10 +276,10 @@ public class StackWindowController config.windowConfiguration.setAppBounds(!bounds.isEmpty() ? bounds : null); boolean intersectParentBounds = false; if (stack.getWindowConfiguration().tasksAreFloating()) { if (WindowConfiguration.isFloating(windowingMode)) { // Floating tasks should not be resized to the screen's bounds. if (stack.inPinnedWindowingMode() if (windowingMode == WindowConfiguration.WINDOWING_MODE_PINNED && bounds.width() == mTmpDisplayBounds.width() && bounds.height() == mTmpDisplayBounds.height()) { // If the bounds we are animating is the same as the fullscreen stack Loading Loading @@ -316,7 +320,7 @@ public class StackWindowController config.screenWidthDp = width; config.screenHeightDp = height; config.smallestScreenWidthDp = getSmallestWidthForTaskBounds( insetBounds != null ? insetBounds : bounds, density); insetBounds != null ? insetBounds : bounds, density, windowingMode); } } Loading @@ -338,11 +342,12 @@ public class StackWindowController } /** * Calculates the smallest width for a task given the {@param bounds}. * Calculates the smallest width for a task given the target {@param bounds} and * {@param windowingMode}. Avoid using values from mContainer since they can be out-of-date. * * @return the smallest width to be used in the Configuration, in dips */ private int getSmallestWidthForTaskBounds(Rect bounds, float density) { private int getSmallestWidthForTaskBounds(Rect bounds, float density, int windowingMode) { final DisplayContent displayContent = mContainer.getDisplayContent(); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); Loading @@ -350,7 +355,7 @@ public class StackWindowController bounds.height() == displayInfo.logicalHeight)) { // If the bounds are fullscreen, return the value of the fullscreen configuration return displayContent.getConfiguration().smallestScreenWidthDp; } else if (mContainer.getWindowConfiguration().tasksAreFloating()) { } else if (WindowConfiguration.isFloating(windowingMode)) { // For floating tasks, calculate the smallest width from the bounds of the task return (int) (Math.min(bounds.width(), bounds.height()) / density); } else { Loading
services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java +2 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,8 @@ public class WindowConfigurationTests extends WindowTestsBase { final WindowConfiguration winConfig = config.windowConfiguration; stackController.adjustConfigurationForBounds(bounds, null /*insetBounds*/, new Rect() /*nonDecorBounds*/, new Rect() /*stableBounds*/, false /*overrideWidth*/, false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig); false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig, windowingMode); // Assert that both expected and actual are null or are equal to each other assertEquals(expectedConfigBounds, winConfig.getAppBounds()); Loading
services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java +2 −1 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static com.android.server.wm.WindowContainer.POSITION_TOP; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyBoolean; import static org.mockito.Mockito.anyFloat; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; Loading Loading @@ -72,7 +73,7 @@ public class WindowTestUtils { config.windowConfiguration.setBounds(bounds); return null; }).when(controller).adjustConfigurationForBounds(any(), any(), any(), any(), anyBoolean(), anyBoolean(), anyFloat(), any(), any()); anyBoolean(), anyBoolean(), anyFloat(), any(), any(), anyInt()); return controller; } Loading