Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ece9a1f6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Avoid using secondary displays as launch params when not support"

parents a3bd7186 740448f0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -294,6 +294,10 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {

    private int getPreferredLaunchDisplay(@Nullable TaskRecord task,
            @Nullable ActivityOptions options, ActivityRecord source, LaunchParams currentParams) {
        if (!mSupervisor.mService.mSupportsMultiDisplay) {
            return DEFAULT_DISPLAY;
        }

        int displayId = INVALID_DISPLAY;
        final int optionLaunchId = options != null ? options.getLaunchDisplayId() : INVALID_DISPLAY;
        if (optionLaunchId != INVALID_DISPLAY) {
+16 −0
Original line number Diff line number Diff line
@@ -1251,6 +1251,22 @@ public class TaskLaunchParamsModifierTests extends ActivityTestsBase {
        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) {
        final TestActivityDisplay display = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP);
        display.setWindowingMode(windowingMode);