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

@@ -745,6 +745,16 @@ public class AdvancedPowerUsageDetailTest {
.isEqualTo("This app requires optimized battery usage.");
}
@Test
public void testInitPreferenceForTriState_isAllowlistedExceptIdleApp_hasCorrectString() {
when(mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()).thenReturn(true);
mFragment.initPreferenceForTriState(mContext);
assertThat(mFooterPreference.getTitle().toString())
.isEqualTo("This app requires optimized battery usage.");
}
@Test
public void testInitPreferenceForTriState_isSystemOrDefaultApp_hasCorrectString() {
when(mBatteryOptimizeUtils.isValidPackageName()).thenReturn(true);