Merge "Fix issue #2391429: Crash during boot if fwd locked app is incompletely installed" into eclair
This commit is contained in:
committed by
Android (Google) Code Review
commit
678e66a4ec
@ -573,7 +573,7 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
mAppInstallDir.mkdirs(); // scanDirLI() assumes this dir exists
|
mAppInstallDir.mkdirs(); // scanDirLI() assumes this dir exists
|
||||||
}
|
}
|
||||||
//look for any incomplete package installations
|
//look for any incomplete package installations
|
||||||
ArrayList<String> deletePkgsList = mSettings.getListOfIncompleteInstallPackages();
|
ArrayList<PackageSetting> deletePkgsList = mSettings.getListOfIncompleteInstallPackages();
|
||||||
//clean up list
|
//clean up list
|
||||||
for(int i = 0; i < deletePkgsList.size(); i++) {
|
for(int i = 0; i < deletePkgsList.size(); i++) {
|
||||||
//clean up here
|
//clean up here
|
||||||
@ -628,20 +628,31 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupInstallFailedPackage(String packageName) {
|
void cleanupInstallFailedPackage(PackageSetting ps) {
|
||||||
|
Log.i(TAG, "Cleaning up incompletely installed app: " + ps.name);
|
||||||
if (mInstaller != null) {
|
if (mInstaller != null) {
|
||||||
int retCode = mInstaller.remove(packageName);
|
int retCode = mInstaller.remove(ps.name);
|
||||||
if (retCode < 0) {
|
if (retCode < 0) {
|
||||||
Log.w(TAG, "Couldn't remove app data directory for package: "
|
Log.w(TAG, "Couldn't remove app data directory for package: "
|
||||||
+ packageName + ", retcode=" + retCode);
|
+ ps.name + ", retcode=" + retCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//for emulator
|
//for emulator
|
||||||
PackageParser.Package pkg = mPackages.get(packageName);
|
PackageParser.Package pkg = mPackages.get(ps.name);
|
||||||
File dataDir = new File(pkg.applicationInfo.dataDir);
|
File dataDir = new File(pkg.applicationInfo.dataDir);
|
||||||
dataDir.delete();
|
dataDir.delete();
|
||||||
}
|
}
|
||||||
mSettings.removePackageLP(packageName);
|
if (ps.codePath != null) {
|
||||||
|
if (!ps.codePath.delete()) {
|
||||||
|
Log.w(TAG, "Unable to remove old code file: " + ps.codePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ps.resourcePath != null) {
|
||||||
|
if (!ps.resourcePath.delete() && !ps.resourcePath.equals(ps.codePath)) {
|
||||||
|
Log.w(TAG, "Unable to remove old code file: " + ps.resourcePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mSettings.removePackageLP(ps.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void readPermissions() {
|
void readPermissions() {
|
||||||
@ -6732,15 +6743,15 @@ class PackageManagerService extends IPackageManager.Stub {
|
|||||||
return mReadMessages.toString();
|
return mReadMessages.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> getListOfIncompleteInstallPackages() {
|
ArrayList<PackageSetting> getListOfIncompleteInstallPackages() {
|
||||||
HashSet<String> kList = new HashSet<String>(mPackages.keySet());
|
HashSet<String> kList = new HashSet<String>(mPackages.keySet());
|
||||||
Iterator<String> its = kList.iterator();
|
Iterator<String> its = kList.iterator();
|
||||||
ArrayList<String> ret = new ArrayList<String>();
|
ArrayList<PackageSetting> ret = new ArrayList<PackageSetting>();
|
||||||
while(its.hasNext()) {
|
while(its.hasNext()) {
|
||||||
String key = its.next();
|
String key = its.next();
|
||||||
PackageSetting ps = mPackages.get(key);
|
PackageSetting ps = mPackages.get(key);
|
||||||
if(ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
|
if(ps.getInstallStatus() == PKG_INSTALL_INCOMPLETE) {
|
||||||
ret.add(key);
|
ret.add(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user