Commit 0d4ff373 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix issue #2558391: Package manager problem when not replacing existing system partition app

Make sure to set the replace flag if the app exists but has been renamed.

Change-Id: I0849834b59eb2a98c94e763860f649770eeeef43
parent 9e348613
......@@ -208,9 +208,17 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
}
private void initiateInstall() {
String pkgName = mPkgInfo.packageName;
// Check if there is already a package on the device with this name
// but it has been renamed to something else.
String[] oldName = mPm.canonicalToCurrentPackageNames(new String[] { pkgName });
if (oldName != null && oldName.length > 0 && oldName[0] != null) {
pkgName = oldName[0];
mPkgInfo.setPackageName(pkgName);
}
// Check if package is already installed. display confirmation dialog if replacing pkg
try {
mAppInfo = mPm.getApplicationInfo(mPkgInfo.packageName,
mAppInfo = mPm.getApplicationInfo(pkgName,
PackageManager.GET_UNINSTALLED_PACKAGES);
} catch (NameNotFoundException e) {
mAppInfo = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment