Don't crash when procstats has data for a now-disused uid

That is, PackageManager.getPackagesForUid(uid) can return null,
so deal with it.

Bug 10374656

Change-Id: I4eacd48c809b778e131d37dba0e86c583553e41f
This commit is contained in:
Christopher Tate
2013-08-18 17:26:48 -07:00
parent 55fe056d96
commit a218e732b0

View File

@@ -335,6 +335,7 @@ public class ProcessStatsUi extends PreferenceFragment {
}
if (targetApp == null) {
String[] packages = pm.getPackagesForUid(proc.mUid);
if (packages != null) {
for (String curPkg : packages) {
try {
final PackageInfo pi = pm.getPackageInfo(curPkg,
@@ -356,6 +357,10 @@ public class ProcessStatsUi extends PreferenceFragment {
} catch (PackageManager.NameNotFoundException e) {
}
}
} else {
// no current packages for this uid, typically because of uninstall
Log.i(TAG, "No package for uid " + proc.mUid);
}
}
pref.setTitle(label);
if (targetApp != null) {