Revamp the battery usage details page.
This cl adds AdvancedPowerUsageDetail to show the usage details page.
The AdvancedPowerUsageDetail contains all the needed ui components:
1. App Header
2. Two buttons
3. Usage breakdown preference category
4. Power management preference category
This cl also adds preference controller for two buttons but the
detail implementation will be added in the following cl.
Following cl will also remove previous detail page.
Bug: 35810915
Test: RunSettingsRoboTests
Change-Id: I17f95d1288762094671c0f148fa73367e51f175e
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 909ddfe..4c8fb2d 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -74,6 +74,7 @@
import android.provider.ContactsContract.RawContacts;
import android.provider.Settings;
import android.service.persistentdata.PersistentDataBlockManager;
+import android.support.annotation.StringRes;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceManager;
@@ -1241,6 +1242,17 @@
return isVolumeValid(volume) ? volume : null;
}
+ /**
+ * Return the resource id to represent the install status for an app
+ */
+ @StringRes
+ public static int getInstallationStatus(ApplicationInfo info) {
+ if ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
+ return R.string.not_installed;
+ }
+ return info.enabled ? R.string.installed : R.string.disabled;
+ }
+
private static boolean isVolumeValid(VolumeInfo volume) {
return (volume != null) && (volume.getType() == VolumeInfo.TYPE_PRIVATE)
&& volume.isMountedReadable();