diff options
| author | 2023-11-23 01:21:34 +0000 | |
|---|---|---|
| committer | 2023-11-23 01:21:34 +0000 | |
| commit | 7b8bd6675ae43dda8e6877ef41b3b31e3975bd6c (patch) | |
| tree | a932c21b7f1a74deccc39242aa4fed8120cd271c | |
| parent | e306e0069a801a82a490ea39775b526fa0f638c1 (diff) | |
| parent | 9cf990e2f22500afdaa31a1450cd32f71638a4f8 (diff) | |
Merge "Set default rotation and boot animation orientation for logical display" into main
| -rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 6 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayRotation.java | 29 |
2 files changed, 24 insertions, 11 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 89776dba7878..820d2b0d607e 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -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") { diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index a1b8949c2582..d37661312cfb 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -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; - } - final DisplayAddress.Physical physicalAddress = (DisplayAddress.Physical) displayAddress; - String syspropValue = SystemProperties.get( - "ro.bootanim.set_orientation_" + physicalAddress.getPhysicalDisplayId(), - "ORIENTATION_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(), ""); + } + if (syspropValue.equals("ORIENTATION_90")) { return Surface.ROTATION_90; } else if (syspropValue.equals("ORIENTATION_180")) { |