Fix b/264582296: Incorrect app battery usage after switching between 'restricted/unrestricted/optimized'.
This bug is due to the instance fields state is not refreshed after setAppUsageState(). When setting back to the original mode in the same page, getAppOptimizationMode(mMode, mAllowListed) still returns the original mode. So the setting back action is ignored. Bug: 264582296 Fix: 264582296 Test: manual Change-Id: I4da5dd7f1ca2660661f842a67b7d799aabd1ba05
This commit is contained in:
@@ -118,7 +118,7 @@ public class BatteryOptimizeUtils {
|
||||
|
||||
/** Sets the {@link OptimizationMode} for associated app. */
|
||||
public void setAppUsageState(@OptimizationMode int mode, Action action) {
|
||||
if (getAppOptimizationMode(mMode, mAllowListed) == mode) {
|
||||
if (getAppOptimizationMode() == mode) {
|
||||
Log.w(TAG, "set the same optimization mode for: " + mPackageName);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user