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
This commit is contained in:
committed by
Wesley Wang
parent
ee4e89e54f
commit
2146a873c2
@@ -89,8 +89,16 @@ public class BatteryOptimizeUtils {
|
|||||||
return getAppOptimizationMode(mMode, mAllowListed);
|
return getAppOptimizationMode(mMode, mAllowListed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the {@link OptimizationMode} for associated app. */
|
|
||||||
public void setAppOptimizationMode(@OptimizationMode int mode) {
|
public void setAppOptimizationMode(@OptimizationMode int mode) {
|
||||||
|
try {
|
||||||
|
setAppUsageStateInternal(mode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "setAppUsageState() is failed for " + mPackageName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the {@link OptimizationMode} for associated app. */
|
||||||
|
public void setAppUsageStateInternal(@OptimizationMode int mode) {
|
||||||
if (getAppOptimizationMode(mMode, mAllowListed) == mode) {
|
if (getAppOptimizationMode(mMode, mAllowListed) == mode) {
|
||||||
Log.w(TAG, "set the same optimization mode for: " + mPackageName);
|
Log.w(TAG, "set the same optimization mode for: " + mPackageName);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user