Merge "Avoid NPE when installing app update." into jb-mr1-dev

This commit is contained in:
Jeff Sharkey
2012-10-03 16:15:31 -07:00
committed by Android (Google) Code Review

View File

@@ -568,14 +568,19 @@ public class InstalledAppDetails extends Fragment
}
}
mAppEntry = mState.getEntry(packageName);
// Get application info again to refresh changed properties of application
try {
mPackageInfo = mPm.getPackageInfo(mAppEntry.info.packageName,
PackageManager.GET_DISABLED_COMPONENTS |
PackageManager.GET_UNINSTALLED_PACKAGES |
PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
Log.e(TAG, "Exception when retrieving package:" + mAppEntry.info.packageName, e);
if (mAppEntry != null) {
// Get application info again to refresh changed properties of application
try {
mPackageInfo = mPm.getPackageInfo(mAppEntry.info.packageName,
PackageManager.GET_DISABLED_COMPONENTS |
PackageManager.GET_UNINSTALLED_PACKAGES |
PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
Log.e(TAG, "Exception when retrieving package:" + mAppEntry.info.packageName, e);
}
} else {
Log.w(TAG, "Missing AppEntry; maybe reinstalling?");
mPackageInfo = null;
}
return packageName;