Fix auto-rotate summary not updating on devices without smart-auto-rotate

Test: locally with crosshatch

Bug: 181585193
Change-Id: I571b10556ff2f4f4d6ff960fcfdf7866405d5ee5
This commit is contained in:
Abel Tesfaye
2021-03-11 20:16:30 +00:00
parent 38e0dae439
commit e57c87528d
2 changed files with 25 additions and 13 deletions

View File

@@ -107,6 +107,25 @@ public class SmartAutoRotatePreferenceControllerTest {
assertThat(mController.getSummary()).isEqualTo("Off");
}
@Test
public void updatePreference_settingsIsOff_noSmartAuto_shouldTurnOffToggle() {
disableAutoRotation();
Settings.Secure.putStringForUser(mContentResolver,
CAMERA_AUTOROTATE, null, UserHandle.USER_CURRENT);
assertThat(mController.getSummary()).isEqualTo("Off");
}
@Test
public void updatePreference_settingsIsOn_noSmartAuto_shouldTurnOnToggle() {
enableAutoRotation();
Settings.Secure.putStringForUser(mContentResolver,
CAMERA_AUTOROTATE, null, UserHandle.USER_CURRENT);
assertThat(mController.getSummary()).isEqualTo("On");
}
@Test
public void testGetAvailabilityStatus() {
assertThat(mController.getAvailabilityStatus()).isEqualTo(BasePreferenceController