Merge "Load application icon and label for UID battery consumer type" into sc-dev

This commit is contained in:
YUKAI HUNG
2021-04-15 01:04:00 +00:00
committed by Android (Google) Code Review
3 changed files with 164 additions and 18 deletions

View File

@@ -110,7 +110,8 @@ public class BatteryEntry {
}
final NameAndIcon nameAndIcon =
BatteryEntry.loadNameAndIcon(
be.mContext, be.getUid(), sHandler, be, be.mDefaultPackageName);
be.mContext, be.getUid(), sHandler, be,
be.mDefaultPackageName, be.name, be.icon);
if (nameAndIcon != null) {
be.icon = getNonNull(be.icon, nameAndIcon.icon);
be.name = getNonNull(be.name, nameAndIcon.name);
@@ -273,6 +274,7 @@ public class BatteryEntry {
icon = mContext.getPackageManager().getDefaultActivityIcon();
}
// Avoids post the loading icon and label in the background request.
if (sHandler != null && loadDataInBackground) {
synchronized (sRequestQueue) {
sRequestQueue.add(this);
@@ -288,9 +290,9 @@ public class BatteryEntry {
int uid,
Handler handler,
BatteryEntry batteryEntry,
String defaultPackageName) {
String name = null;
Drawable icon = null;
String defaultPackageName,
String name,
Drawable icon) {
// Bail out if the current sipper is not an App sipper.
if (uid == 0 || uid == Process.INVALID_UID) {
return null;