Update strategy for orientation

Signed-off-by: xpeng <pengxin33@huawei.com>
This commit is contained in:
xpeng
2022-08-31 17:59:56 +08:00
parent e9e697f3a1
commit c5781acd38
+5 -2
View File
@@ -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;