summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-03-30 19:25:56 -0700
committerDianne Hackborn <hackbod@google.com>2010-03-30 22:55:06 -0700
commit0d4ff37341fc970195d9a737a8ab166c550aa2b3 (patch)
tree69267f93fb8be542374608ef2f8ea2b5b0c4c81f /src
parent9e3486139a80866a2c8af5380e0d7604d1b6df30 (diff)
downloadandroid_packages_apps_PackageInstaller-0d4ff37341fc970195d9a737a8ab166c550aa2b3.tar.gz
android_packages_apps_PackageInstaller-0d4ff37341fc970195d9a737a8ab166c550aa2b3.tar.bz2
android_packages_apps_PackageInstaller-0d4ff37341fc970195d9a737a8ab166c550aa2b3.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/com/android/packageinstaller/PackageInstallerActivity.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java
index 96c1b160..1b967ff6 100644
--- a/src/com/android/packageinstaller/PackageInstallerActivity.java
+++ b/src/com/android/packageinstaller/PackageInstallerActivity.java
@@ -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;