Reorganize PackageManager dump to avoid NPE

versionCode and mVersionName were added recently but ps.pkg can be null
in some situations. Move them to where it will check before
dereferencing it.

Bug: 3152896
Change-Id: If992a1f29ac7b8f595f847b7743fd2374662bb6e
This commit is contained in:
Kenny Root
2010-10-22 10:07:11 -07:00
parent 47e43febdd
commit 70fc04c84d

View File

@ -7166,7 +7166,9 @@ class PackageManagerService extends IPackageManager.Stub {
pw.print(" resourcePath="); pw.println(ps.resourcePathString);
pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
pw.print(" obbPath="); pw.println(ps.obbPathString);
pw.print(" versionCode="); pw.println(ps.versionCode);
if (ps.pkg != null) {
pw.print(" versionName="); pw.println(ps.pkg.mVersionName);
pw.print(" dataDir="); pw.println(ps.pkg.applicationInfo.dataDir);
pw.print(" targetSdk="); pw.println(ps.pkg.applicationInfo.targetSdkVersion);
if (ps.pkg.mOperationPending) {
@ -7224,8 +7226,6 @@ class PackageManagerService extends IPackageManager.Stub {
pw.print(" pkgFlags=0x"); pw.print(Integer.toHexString(ps.pkgFlags));
pw.print(" installStatus="); pw.print(ps.installStatus);
pw.print(" enabled="); pw.println(ps.enabled);
pw.print(" versionCode="); pw.print(ps.versionCode);
pw.print(" versionName="); pw.println(ps.pkg.mVersionName);
if (ps.disabledComponents.size() > 0) {
pw.println(" disabledComponents:");
for (String s : ps.disabledComponents) {