/packages/apps/Settings/tests/robotests/src/com/android/settings/fuelgauge/ |
D | UnrestrictedPreferenceControllerTest.java | 45 private BatteryOptimizeUtils mBatteryOptimizeUtils; field in UnrestrictedPreferenceControllerTest 61 mBatteryOptimizeUtils = spy(new BatteryOptimizeUtils(context, UID, PACKAGE_NAME)); in setUp() 62 mController.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 67 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isValidPackage_prefEnabled() 68 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in testUpdateState_isValidPackage_prefEnabled() 72 assertThat(mBatteryOptimizeUtils.isOptimizeModeMutable()).isTrue(); in testUpdateState_isValidPackage_prefEnabled() 78 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(true); in testUpdateState_invalidPackage_prefDisabled() 79 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in testUpdateState_invalidPackage_prefDisabled() 83 assertThat(mBatteryOptimizeUtils.isOptimizeModeMutable()).isFalse(); in testUpdateState_invalidPackage_prefDisabled() 89 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isSystemOrDefaultAppAndUnrestrictedStates_prefChecked() [all …]
|
D | AllowBackgroundPreferenceControllerTest.java | 45 private BatteryOptimizeUtils mBatteryOptimizeUtils; field in AllowBackgroundPreferenceControllerTest 61 mBatteryOptimizeUtils = spy(new BatteryOptimizeUtils(context, UID, PACKAGE_NAME)); in setUp() 62 mController.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 67 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isValidPackage_prefEnabled() 68 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in testUpdateState_isValidPackage_prefEnabled() 72 assertThat(mBatteryOptimizeUtils.isOptimizeModeMutable()).isTrue(); in testUpdateState_isValidPackage_prefEnabled() 78 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(true); in testUpdateState_invalidPackage_prefDisabled() 79 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in testUpdateState_invalidPackage_prefDisabled() 83 assertThat(mBatteryOptimizeUtils.isOptimizeModeMutable()).isFalse(); in testUpdateState_invalidPackage_prefDisabled() 89 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isSystemOrDefaultAppAndRestrictedStates_prefChecked() [all …]
|
D | OptimizedPreferenceControllerTest.java | 45 private BatteryOptimizeUtils mBatteryOptimizeUtils; field in OptimizedPreferenceControllerTest 61 mBatteryOptimizeUtils = spy(new BatteryOptimizeUtils(context, UID, PACKAGE_NAME)); in setUp() 62 mController.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 67 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(true); in testUpdateState_invalidPackage_prefEnabled() 77 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isSystemOrDefaultAppAndOptimizeStates_prefChecked() 78 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true); in testUpdateState_isSystemOrDefaultAppAndOptimizeStates_prefChecked() 79 when(mBatteryOptimizeUtils.getAppOptimizationMode()) in testUpdateState_isSystemOrDefaultAppAndOptimizeStates_prefChecked() 89 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isSystemOrDefaultApp_prefUnchecked() 90 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true); in testUpdateState_isSystemOrDefaultApp_prefUnchecked() 100 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in testUpdateState_isOptimizedStates_prefChecked() [all …]
|
D | BatteryOptimizeUtilsTest.java | 84 private BatteryOptimizeUtils mBatteryOptimizeUtils; field in BatteryOptimizeUtilsTest 93 mBatteryOptimizeUtils = spy(new BatteryOptimizeUtils(mContext, UID, PACKAGE_NAME)); in setUp() 94 mBatteryOptimizeUtils.mAppOpsManager = mMockAppOpsManager; in setUp() 95 mBatteryOptimizeUtils.mBatteryUtils = mMockBatteryUtils; in setUp() 96 mBatteryOptimizeUtils.mPowerAllowListBackend = mMockBackend; in setUp() 98 mBatteryOptimizeUtils.mMode = AppOpsManager.MODE_IGNORED; in setUp() 99 mBatteryOptimizeUtils.mAllowListed = false; in setUp() 109 assertThat(mBatteryOptimizeUtils.getAppOptimizationMode()).isEqualTo(MODE_RESTRICTED); in testGetAppOptimizationMode_returnRestricted() 118 assertThat(mBatteryOptimizeUtils.getAppOptimizationMode()).isEqualTo(MODE_UNRESTRICTED); in testGetAppOptimizationMode_returnUnrestricted() 127 assertThat(mBatteryOptimizeUtils.getAppOptimizationMode()).isEqualTo(MODE_OPTIMIZED); in testGetAppOptimizationMode_returnOptimized() [all …]
|
D | BatterySettingsMigrateCheckerTest.java | 67 @Mock private BatteryOptimizeUtils mBatteryOptimizeUtils; field in BatterySettingsMigrateCheckerTest 79 BatterySettingsMigrateChecker.sBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 153 .when(mBatteryOptimizeUtils) in verifyBatteryOptimizeModeApps_inAllowList_resetOptimizationMode() 159 final InOrder inOrder = inOrder(mBatteryOptimizeUtils); in verifyBatteryOptimizeModeApps_inAllowList_resetOptimizationMode() 160 inOrder.verify(mBatteryOptimizeUtils).getAppOptimizationMode(); in verifyBatteryOptimizeModeApps_inAllowList_resetOptimizationMode() 161 inOrder.verify(mBatteryOptimizeUtils) in verifyBatteryOptimizeModeApps_inAllowList_resetOptimizationMode() 170 .when(mBatteryOptimizeUtils) in verifyBatteryOptimizeModeApps_optimizedMode_noAction() 176 verify(mBatteryOptimizeUtils, never()).setAppUsageState(anyInt(), any()); in verifyBatteryOptimizeModeApps_optimizedMode_noAction() 182 .when(mBatteryOptimizeUtils) in verifyBatteryOptimizeModeApps_notInAllowList_noAction() 188 verifyNoInteractions(mBatteryOptimizeUtils); in verifyBatteryOptimizeModeApps_notInAllowList_noAction()
|
D | PowerBackgroundUsageDetailTest.java | 114 @Mock private BatteryOptimizeUtils mBatteryOptimizeUtils; field in PowerBackgroundUsageDetailTest 174 mFragment.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 262 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in initFooter_hasCorrectString() 263 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in initFooter_hasCorrectString() 284 verify(mBatteryOptimizeUtils).setAppUsageState(restrictedMode, Action.APPLY); in onSwitchChanged_fromUnrestrictedModeSetDisabled_becomeRestrictedMode() 301 verify(mBatteryOptimizeUtils).setAppUsageState(optimizedMode, Action.APPLY); in onSwitchChanged_fromRestrictedModeSetEnabled_becomeOptimizedMode() 310 when(mBatteryOptimizeUtils.getPackageName()).thenReturn(packageName); in onPause_optimizationModeChanged_logPreference() 314 verify(mBatteryOptimizeUtils).setAppUsageState(optimizedMode, Action.APPLY); in onPause_optimizationModeChanged_logPreference() 315 when(mBatteryOptimizeUtils.getAppOptimizationMode()).thenReturn(optimizedMode); in onPause_optimizationModeChanged_logPreference() 334 when(mBatteryOptimizeUtils.getPackageName()).thenReturn(packageName); in onPause_optimizationModeIsNotChanged_notInvokeLogging() [all …]
|
D | AdvancedPowerUsageDetailTest.java | 117 @Mock private BatteryOptimizeUtils mBatteryOptimizeUtils; field in AdvancedPowerUsageDetailTest 200 mFragment.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 364 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(true); in initFooter_isValidPackageName_hasCorrectString() 374 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in initFooter_isSystemOrDefaultApp_hasCorrectString() 375 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(true); in initFooter_isSystemOrDefaultApp_hasCorrectString() 385 when(mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()).thenReturn(false); in initFooter_hasCorrectString() 386 when(mBatteryOptimizeUtils.isSystemOrDefaultApp()).thenReturn(false); in initFooter_hasCorrectString() 401 when(mBatteryOptimizeUtils.getAppOptimizationMode()).thenReturn(restrictedMode); in onPause_optimizationModeChanged_logPreference() 402 when(mBatteryOptimizeUtils.getPackageName()).thenReturn(packageName); in onPause_optimizationModeChanged_logPreference() 408 verify(mBatteryOptimizeUtils).setAppUsageState(optimizedMode, Action.APPLY); in onPause_optimizationModeChanged_logPreference() [all …]
|
D | BatteryBackupHelperTest.java | 105 @Mock private BatteryOptimizeUtils mBatteryOptimizeUtils; field in BatteryBackupHelperTest 123 mBatteryBackupHelper.mBatteryOptimizeUtils = mBatteryOptimizeUtils; in setUp() 292 verifyNoInteractions(mBatteryOptimizeUtils); in restoreOptimizationMode_nullBytesData_skipRestore() 295 verifyNoInteractions(mBatteryOptimizeUtils); in restoreOptimizationMode_nullBytesData_skipRestore() 298 verifyNoInteractions(mBatteryOptimizeUtils); in restoreOptimizationMode_nullBytesData_skipRestore() 316 final InOrder inOrder = inOrder(mBatteryOptimizeUtils); in restoreOptimizationMode_invalidModeFormat_skipRestore() 317 inOrder.verify(mBatteryOptimizeUtils).setAppUsageState(MODE_RESTRICTED, Action.RESTORE); in restoreOptimizationMode_invalidModeFormat_skipRestore() 318 inOrder.verify(mBatteryOptimizeUtils, never()) in restoreOptimizationMode_invalidModeFormat_skipRestore() 341 final InOrder inOrder = inOrder(mBatteryOptimizeUtils); in restoreOptimizationMode_restoreExpectedModes() 342 inOrder.verify(mBatteryOptimizeUtils).setAppUsageState(MODE_RESTRICTED, Action.RESTORE); in restoreOptimizationMode_restoreExpectedModes() [all …]
|
/packages/apps/Settings/src/com/android/settings/fuelgauge/ |
D | OptimizedPreferenceController.java | 34 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in OptimizedPreferenceController 38 mBatteryOptimizeUtils = new BatteryOptimizeUtils(context, uid, packageName); in OptimizedPreferenceController() 48 preference.setEnabled(mBatteryOptimizeUtils.isSelectorPreferenceEnabled()); in updateState() 51 mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly() in updateState() 52 || mBatteryOptimizeUtils.getAppOptimizationMode() in updateState()
|
D | PowerBackgroundUsageDetail.java | 76 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in PowerBackgroundUsageDetail 110 mOptimizationMode = mBatteryOptimizeUtils.getAppOptimizationMode(); in onResume() 119 final int currentOptimizeMode = mBatteryOptimizeUtils.getAppOptimizationMode(); in onPause() 127 getContext(), mBatteryOptimizeUtils.getUid()); in onPause() 133 mBatteryOptimizeUtils.getPackageName(), UserHandle.myUserId()), in onPause() 144 mBatteryOptimizeUtils.setAppUsageState(getSelectedPreference(), Action.APPLY); in onRadioButtonClicked() 246 if (mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()) { in initFooter() 251 } else if (mBatteryOptimizeUtils.isSystemOrDefaultApp()) { in initFooter() 284 mBatteryOptimizeUtils = in onCreateBackgroundUsageState() 318 getContext(), mBatteryOptimizeUtils.getPackageName()); in logMetricCategory()
|
D | UnrestrictedPreferenceController.java | 35 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in UnrestrictedPreferenceController 39 mBatteryOptimizeUtils = new BatteryOptimizeUtils(context, uid, packageName); in UnrestrictedPreferenceController() 44 preference.setEnabled(mBatteryOptimizeUtils.isSelectorPreferenceEnabled()); in updateState() 47 mBatteryOptimizeUtils.getAppOptimizationMode() in updateState()
|
D | AllowBackgroundPreferenceController.java | 37 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in AllowBackgroundPreferenceController 41 mBatteryOptimizeUtils = new BatteryOptimizeUtils(context, uid, packageName); in AllowBackgroundPreferenceController() 63 setEnabled(preference, mBatteryOptimizeUtils.isOptimizeModeMutable()); in updateState() 66 mBatteryOptimizeUtils.getAppOptimizationMode() in updateState()
|
D | AdvancedPowerUsageDetail.java | 102 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in AdvancedPowerUsageDetail 266 mOptimizationMode = mBatteryOptimizeUtils.getAppOptimizationMode(); in onResume() 280 final int currentOptimizeMode = mBatteryOptimizeUtils.getAppOptimizationMode(); in onPause() 287 getContext(), mBatteryOptimizeUtils.getUid()); in onPause() 293 mBatteryOptimizeUtils.getPackageName(), UserHandle.myUserId()), in onPause() 348 if (mBatteryOptimizeUtils.isDisabledForOptimizeModeOnly()) { in initFooter() 353 } else if (mBatteryOptimizeUtils.isSystemOrDefaultApp()) { in initFooter() 442 mBatteryOptimizeUtils.setAppUsageState( in onPreferenceChange() 473 getContext(), mBatteryOptimizeUtils.getPackageName()); in logMetricCategory() 492 mBatteryOptimizeUtils = in onCreateBackgroundUsageState()
|
D | BatteryBackupHelper.java | 83 @VisibleForTesting BatteryOptimizeUtils mBatteryOptimizeUtils; field in BatteryBackupHelper 324 newBatteryOptimizeUtils(mContext, packageName, mBatteryOptimizeUtils); in restoreOptimizationMode()
|