SettingsRoboTests: fix device state rotation related tests

Fixes: 280015539
Test: atest SettingsRoboTests
Change-Id: I0a3cc713f8df0477a172665a60551b456691b17c
This commit is contained in:
Christian Göllner
2023-04-28 15:22:43 +02:00
parent 2b44fc26d1
commit b613cc4a17
3 changed files with 42 additions and 9 deletions

View File

@@ -53,6 +53,7 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadow.api.Shadow;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowSensorPrivacyManager.class)
@@ -171,16 +172,14 @@ public class SmartAutoRotateControllerTest {
}
private void lockDeviceStateRotation() {
mDeviceStateAutoRotateSettingsManager.updateSetting(
/* deviceState= */0, /* rotationLocked= */ true);
mDeviceStateAutoRotateSettingsManager.updateSetting(
/* deviceState= */1, /* rotationLocked= */ true);
ShadowDeviceStateRotationLockSettingsManager shadowManager =
Shadow.extract(mDeviceStateAutoRotateSettingsManager);
shadowManager.setRotationLockedForAllStates(true);
}
private void unlockDeviceStateRotation() {
mDeviceStateAutoRotateSettingsManager.updateSetting(
/* deviceState= */0, /* rotationLocked= */ false);
mDeviceStateAutoRotateSettingsManager.updateSetting(
/* deviceState= */1, /* rotationLocked= */ true);
ShadowDeviceStateRotationLockSettingsManager shadowManager =
Shadow.extract(mDeviceStateAutoRotateSettingsManager);
shadowManager.setRotationLockedForAllStates(false);
}
}