Merge changes from topic "fail-validation-q" into qt-qpr1-dev
* changes: Delete orphaned staging directories for staged session on reboot Clean up staged session data on validation failure
This commit is contained in:
committed by
Android (Google) Code Review
commit
b467f2237e
@@ -287,6 +287,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
|||||||
final ArraySet<File> unclaimedStages = newArraySet(
|
final ArraySet<File> unclaimedStages = newArraySet(
|
||||||
stagingDir.listFiles(sStageFilter));
|
stagingDir.listFiles(sStageFilter));
|
||||||
|
|
||||||
|
// We also need to clean up orphaned staging directory for staged sessions
|
||||||
|
final File stagedSessionStagingDir = Environment.getDataStagingDirectory(volumeUuid);
|
||||||
|
unclaimedStages.addAll(newArraySet(stagedSessionStagingDir.listFiles()));
|
||||||
|
|
||||||
// Ignore stages claimed by active sessions
|
// Ignore stages claimed by active sessions
|
||||||
for (int i = 0; i < mSessions.size(); i++) {
|
for (int i = 0; i < mSessions.size(); i++) {
|
||||||
final PackageInstallerSession session = mSessions.valueAt(i);
|
final PackageInstallerSession session = mSessions.valueAt(i);
|
||||||
|
|||||||
@@ -881,6 +881,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
+ mParentSessionId + " and may not be committed directly.");
|
+ mParentSessionId + " and may not be committed directly.");
|
||||||
}
|
}
|
||||||
if (!markAsCommitted(statusReceiver, forTransfer)) {
|
if (!markAsCommitted(statusReceiver, forTransfer)) {
|
||||||
|
if (isStaged()) {
|
||||||
|
// cleanStageDir calls mSessionProvider to get hold of child sessions, which in turn
|
||||||
|
// needs PackageInstallerService#mSessions lock. So we should not call cleanStageDir
|
||||||
|
// while holding mLock to avoid lock inversion.
|
||||||
|
cleanStageDir();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isMultiPackage()) {
|
if (isMultiPackage()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user