Merge "Revert "Add PowerSaveWhitelistExceptIdle as Optimizted modes condition""
This commit is contained in:
committed by
Android (Google) Code Review
commit
08390e9e87
@@ -19,8 +19,8 @@ package com.android.settings.fuelgauge;
|
||||
import android.annotation.UserIdInt;
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.backup.BackupManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.app.backup.BackupManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -362,20 +362,18 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
|
||||
final String stateString;
|
||||
final String footerString;
|
||||
|
||||
if (!mBatteryOptimizeUtils.isValidPackageName()
|
||||
|| mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
|
||||
// Present optimized only string when the package name is invalid or
|
||||
// it's in allow list not idle app.
|
||||
if (!mBatteryOptimizeUtils.isValidPackageName()) {
|
||||
//Present optimized only string when the package name is invalid.
|
||||
stateString = context.getString(R.string.manager_battery_usage_optimized_only);
|
||||
footerString = context.getString(
|
||||
R.string.manager_battery_usage_footer_limited, stateString);
|
||||
} else if (mBatteryOptimizeUtils.isSystemOrDefaultApp()) {
|
||||
// Present unrestricted only string when the package is system or default active app.
|
||||
//Present unrestricted only string when the package is system or default active app.
|
||||
stateString = context.getString(R.string.manager_battery_usage_unrestricted_only);
|
||||
footerString = context.getString(
|
||||
R.string.manager_battery_usage_footer_limited, stateString);
|
||||
} else {
|
||||
// Present default string to normal app.
|
||||
//Present default string to normal app.
|
||||
footerString = context.getString(R.string.manager_battery_usage_footer);
|
||||
}
|
||||
mFooterPreference.setTitle(footerString);
|
||||
|
@@ -130,13 +130,6 @@ public class BatteryOptimizeUtils {
|
||||
|| mPowerAllowListBackend.isDefaultActiveApp(mPackageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if this package is in allow list except idle app.
|
||||
*/
|
||||
public boolean isAllowlistedExceptIdleApp() {
|
||||
return mPowerAllowListBackend.isAllowlistedExceptIdle(mPackageName);
|
||||
}
|
||||
|
||||
String getPackageName() {
|
||||
return mPackageName == null ? UNKNOWN_PACKAGE : mPackageName;
|
||||
}
|
||||
|
@@ -57,10 +57,6 @@ public class OptimizedPreferenceController extends AbstractPreferenceController
|
||||
Log.d(TAG, "is system or default app, disable pref");
|
||||
((SelectorWithWidgetPreference) preference).setChecked(false);
|
||||
preference.setEnabled(false);
|
||||
} else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
|
||||
Log.d(TAG, "in allow list not idle app, optimized states only");
|
||||
preference.setEnabled(true);
|
||||
((SelectorWithWidgetPreference) preference).setChecked(true);
|
||||
} else if (mBatteryOptimizeUtils.getAppOptimizationMode()
|
||||
== BatteryOptimizeUtils.MODE_OPTIMIZED) {
|
||||
Log.d(TAG, "is optimized states");
|
||||
|
@@ -55,9 +55,6 @@ public class RestrictedPreferenceController extends AbstractPreferenceController
|
||||
Log.d(TAG, "is system or default app, disable pref");
|
||||
((SelectorWithWidgetPreference) preference).setChecked(false);
|
||||
preference.setEnabled(false);
|
||||
} else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
|
||||
Log.d(TAG, "in allow list not idle app, disable perf");
|
||||
preference.setEnabled(false);
|
||||
} else if (mBatteryOptimizeUtils.getAppOptimizationMode()
|
||||
== BatteryOptimizeUtils.MODE_RESTRICTED) {
|
||||
Log.d(TAG, "is restricted states");
|
||||
|
@@ -53,9 +53,6 @@ public class UnrestrictedPreferenceController extends AbstractPreferenceControll
|
||||
if (mBatteryOptimizeUtils.isSystemOrDefaultApp()) {
|
||||
Log.d(TAG, "is system or default app, unrestricted states only");
|
||||
((SelectorWithWidgetPreference) preference).setChecked(true);
|
||||
} else if (mBatteryOptimizeUtils.isAllowlistedExceptIdleApp()) {
|
||||
Log.d(TAG, "in allow list not idle app, disable perf");
|
||||
preference.setEnabled(false);
|
||||
} else if (mBatteryOptimizeUtils.getAppOptimizationMode()
|
||||
== BatteryOptimizeUtils.MODE_UNRESTRICTED) {
|
||||
Log.d(TAG, "is unrestricted states");
|
||||
|
Reference in New Issue
Block a user