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

Commit e3fb7e80 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Turn off display-ignore-orientation by default value if it was set" into main

parents 8c3094b0 6448cdc5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -440,7 +440,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    private boolean mSandboxDisplayApis = true;

    /** Whether {@link #setIgnoreOrientationRequest} is called to override the default policy. */
    @VisibleForTesting
    boolean mHasSetIgnoreOrientationRequest;

    /**
+3 −0
Original line number Diff line number Diff line
@@ -376,6 +376,9 @@ class DisplayWindowSettings {

        if (settings.mIgnoreOrientationRequest != null) {
            dc.setIgnoreOrientationRequest(settings.mIgnoreOrientationRequest);
        } else if (dc.mHasSetIgnoreOrientationRequest) {
            // Null entry is default behavior, i.e. do not ignore.
            dc.setIgnoreOrientationRequest(false);
        }

        dc.getDisplayRotation().resetAllowAllRotations();
+6 −0
Original line number Diff line number Diff line
@@ -516,6 +516,12 @@ public class DisplayWindowSettingsTests extends WindowTestsBase {
        // Verify that newly created displays are created with correct rotation settings
        assertFalse(dcDontIgnoreOrientation.getIgnoreOrientationRequest());
        assertTrue(dcIgnoreOrientation.getIgnoreOrientationRequest());

        // Verify that once ignore-orientation-request has been set, it can be turned off by
        // applying default value, e.g. the same display switches from large size to small size.
        settingsEntry2.mIgnoreOrientationRequest = null;
        mDisplayWindowSettings.applyRotationSettingsToDisplayLocked(dcIgnoreOrientation);
        assertFalse(dcIgnoreOrientation.getIgnoreOrientationRequest());
    }

    @Test