Revert "Add PowerSaveWhitelistExceptIdle as Optimizted modes condition"

- Reverts commit e7cca4cd81
 - Add try-catch to handle unexpected operate

Reason for revert: Previous fix will cause a side effect which makes app stuck at Optimize mode after switching state from Unrestricted to Optimize, add a try catch to handle previous issue first

BYPASS_INCLUSIVE_LANGUAGE_REASON=legacy naming, not edit by this code change

Bug: 199892006
Test: make SettingsRoboTests
Change-Id: I3b1850ab66bbf4cd605f14152a244a8ed7edd578
Merged-In: I3b1850ab66bbf4cd605f14152a244a8ed7edd578
This commit is contained in:
Wesley.CW Wang
2021-10-18 16:46:58 +08:00
committed by Wesley Wang
parent 3efe6e59f7
commit d11dec2f82
10 changed files with 10 additions and 72 deletions

View File

@@ -124,18 +124,6 @@ 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.