From 27fac1657e111d37aa7dbf5c5edd5d11655a44db Mon Sep 17 00:00:00 2001 From: xpeng Date: Wed, 31 Aug 2022 17:59:56 +0800 Subject: [PATCH] Update strategy for orientation Signed-off-by: xpeng --- dmserver/src/screen_rotation_controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dmserver/src/screen_rotation_controller.cpp b/dmserver/src/screen_rotation_controller.cpp index 03d68c40..7f843b2d 100644 --- a/dmserver/src/screen_rotation_controller.cpp +++ b/dmserver/src/screen_rotation_controller.cpp @@ -286,7 +286,7 @@ DeviceRotation ScreenRotationController::CalcDeviceRotation(SensorRotation senso bool ScreenRotationController::IsSensorRelatedOrientation(Orientation orientation) { - if ((orientation >= Orientation::VERTICAL && orientation <= Orientation::REVERSE_HORIZONTAL) || + if ((orientation >= Orientation::UNSPECIFIED && orientation <= Orientation::REVERSE_HORIZONTAL) || orientation == Orientation::LOCKED) { return false; } @@ -301,7 +301,6 @@ void ScreenRotationController::ProcessSwitchToSensorRelatedOrientation( } lastOrientationType_ = orientation; switch (orientation) { - case Orientation::UNSPECIFIED: case Orientation::AUTO_ROTATION_RESTRICTED: { if (isScreenRotationLocked_) { SetScreenRotation(rotationLockedRotation_); @@ -499,6 +498,10 @@ void ScreenRotationController::ProcessSwitchToSensorUnrelatedOrientation(Orienta } lastOrientationType_ = orientation; switch (orientation) { + case Orientation::UNSPECIFIED: { + SetScreenRotation(Rotation::ROTATION_0); + break; + } case Orientation::VERTICAL: { SetScreenRotation(ConvertDeviceToDisplayRotation(DeviceRotation::ROTATION_PORTRAIT)); break; -- Gitee