Merge "Fix win mode issues for unresizable apps" into tm-qpr-dev am: c502685f7a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19415032 Change-Id: Ia5ee9e1cc16dcd23caf5ff0c9974c5ed39a639ad Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -278,29 +278,31 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
|
|||||||
// is set with the suggestedDisplayArea. If it is set, but the eventual TaskDisplayArea is
|
// is set with the suggestedDisplayArea. If it is set, but the eventual TaskDisplayArea is
|
||||||
// different, we should recalcuating the bounds.
|
// different, we should recalcuating the bounds.
|
||||||
boolean hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = false;
|
boolean hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = false;
|
||||||
if (suggestedDisplayArea.inFreeformWindowingMode()) {
|
// shouldSetAsOverrideWindowingMode is set if the task needs to retain the launchMode
|
||||||
|
// regardless of the windowing mode of the parent.
|
||||||
|
boolean shouldSetAsOverrideWindowingMode = false;
|
||||||
if (launchMode == WINDOWING_MODE_PINNED) {
|
if (launchMode == WINDOWING_MODE_PINNED) {
|
||||||
if (DEBUG) appendLog("picture-in-picture");
|
if (DEBUG) appendLog("picture-in-picture");
|
||||||
} else if (!root.isResizeable()) {
|
} else if (!root.isResizeable()) {
|
||||||
if (shouldLaunchUnresizableAppInFreeform(root, suggestedDisplayArea, options)) {
|
if (shouldLaunchUnresizableAppInFreeformInFreeformMode(root, suggestedDisplayArea,
|
||||||
launchMode = WINDOWING_MODE_FREEFORM;
|
options)) {
|
||||||
|
launchMode = WINDOWING_MODE_UNDEFINED;
|
||||||
if (outParams.mBounds.isEmpty()) {
|
if (outParams.mBounds.isEmpty()) {
|
||||||
getTaskBounds(root, suggestedDisplayArea, layout, launchMode,
|
getTaskBounds(root, suggestedDisplayArea, layout, launchMode, hasInitialBounds,
|
||||||
hasInitialBounds, outParams.mBounds);
|
outParams.mBounds);
|
||||||
hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = true;
|
hasInitialBoundsForSuggestedDisplayAreaInFreeformMode = true;
|
||||||
}
|
}
|
||||||
if (DEBUG) appendLog("unresizable-freeform");
|
if (DEBUG) appendLog("unresizable-freeform");
|
||||||
} else {
|
} else {
|
||||||
launchMode = WINDOWING_MODE_FULLSCREEN;
|
launchMode = WINDOWING_MODE_FULLSCREEN;
|
||||||
outParams.mBounds.setEmpty();
|
outParams.mBounds.setEmpty();
|
||||||
|
shouldSetAsOverrideWindowingMode = true;
|
||||||
if (DEBUG) appendLog("unresizable-forced-maximize");
|
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.
|
// If launch mode matches display windowing mode, let it inherit from display.
|
||||||
outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode()
|
outParams.mWindowingMode = launchMode == suggestedDisplayArea.getWindowingMode()
|
||||||
|
&& !shouldSetAsOverrideWindowingMode
|
||||||
? WINDOWING_MODE_UNDEFINED : launchMode;
|
? WINDOWING_MODE_UNDEFINED : launchMode;
|
||||||
|
|
||||||
if (phase == PHASE_WINDOWING_MODE) {
|
if (phase == PHASE_WINDOWING_MODE) {
|
||||||
@@ -667,7 +669,7 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
|
|||||||
inOutBounds.offset(xOffset, yOffset);
|
inOutBounds.offset(xOffset, yOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldLaunchUnresizableAppInFreeform(ActivityRecord activity,
|
private boolean shouldLaunchUnresizableAppInFreeformInFreeformMode(ActivityRecord activity,
|
||||||
TaskDisplayArea displayArea, @Nullable ActivityOptions options) {
|
TaskDisplayArea displayArea, @Nullable ActivityOptions options) {
|
||||||
if (options != null && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
|
if (options != null && options.getLaunchWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
|
||||||
// Do not launch the activity in freeform if it explicitly requested fullscreen mode.
|
// Do not launch the activity in freeform if it explicitly requested fullscreen mode.
|
||||||
@@ -680,8 +682,7 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
|
|||||||
final int displayOrientation = orientationFromBounds(displayArea.getBounds());
|
final int displayOrientation = orientationFromBounds(displayArea.getBounds());
|
||||||
final int activityOrientation = resolveOrientation(activity, displayArea,
|
final int activityOrientation = resolveOrientation(activity, displayArea,
|
||||||
displayArea.getBounds());
|
displayArea.getBounds());
|
||||||
if (displayArea.getWindowingMode() == WINDOWING_MODE_FREEFORM
|
if (displayOrientation != activityOrientation) {
|
||||||
&& displayOrientation != activityOrientation) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -893,10 +893,11 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLaunchesPortraitUnresizableOnFreeformDisplayWithFreeformSizeCompat() {
|
public void testLaunchesPortraitUnresizableOnFreeformLandscapeDisplay() {
|
||||||
mAtm.mDevEnableNonResizableMultiWindow = true;
|
mAtm.mDevEnableNonResizableMultiWindow = true;
|
||||||
final TestDisplayContent freeformDisplay = createNewDisplayContent(
|
final TestDisplayContent freeformDisplay = createNewDisplayContent(
|
||||||
WINDOWING_MODE_FREEFORM);
|
WINDOWING_MODE_FREEFORM);
|
||||||
|
assertTrue(freeformDisplay.getBounds().width() > freeformDisplay.getBounds().height());
|
||||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||||
mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea();
|
mCurrent.mPreferredTaskDisplayArea = freeformDisplay.getDefaultTaskDisplayArea();
|
||||||
mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
|
mActivity.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
|
||||||
@@ -904,12 +905,42 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
|
|||||||
assertEquals(RESULT_CONTINUE,
|
assertEquals(RESULT_CONTINUE,
|
||||||
new CalculateRequestBuilder().setOptions(options).calculate());
|
new CalculateRequestBuilder().setOptions(options).calculate());
|
||||||
|
|
||||||
assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode,
|
assertEquals(WINDOWING_MODE_UNDEFINED, mResult.mWindowingMode);
|
||||||
WINDOWING_MODE_FREEFORM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSkipsForceMaximizingAppsOnNonFreeformDisplay() {
|
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(
|
||||||
|
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() {
|
||||||
final ActivityOptions options = ActivityOptions.makeBasic();
|
final ActivityOptions options = ActivityOptions.makeBasic();
|
||||||
options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
|
options.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
|
||||||
options.setLaunchBounds(new Rect(0, 0, 200, 100));
|
options.setLaunchBounds(new Rect(0, 0, 200, 100));
|
||||||
@@ -923,8 +954,9 @@ public class TaskLaunchParamsModifierTests extends WindowTestsBase {
|
|||||||
assertEquals(RESULT_CONTINUE,
|
assertEquals(RESULT_CONTINUE,
|
||||||
new CalculateRequestBuilder().setOptions(options).calculate());
|
new CalculateRequestBuilder().setOptions(options).calculate());
|
||||||
|
|
||||||
assertEquivalentWindowingMode(WINDOWING_MODE_FREEFORM, mResult.mWindowingMode,
|
// Non-resizable apps must be launched in fullscreen in a fullscreen display regardless of
|
||||||
WINDOWING_MODE_FULLSCREEN);
|
// other properties.
|
||||||
|
assertEquals(WINDOWING_MODE_FULLSCREEN, mResult.mWindowingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user