am 0a8ef849: am 00bd16d5: am e719d83c: am dafaa45c: Merge "Split app move into separate copy/delete steps." into mnc-dev
* commit '0a8ef849ce091a325c2d50b4a1f20f3f472900d2': Split app move into separate copy/delete steps.
This commit is contained in:
@@ -264,9 +264,9 @@ public final class Installer extends SystemService {
|
||||
return mInstaller.execute(builder.toString());
|
||||
}
|
||||
|
||||
public int moveCompleteApp(String fromUuid, String toUuid, String packageName,
|
||||
public int copyCompleteApp(String fromUuid, String toUuid, String packageName,
|
||||
String dataAppName, int appId, String seinfo) {
|
||||
StringBuilder builder = new StringBuilder("mvcompleteapp");
|
||||
StringBuilder builder = new StringBuilder("cpcompleteapp");
|
||||
builder.append(' ');
|
||||
builder.append(escapeNull(fromUuid));
|
||||
builder.append(' ');
|
||||
|
||||
@@ -11278,7 +11278,7 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
if (DEBUG_INSTALL) Slog.d(TAG, "Moving " + move.packageName + " from "
|
||||
+ move.fromUuid + " to " + move.toUuid);
|
||||
synchronized (mInstaller) {
|
||||
if (mInstaller.moveCompleteApp(move.fromUuid, move.toUuid, move.packageName,
|
||||
if (mInstaller.copyCompleteApp(move.fromUuid, move.toUuid, move.packageName,
|
||||
move.dataAppName, move.appId, move.seinfo) != 0) {
|
||||
return PackageManager.INSTALL_FAILED_INTERNAL_ERROR;
|
||||
}
|
||||
@@ -11293,14 +11293,14 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
|
||||
int doPreInstall(int status) {
|
||||
if (status != PackageManager.INSTALL_SUCCEEDED) {
|
||||
cleanUp();
|
||||
cleanUp(move.toUuid);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
boolean doRename(int status, PackageParser.Package pkg, String oldCodePath) {
|
||||
if (status != PackageManager.INSTALL_SUCCEEDED) {
|
||||
cleanUp();
|
||||
cleanUp(move.toUuid);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11317,8 +11317,10 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
|
||||
int doPostInstall(int status, int uid) {
|
||||
if (status != PackageManager.INSTALL_SUCCEEDED) {
|
||||
cleanUp();
|
||||
if (status == PackageManager.INSTALL_SUCCEEDED) {
|
||||
cleanUp(move.fromUuid);
|
||||
} else {
|
||||
cleanUp(move.toUuid);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -11333,32 +11335,28 @@ public class PackageManagerService extends IPackageManager.Stub {
|
||||
return (resourceFile != null) ? resourceFile.getAbsolutePath() : null;
|
||||
}
|
||||
|
||||
private boolean cleanUp() {
|
||||
if (codeFile == null || !codeFile.exists()) {
|
||||
return false;
|
||||
private boolean cleanUp(String volumeUuid) {
|
||||
final File codeFile = new File(Environment.getDataAppDirectory(volumeUuid),
|
||||
move.dataAppName);
|
||||
Slog.d(TAG, "Cleaning up " + move.packageName + " on " + volumeUuid);
|
||||
synchronized (mInstallLock) {
|
||||
// Clean up both app data and code
|
||||
removeDataDirsLI(volumeUuid, move.packageName);
|
||||
if (codeFile.isDirectory()) {
|
||||
mInstaller.rmPackageDir(codeFile.getAbsolutePath());
|
||||
} else {
|
||||
codeFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (codeFile.isDirectory()) {
|
||||
mInstaller.rmPackageDir(codeFile.getAbsolutePath());
|
||||
} else {
|
||||
codeFile.delete();
|
||||
}
|
||||
|
||||
if (resourceFile != null && !FileUtils.contains(codeFile, resourceFile)) {
|
||||
resourceFile.delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void cleanUpResourcesLI() {
|
||||
cleanUp();
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
boolean doPostDeleteLI(boolean delete) {
|
||||
// XXX err, shouldn't we respect the delete flag?
|
||||
cleanUpResourcesLI();
|
||||
return true;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user