Merge "Avoid using secondary displays as launch params when not support" into qt-dev

am: c5568f9aac

Change-Id: I28c1abc4eea843fdbffc95d9bccde910e415a468
This commit is contained in:
bsears
2019-08-08 11:02:43 -07:00
committed by android-build-merger
2 changed files with 20 additions and 0 deletions

View File

@@ -292,6 +292,10 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
private int getPreferredLaunchDisplay(@Nullable TaskRecord task, private int getPreferredLaunchDisplay(@Nullable TaskRecord task,
@Nullable ActivityOptions options, ActivityRecord source, LaunchParams currentParams) { @Nullable ActivityOptions options, ActivityRecord source, LaunchParams currentParams) {
if (!mSupervisor.mService.mSupportsMultiDisplay) {
return DEFAULT_DISPLAY;
}
int displayId = INVALID_DISPLAY; int displayId = INVALID_DISPLAY;
final int optionLaunchId = options != null ? options.getLaunchDisplayId() : INVALID_DISPLAY; final int optionLaunchId = options != null ? options.getLaunchDisplayId() : INVALID_DISPLAY;
if (optionLaunchId != INVALID_DISPLAY) { if (optionLaunchId != INVALID_DISPLAY) {

View File

@@ -1225,6 +1225,22 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
assertEquals(startingBounds, adjustedBounds); assertEquals(startingBounds, adjustedBounds);
} }
@Test
public void testNoMultiDisplaySupports() {
final boolean orgValue = mService.mSupportsMultiDisplay;
final TestActivityDisplay display = createNewActivityDisplay(WINDOWING_MODE_FULLSCREEN);
mCurrent.mPreferredDisplayId = display.mDisplayId;
try {
mService.mSupportsMultiDisplay = false;
assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
mActivity, /* source */ null, /* options */ null, mCurrent, mResult));
assertEquals(DEFAULT_DISPLAY, mResult.mPreferredDisplayId);
} finally {
mService.mSupportsMultiDisplay = orgValue;
}
}
private TestActivityDisplay createNewActivityDisplay(int windowingMode) { private TestActivityDisplay createNewActivityDisplay(int windowingMode) {
final TestActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP); final TestActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
display.setWindowingMode(windowingMode); display.setWindowingMode(windowingMode);