Merge "Implement staged directory clean up for staged install"
This commit is contained in:
committed by
Android (Google) Code Review
commit
31756bdaa7
@@ -2029,6 +2029,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
mStagedSessionErrorMessage = errorMessage;
|
||||
Slog.d(TAG, "Marking session " + sessionId + " as failed: " + errorMessage);
|
||||
}
|
||||
cleanStageDir();
|
||||
mCallback.onStagedSessionChanged(this);
|
||||
}
|
||||
|
||||
@@ -2040,7 +2041,9 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
mStagedSessionFailed = false;
|
||||
mStagedSessionErrorCode = SessionInfo.STAGED_SESSION_NO_ERROR;
|
||||
mStagedSessionErrorMessage = "";
|
||||
Slog.d(TAG, "Marking session " + sessionId + " as applied");
|
||||
}
|
||||
cleanStageDir();
|
||||
mCallback.onStagedSessionChanged(this);
|
||||
}
|
||||
|
||||
@@ -2095,6 +2098,19 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanStageDir() {
|
||||
if (isMultiPackage()) {
|
||||
for (int childSessionId : getChildSessionIds()) {
|
||||
mSessionProvider.getSession(childSessionId).cleanStageDir();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
mPm.mInstaller.rmPackageDir(stageDir.getAbsolutePath());
|
||||
} catch (InstallerException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dump(IndentingPrintWriter pw) {
|
||||
synchronized (mLock) {
|
||||
dumpLocked(pw);
|
||||
|
||||
Reference in New Issue
Block a user