diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index c3bc4d4a945..9ffd0a59f5d 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -1185,11 +1185,7 @@ public boolean areAllItemsEnabled() { @Override public boolean isEnabled(int position) { - if (mManageApplications.mListType != LIST_TYPE_HIGH_POWER) { - return true; - } - ApplicationsState.AppEntry entry = mEntries.get(position); - return !PowerWhitelistBackend.getInstance().isSysWhitelisted(entry.info.packageName); + return true; } public View getView(int position, View convertView, ViewGroup parent) { diff --git a/src/com/android/settings/fuelgauge/HighPowerDetail.java b/src/com/android/settings/fuelgauge/HighPowerDetail.java index 6946f62f18e..1d9600da6c0 100644 --- a/src/com/android/settings/fuelgauge/HighPowerDetail.java +++ b/src/com/android/settings/fuelgauge/HighPowerDetail.java @@ -70,9 +70,6 @@ public Checkable setup(View view, boolean on) { ? R.string.ignore_optimizations_on_desc : R.string.ignore_optimizations_off_desc); view.setClickable(true); view.setOnClickListener(this); - if (!on && mBackend.isSysWhitelisted(mPackageName)) { - view.setEnabled(false); - } return (Checkable) view; } @@ -82,9 +79,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { .setTitle(mLabel) .setNegativeButton(R.string.cancel, null) .setView(R.layout.ignore_optimizations_content); - if (!mBackend.isSysWhitelisted(mPackageName)) { - b.setPositiveButton(R.string.done, this); - } + b.setPositiveButton(R.string.done, this); return b.create(); } @@ -142,8 +137,7 @@ public static CharSequence getSummary(Context context, AppEntry entry) { public static CharSequence getSummary(Context context, String pkg) { PowerWhitelistBackend powerWhitelist = PowerWhitelistBackend.getInstance(); - return context.getString(powerWhitelist.isSysWhitelisted(pkg) ? R.string.high_power_system - : powerWhitelist.isWhitelisted(pkg) ? R.string.high_power_on + return context.getString(powerWhitelist.isWhitelisted(pkg) ? R.string.high_power_on : R.string.high_power_off); } diff --git a/src/com/android/settings/fuelgauge/PowerWhitelistBackend.java b/src/com/android/settings/fuelgauge/PowerWhitelistBackend.java index 7199af871ce..e37e5b57089 100644 --- a/src/com/android/settings/fuelgauge/PowerWhitelistBackend.java +++ b/src/com/android/settings/fuelgauge/PowerWhitelistBackend.java @@ -57,7 +57,11 @@ public boolean isWhitelisted(String pkg) { public void addApp(String pkg) { try { - mDeviceIdleService.addPowerSaveWhitelistApp(pkg); + if (isSysWhitelisted(pkg)) { + mDeviceIdleService.addSystemPowerSaveWhitelistApp(pkg); + } else { + mDeviceIdleService.addPowerSaveWhitelistApp(pkg); + } mWhitelistedApps.add(pkg); } catch (RemoteException e) { Log.w(TAG, "Unable to reach IDeviceIdleController", e); @@ -66,7 +70,11 @@ public void addApp(String pkg) { public void removeApp(String pkg) { try { - mDeviceIdleService.removePowerSaveWhitelistApp(pkg); + if (isSysWhitelisted(pkg)) { + mDeviceIdleService.removeSystemPowerSaveWhitelistApp(pkg); + } else { + mDeviceIdleService.removePowerSaveWhitelistApp(pkg); + } mWhitelistedApps.remove(pkg); } catch (RemoteException e) { Log.w(TAG, "Unable to reach IDeviceIdleController", e); @@ -81,7 +89,7 @@ private void refreshList() { for (String app : whitelistedApps) { mWhitelistedApps.add(app); } - String[] sysWhitelistedApps = mDeviceIdleService.getSystemPowerWhitelist(); + String[] sysWhitelistedApps = mDeviceIdleService.getSystemPowerWhitelistOriginal(); for (String app : sysWhitelistedApps) { mSysWhitelistedApps.add(app); }