diff --git a/res/values/strings.xml b/res/values/strings.xml index afe8777e80d..ebf1fb451fd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5860,6 +5860,7 @@ apps download applications system apps permissions security apps default + ignore optimizations doze app standby slide password pattern pin @@ -6564,22 +6565,19 @@ Allowed - - Not allowed - - Allowed to ignore optimizations + Ignoring battery optimizations - Not allowed to ignore optimizations + Off - Ignore optimizations including Battery saver, allow instant content refresh etc. + Don\'t apply battery optimizations. May drain your battery more quickly. - 1 app is allowed to ignore battery optimizations - %d apps are allowed to battery optimizations + 1 app allowed to ignore battery optimizations + %d apps allowed to ignore battery optimizations diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml index 62431c30c4a..1bb9c586719 100644 --- a/res/xml/advanced_apps.xml +++ b/res/xml/advanced_apps.xml @@ -43,7 +43,8 @@ + android:fragment="com.android.settings.applications.ManageApplications" + settings:keywords="@string/keywords_ignore_optimizations"> diff --git a/res/xml/power_usage_details.xml b/res/xml/power_usage_details.xml index 3ad6547398d..ad28650120e 100644 --- a/res/xml/power_usage_details.xml +++ b/res/xml/power_usage_details.xml @@ -25,23 +25,28 @@ android:layout="@layout/two_buttons_panel" android:selectable="false" /> - + + + + + - - + android:key="messages_parent" + android:layout="@layout/tall_preference_category" /> diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index 1ef20f2a006..c74e23da47d 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -109,22 +109,22 @@ public class ManageApplications extends InstrumentedFragment // Filter options used for displayed list of applications // The order which they appear is the order they will show when spinner is present. - public static final int FILTER_APPS_ALL = 0; - public static final int FILTER_APPS_ENABLED = 1; - public static final int FILTER_APPS_DISABLED = 2; - public static final int FILTER_APPS_BLOCKED = 3; - public static final int FILTER_APPS_PRIORITY = 4; - public static final int FILTER_APPS_NO_PEEKING = 5; - public static final int FILTER_APPS_SENSITIVE = 6; - public static final int FILTER_APPS_PERSONAL = 7; - public static final int FILTER_APPS_WORK = 8; - public static final int FILTER_APPS_WITH_DOMAIN_URLS = 9; - public static final int FILTER_APPS_USAGE_ACCESS = 10; - public static final int FILTER_APPS_POWER_WHITELIST = 11; - public static final int FILTER_APPS_POWER_NO_WHITELIST = 12; + public static final int FILTER_APPS_POWER_WHITELIST = 0; + public static final int FILTER_APPS_ALL = 1; + public static final int FILTER_APPS_ENABLED = 2; + public static final int FILTER_APPS_DISABLED = 3; + public static final int FILTER_APPS_BLOCKED = 4; + public static final int FILTER_APPS_PRIORITY = 5; + public static final int FILTER_APPS_NO_PEEKING = 6; + public static final int FILTER_APPS_SENSITIVE = 7; + public static final int FILTER_APPS_PERSONAL = 8; + public static final int FILTER_APPS_WORK = 9; + public static final int FILTER_APPS_WITH_DOMAIN_URLS = 10; + public static final int FILTER_APPS_USAGE_ACCESS = 11; // This is the string labels for the filter modes above, the order must be kept in sync. public static final int[] FILTER_LABELS = new int[] { + R.string.high_power_filter_on, // High power whitelist, on R.string.filter_all_apps, // All apps R.string.filter_enabled_apps, // Enabled R.string.filter_apps_disabled, // Disabled @@ -136,12 +136,11 @@ public class ManageApplications extends InstrumentedFragment R.string.filter_work_apps, // Work R.string.filter_with_domain_urls_apps, // Domain URLs R.string.filter_all_apps, // Usage access screen, never displayed - R.string.high_power_filter_on, // High power whitelist, on - R.string.high_power_filter_off, // High power whitelist, off }; // This is the actual mapping to filters from FILTER_ constants above, the order must // be kept in sync. public static final AppFilter[] FILTERS = new AppFilter[] { + AppStatePowerBridge.FILTER_POWER_WHITELISTED, // High power whitelist, on ApplicationsState.FILTER_EVERYTHING, // All apps ApplicationsState.FILTER_ALL_ENABLED, // Enabled ApplicationsState.FILTER_DISABLED, // Disabled @@ -153,8 +152,6 @@ public class ManageApplications extends InstrumentedFragment ApplicationsState.FILTER_WORK, // Work ApplicationsState.FILTER_WITH_DOMAIN_URLS, // Apps with Domain URLs AppStateUsageBridge.FILTER_APP_USAGE, // Apps with Domain URLs - AppStatePowerBridge.FILTER_POWER_WHITELISTED, // High power whitelist, on - AppStatePowerBridge.FILTER_POWER_NOT_WHITELISTED, // High power whitelist, off }; // sort order @@ -321,7 +318,7 @@ public class ManageApplications extends InstrumentedFragment mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING); } if (mListType == LIST_TYPE_HIGH_POWER) { - mFilterAdapter.enableFilter(FILTER_APPS_POWER_NO_WHITELIST); + mFilterAdapter.enableFilter(FILTER_APPS_ALL); } if (mListType == LIST_TYPE_STORAGE) { mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid)); diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java index 5e11baf1c6e..6313ff5f0c9 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java +++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java @@ -358,6 +358,8 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi if (mHighPower != null) { mHighPower.setSummary(HighPowerDetail.getSummary(getActivity(), mApp.packageName)); } + + setupHeader(); } private void createDetails() { @@ -370,8 +372,6 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi mNoCoverage = args.getDouble(EXTRA_NO_COVERAGE, 0); mShowLocationButton = args.getBoolean(EXTRA_SHOW_LOCATION_BUTTON); - setupHeader(); - mTypes = args.getIntArray(EXTRA_DETAIL_TYPES); mValues = args.getDoubleArray(EXTRA_DETAIL_VALUES); @@ -445,14 +445,14 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi private void setupHeader() { final Bundle args = getArguments(); String title = args.getString(EXTRA_TITLE); - String iconPackage = args.getString(EXTRA_ICON_PACKAGE); + String pkg = args.getString(EXTRA_ICON_PACKAGE); int iconId = args.getInt(EXTRA_ICON_ID, 0); Drawable appIcon = null; - if (!TextUtils.isEmpty(iconPackage)) { + if (!TextUtils.isEmpty(pkg)) { try { final PackageManager pm = getActivity().getPackageManager(); - ApplicationInfo ai = pm.getPackageInfo(iconPackage, 0).applicationInfo; + ApplicationInfo ai = pm.getPackageInfo(pkg, 0).applicationInfo; if (ai != null) { appIcon = ai.loadIcon(pm); } @@ -466,8 +466,11 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi appIcon = getActivity().getPackageManager().getDefaultActivityIcon(); } + if (pkg == null && mPackages != null) { + pkg = mPackages[0]; + } AppHeader.createAppHeader(this, appIcon, title, - AppInfoWithHeader.getInfoIntent(this, iconPackage), + pkg != null ? AppInfoWithHeader.getInfoIntent(this, pkg) : null, mDrainType != DrainType.APP ? android.R.color.white : 0); } @@ -629,7 +632,6 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi private void addControl(int pageSummary, int actionTitle, final int action) { Preference pref = new Preference(getActivity()); pref.setTitle(actionTitle); - pref.setSummary(pageSummary); pref.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) {