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:
@@ -69,7 +69,19 @@ public class RestrictedPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isSystemOrDefaultApp_prefChecked() {
|
||||
public void testUpdateState_isSystemOrDefaultAppAndRestrictedStates_prefChecked() {
|
||||
when(mockBatteryOptimizeUtils.isValidPackageName()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.getAppOptimizationMode()).thenReturn(
|
||||
BatteryOptimizeUtils.MODE_RESTRICTED);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateState_isSystemOrDefaultApp_prefUnchecked() {
|
||||
when(mockBatteryOptimizeUtils.isValidPackageName()).thenReturn(true);
|
||||
when(mockBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true);
|
||||
|
||||
|
Reference in New Issue
Block a user