Fix a crash in InstalledAppDetails

Initialize mPackageInfo in onCreate

Bug: 7194755
Change-Id: Ic82351591bd38c4c161bbb23c4033038d1d7fa85
This commit is contained in:
Amith Yamasani
2012-09-19 10:58:32 -07:00
parent 27f155a401
commit b1bf9cf383

View File

@@ -564,6 +564,16 @@ public class InstalledAppDetails extends Fragment
} }
} }
mAppEntry = mState.getEntry(packageName); 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);
}
return packageName; return packageName;
} }
@@ -576,18 +586,11 @@ public class InstalledAppDetails extends Fragment
if (mAppEntry == null) { if (mAppEntry == null) {
return false; // onCreate must have failed, make sure to exit return false; // onCreate must have failed, make sure to exit
} }
// Get application info again to refresh changed properties of application if (mPackageInfo == null) {
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);
return false; // onCreate must have failed, make sure to exit return false; // onCreate must have failed, make sure to exit
} }
// Get list of preferred activities // Get list of preferred activities
List<ComponentName> prefActList = new ArrayList<ComponentName>(); List<ComponentName> prefActList = new ArrayList<ComponentName>();