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

Commit 9cf990e2 authored by YoungJoon Yang's avatar YoungJoon Yang
Browse files

Set default rotation and boot animation orientation for logical display

Introduce ro.bootanim.set_orientation_logical_<display_id> allows to
change the default orientation of logical display.

Bug: 272527451
Test: Manual test with all 4 values
Change-Id: I39a0d5df97d5185090b6a793e52ecaa5f3bc0baa
parent 0bc6b1e8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -675,7 +675,11 @@ ui::Rotation BootAnimation::parseOrientationProperty() {
        ss << "ro.bootanim.set_orientation_" << displayId.value;
        return ss.str();
    }();
    const auto syspropValue = android::base::GetProperty(syspropName, "ORIENTATION_0");
    auto syspropValue = android::base::GetProperty(syspropName, "");
    if (syspropValue == "") {
        syspropValue = android::base::GetProperty("ro.bootanim.set_orientation_logical_0", "");
    }

    if (syspropValue == "ORIENTATION_90") {
        return ui::ROTATION_90;
    } else if (syspropValue == "ORIENTATION_180") {
+19 −10
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ public class DisplayRotation {
        mDeskDockRotation = readRotation(R.integer.config_deskDockRotation);
        mUndockedHdmiRotation = readRotation(R.integer.config_undockedHdmiRotation);

        int defaultRotation = readDefaultDisplayRotation(displayAddress);
        int defaultRotation = readDefaultDisplayRotation(displayAddress, displayContent);
        mRotation = defaultRotation;

        mDisplayRotationCoordinator = displayRotationCoordinator;
@@ -327,22 +327,31 @@ public class DisplayRotation {
    }

    // Change the default value to the value specified in the sysprop
    // ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
    // ro.bootanim.set_orientation_<physical_display_id> or
    // ro.bootanim.set_orientation_logical_<logical_display_id>.
    // Four values are supported: ORIENTATION_0,
    // ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
    // If the value isn't specified or is ORIENTATION_0, nothing will be changed.
    // This is needed to support having default orientation different from the natural
    // device orientation. For example, on tablets that may want to keep natural orientation
    // portrait for applications compatibility but have landscape orientation as a default choice
    // from the UX perspective.
    // On watches that may want to keep the wrist orientation as the default.
    @Surface.Rotation
    private int readDefaultDisplayRotation(DisplayAddress displayAddress) {
        if (!(displayAddress instanceof DisplayAddress.Physical)) {
            return Surface.ROTATION_0;
    private int readDefaultDisplayRotation(DisplayAddress displayAddress,
            DisplayContent displayContent) {
        String syspropValue = "";
        if (displayAddress instanceof DisplayAddress.Physical) {
            final DisplayAddress.Physical physicalAddress =
                    (DisplayAddress.Physical) displayAddress;
            syspropValue = SystemProperties.get(
                    "ro.bootanim.set_orientation_" + physicalAddress.getPhysicalDisplayId(), "");
        }
        if ("".equals(syspropValue) && displayContent.isDefaultDisplay) {
            syspropValue = SystemProperties.get(
                    "ro.bootanim.set_orientation_logical_" + displayContent.getDisplayId(), "");
        }
        final DisplayAddress.Physical physicalAddress = (DisplayAddress.Physical) displayAddress;
        String syspropValue = SystemProperties.get(
                "ro.bootanim.set_orientation_" + physicalAddress.getPhysicalDisplayId(),
                "ORIENTATION_0");

        if (syspropValue.equals("ORIENTATION_90")) {
            return Surface.ROTATION_90;
        } else if (syspropValue.equals("ORIENTATION_180")) {