Merge "Use system package name for SYSTEM_UID in the BatteryEntry" into tm-dev
This commit is contained in:
@@ -209,7 +209,8 @@ public class BatteryEntry {
|
|||||||
if (packages != null && packages.length == 1) {
|
if (packages != null && packages.length == 1) {
|
||||||
mDefaultPackageName = packages[0];
|
mDefaultPackageName = packages[0];
|
||||||
} else {
|
} else {
|
||||||
mDefaultPackageName = uidBatteryConsumer.getPackageWithHighestDrain();
|
mDefaultPackageName = isSystemUid(uid)
|
||||||
|
? PACKAGE_SYSTEM : uidBatteryConsumer.getPackageWithHighestDrain();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mDefaultPackageName != null) {
|
if (mDefaultPackageName != null) {
|
||||||
@@ -352,13 +353,8 @@ public class BatteryEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PackageManager pm = context.getPackageManager();
|
final PackageManager pm = context.getPackageManager();
|
||||||
final String[] packages;
|
final String[] packages = isSystemUid(uid)
|
||||||
if (uid == Process.SYSTEM_UID) {
|
? new String[] {PACKAGE_SYSTEM} : pm.getPackagesForUid(uid);
|
||||||
packages = new String[] {PACKAGE_SYSTEM};
|
|
||||||
} else {
|
|
||||||
packages = pm.getPackagesForUid(uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packages != null) {
|
if (packages != null) {
|
||||||
final String[] packageLabels = new String[packages.length];
|
final String[] packageLabels = new String[packages.length];
|
||||||
System.arraycopy(packages, 0, packageLabels, 0, packages.length);
|
System.arraycopy(packages, 0, packageLabels, 0, packages.length);
|
||||||
@@ -615,4 +611,8 @@ public class BatteryEntry {
|
|||||||
}
|
}
|
||||||
return new NameAndIcon(name, null /* icon */, iconId);
|
return new NameAndIcon(name, null /* icon */, iconId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isSystemUid(int uid) {
|
||||||
|
return uid == Process.SYSTEM_UID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user