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

Commit 6448cdc5 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Turn off display-ignore-orientation by default value if it was set

Otherwise the display is unable to switch from ignore-orientation to
allow-orientation because the display settings won't explicitly declare
the allow case.

Fix: 384858993
Flag: EXEMPT bugfix
Test: atest DisplayWindowSettingsTests# \
            testDisplayRotationSettingsAppliedOnCreation
Change-Id: I49265615ef08baf5c1bf89c2a7544a6e7e1758ef
parent 0e653b42
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