Add PowerSaveWhitelistExceptIdle as Optimizted modes condition

- Check PowerSaveWhitelistExceptIdle list before update each apps
 optimizaton mode to avoid duplicate remove action
 - Make those apps which under PowerSaveWhitelistExceptIdle list keep at
 optimized mode only

BYPASS_INCLUSIVE_LANGUAGE_REASON=legacy naming, not edit by this code change


Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I3cd10cf51b5132fc12a83e9554801ec4e8578cd1
Merged-In: I3cd10cf51b5132fc12a83e9554801ec4e8578cd1
This commit is contained in:
Wesley.CW Wang
2021-09-15 22:56:38 +08:00
committed by YUKAI HUNG
parent e5644441dd
commit e7cca4cd81
10 changed files with 76 additions and 5 deletions

View File

@@ -124,6 +124,18 @@ public class BatteryOptimizeUtilsTest {
assertThat(mBatteryOptimizeUtils.isValidPackageName()).isTrue();
}
@Test
public void testIsAllowlistedExpectIdle_isAllowlistedExceptIdle_returnTrue() {
when(mMockBackend.isAllowlistedExceptIdle(anyString())).thenReturn(true);
assertThat(mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()).isTrue();
}
@Test
public void testIsAllowlistedExpectIdle_notAllowlistedExpectIdle_returnFalse() {
assertThat(mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()).isFalse();
}
@Test
public void testSetAppOptimizationMode_Restricted_verifyAction() {
// Sets the current mode as MODE_UNRESTRICTED.