Loading services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +21 −22 Original line number Diff line number Diff line Loading @@ -277,31 +277,29 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { // is set with the suggestedDisplayArea. If it is set, but the eventual TaskDisplayArea is // different, we should recalcuating the bounds. boolean hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = false; // shouldSetAsOverrideWindowingMode is set if the task needs to retain the launchMode // regardless of the windowing mode of the parent. boolean shouldSetAsOverrideWindowingMode = false; if (suggestedDisplayArea.inFreeformWindowingMode()) { if (launchMode == WINDOWING_MODE_PINNED) { if (DEBUG) appendLog("picture-in-picture"); } else if (!root.isResizeable()) { if (shouldLaunchUnresizableAppInFreeformInFreeformMode(root, suggestedDisplayArea, options)) { launchMode = WINDOWING_MODE_UNDEFINED; if (shouldLaunchUnresizableAppInFreeform(root, suggestedDisplayArea, options)) { launchMode = WINDOWING_MODE_FREEFORM; if (outParams.mBounds.isEmpty()) { getTaskBounds(root, suggestedDisplayArea, layout, launchMode, hasInitialBounds, outParams.mBounds); getTaskBounds(root, suggestedDisplayArea, layout, launchMode, hasInitialBounds, outParams.mBounds); hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = true; } if (DEBUG) appendLog("unresizable-freeform"); } else { launchMode = WINDOWING_MODE_FULLSCREEN; outParams.mBounds.setEmpty(); shouldSetAsOverrideWindowingMode = true; if (DEBUG) appendLog("unresizable-forced-maximize"); } } } else { if (DEBUG) appendLog("non-freeform-task-display-area"); } // If launch mode matches display windowing mode, let it inherit from display. outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode() && !shouldSetAsOverrideWindowingMode ? WINDOWING_MODE_UNDEFINED : launchMode; if (phase == PHASE_WINDOWING_MODE) { Loading Loading @@ -652,7 +650,7 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { inOutBounds.offset(xOffset, yOffset); } private boolean shouldLaunchUnresizableAppInFreeformInFreeformMode(ActivityRecord activity, private boolean shouldLaunchUnresizableAppInFreeform(ActivityRecord activity, TaskDisplayArea displayArea, @Nullable ActivityOptions options) { if (options != null && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN) { // Do not launch the activity in freeform if it explicitly requested fullscreen mode. Loading @@ -665,7 +663,8 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { final int displayOrientation = orientationFromBounds(displayArea.getBounds()); final int activityOrientation = resolveOrientation(activity, displayArea, displayArea.getBounds()); if (displayOrientation != activityOrientation) { if (displayArea.getWindowingMode() == WINDOWING_MODE_FREEFORM && displayOrientation != activityOrientation) { return true; } Loading services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +5 −37 Original line number Diff line number Diff line Loading @@ -825,11 +825,10 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { } @Test public void testLaunchesPortraitUnresizableOnFreeformLandscapeDisplay() { public void testLaunchesPortraitUnresizableOnFreeformDisplayWithFreeformSizeCompat() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; Loading @@ -837,42 +836,12 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_UNDEFINED, mResult.mWindowingMode); } @Test public void testLaunchesLandscapeUnresizableOnFreeformLandscapeDisplay() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; mActivity.info.screenOrientation = SCREEN_ORIENTATION_LANDSCAPE; assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); } @Test public void testLaunchesUndefinedUnresizableOnFreeformLandscapeDisplay() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode, WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); } @Test public void testForceMaximizingAppsOnNonFreeformDisplay() { public void testSkipsForceMaximizingAppsOnNonFreeformDisplay() { final ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM); options.setLaunchBounds(new Rect(0, 0, 200, 100)); Loading @@ -886,9 +855,8 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); // Non-resizable apps must be launched in fullscreen in a fullscreen display regardless of // other properties. assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode, WINDOWING_MODE_FULLSCREEN); } @Test Loading Loading
services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java +21 −22 Original line number Diff line number Diff line Loading @@ -277,31 +277,29 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { // is set with the suggestedDisplayArea. If it is set, but the eventual TaskDisplayArea is // different, we should recalcuating the bounds. boolean hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = false; // shouldSetAsOverrideWindowingMode is set if the task needs to retain the launchMode // regardless of the windowing mode of the parent. boolean shouldSetAsOverrideWindowingMode = false; if (suggestedDisplayArea.inFreeformWindowingMode()) { if (launchMode == WINDOWING_MODE_PINNED) { if (DEBUG) appendLog("picture-in-picture"); } else if (!root.isResizeable()) { if (shouldLaunchUnresizableAppInFreeformInFreeformMode(root, suggestedDisplayArea, options)) { launchMode = WINDOWING_MODE_UNDEFINED; if (shouldLaunchUnresizableAppInFreeform(root, suggestedDisplayArea, options)) { launchMode = WINDOWING_MODE_FREEFORM; if (outParams.mBounds.isEmpty()) { getTaskBounds(root, suggestedDisplayArea, layout, launchMode, hasInitialBounds, outParams.mBounds); getTaskBounds(root, suggestedDisplayArea, layout, launchMode, hasInitialBounds, outParams.mBounds); hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = true; } if (DEBUG) appendLog("unresizable-freeform"); } else { launchMode = WINDOWING_MODE_FULLSCREEN; outParams.mBounds.setEmpty(); shouldSetAsOverrideWindowingMode = true; if (DEBUG) appendLog("unresizable-forced-maximize"); } } } else { if (DEBUG) appendLog("non-freeform-task-display-area"); } // If launch mode matches display windowing mode, let it inherit from display. outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode() && !shouldSetAsOverrideWindowingMode ? WINDOWING_MODE_UNDEFINED : launchMode; if (phase == PHASE_WINDOWING_MODE) { Loading Loading @@ -652,7 +650,7 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { inOutBounds.offset(xOffset, yOffset); } private boolean shouldLaunchUnresizableAppInFreeformInFreeformMode(ActivityRecord activity, private boolean shouldLaunchUnresizableAppInFreeform(ActivityRecord activity, TaskDisplayArea displayArea, @Nullable ActivityOptions options) { if (options != null && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN) { // Do not launch the activity in freeform if it explicitly requested fullscreen mode. Loading @@ -665,7 +663,8 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier { final int displayOrientation = orientationFromBounds(displayArea.getBounds()); final int activityOrientation = resolveOrientation(activity, displayArea, displayArea.getBounds()); if (displayOrientation != activityOrientation) { if (displayArea.getWindowingMode() == WINDOWING_MODE_FREEFORM && displayOrientation != activityOrientation) { return true; } Loading
services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java +5 −37 Original line number Diff line number Diff line Loading @@ -825,11 +825,10 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { } @Test public void testLaunchesPortraitUnresizableOnFreeformLandscapeDisplay() { public void testLaunchesPortraitUnresizableOnFreeformDisplayWithFreeformSizeCompat() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; Loading @@ -837,42 +836,12 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_UNDEFINED, mResult.mWindowingMode); } @Test public void testLaunchesLandscapeUnresizableOnFreeformLandscapeDisplay() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; mActivity.info.screenOrientation = SCREEN_ORIENTATION_LANDSCAPE; assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); } @Test public void testLaunchesUndefinedUnresizableOnFreeformLandscapeDisplay() { mAtm.mDevEnableNonResizableMultiWindow = true; final TestDisplayContent freeformDisplay = createNewDisplayContent( assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode, WINDOWING_MODE_FREEFORM); assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height()); final ActivityOptions options = ActivityOptions.makeBasic(); mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea(); mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE; assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); } @Test public void testForceMaximizingAppsOnNonFreeformDisplay() { public void testSkipsForceMaximizingAppsOnNonFreeformDisplay() { final ActivityOptions options = ActivityOptions.makeBasic(); options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM); options.setLaunchBounds(new Rect(0, 0, 200, 100)); Loading @@ -886,9 +855,8 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase { assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setOptions(options).calculate()); // Non-resizable apps must be launched in fullscreen in a fullscreen display regardless of // other properties. assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode); assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode, WINDOWING_MODE_FULLSCREEN); } @Test Loading