Add battery usage time summary to usage list item

Insert app foregound and background usage time information into the
preference item summary based on the different scenarios.

Bug: 177406865
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I13ba357666adfb7b57f52ffae18d09aed8dd0773
This commit is contained in:
ykhung
2021-04-20 14:25:29 +08:00
committed by YUKAI HUNG
parent a30178221a
commit 7cc616e90f
4 changed files with 160 additions and 4 deletions

View File

@@ -210,12 +210,17 @@ public class BatteryDiffEntry {
packageManager.getApplicationInfo(packageName, /*no flags*/ 0);
if (appInfo != null) {
mAppLabel = packageManager.getApplicationLabel(appInfo).toString();
mAppIcon = packageManager.getApplicationIcon(appInfo);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "failed to retrieve ApplicationInfo for: " + packageName);
mAppLabel = packageName;
}
}
// Early return if we found the app label and icon resource.
if (mAppLabel != null && mAppIcon != null) {
return;
}
final int uid = (int) mBatteryHistEntry.mUid;
final String[] packages = packageManager.getPackagesForUid(uid);