Update battery optimize page states condition
- Keep apps optimize state as what it set even it's a system or default app - Previously we force system/defualt apps present as Unrestricted mode only and disable other options but that can not shows that apps actual optimize states, it's possible to be other states even it's a system or default apps, so we change the UI logic back to: present it's actual states and disable other options when it's a system or default apps. Bug: 234419032 Test: make SettingsRoboTests Change-Id: Ib5b6cb0aacb570cb8d15b1bb9ac2d480356eda49
This commit is contained in:
@@ -70,13 +70,26 @@ public class UnrestrictedPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isSystemOrDefaultApp_prefChecked() {
|
||||
public void testUpdateState_isSystemOrDefaultAppAndUnrestrictedStates_prefChecked() {
|
||||
when(mockBatteryOptimizeUtils.isValidPackageName()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.getAppOptimizationMode()).thenReturn(
|
||||
BatteryOptimizeUtils.MODE_UNRESTRICTED);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isSystemOrDefaultApp_prefUnchecked() {
|
||||
when(mockBatteryOptimizeUtils.isValidPackageName()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.isChecked()).isTrue();
|
||||
assertThat(mPreference.isChecked()).isFalse();
|
||||
assertThat(mPreference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user