add constraints for map

Signed-off-by: xpeng <pengxin33@huawei.com>
Change-Id: Ib4cb5015022812e99726b8939b144aeedde8cb9b
This commit is contained in:
xpeng
2022-08-05 11:25:48 +08:00
parent 1d52e2c33d
commit 2c701472fb
@@ -413,6 +413,9 @@ SensorRotation ScreenRotationController::CalcSensorRotation(int sensorDegree)
DeviceRotation ScreenRotationController::ConvertSensorToDeviceRotation(SensorRotation sensorRotation)
{
if (sensorToDeviceRotationMap_.empty()) {
ProcessRotationMapping();
}
return sensorToDeviceRotationMap_.at(sensorRotation);
}
@@ -421,6 +424,9 @@ Rotation ScreenRotationController::ConvertDeviceToDisplayRotation(DeviceRotation
if (deviceRotation == DeviceRotation::INVALID) {
return GetCurrentDisplayRotation();
}
if (deviceToDisplayRotationMap_.empty()) {
ProcessRotationMapping();
}
return deviceToDisplayRotationMap_.at(deviceRotation);
}