Delete APK snapshots during restoration (3/n)

The snapshots are no longer needed after restore is done.

We do this in keeping with the fact that apk/apex code data is
deleted immediately after the rollback is committed.

See go/rollbackmanager-snapshot-deletion for more details.

Bug: 151805360
Test: N/A. Will be added in the next CL.

Merged-In: I5a7540aa08922c4b0c617c9cb37e1bec2ff23fc1
Change-Id: I5a7540aa08922c4b0c617c9cb37e1bec2ff23fc1
This commit is contained in:
JW Wang 2020-05-18 16:54:08 +08:00
parent a38a3e145a
commit 9b9b1aa062

View file

@ -1074,6 +1074,7 @@ binder::Status InstalldNativeService::restoreAppDataSnapshot(
res = error(rc, "Failed copying " + from_ce + " to " + to_ce); res = error(rc, "Failed copying " + from_ce + " to " + to_ce);
return res; return res;
} }
delete_dir_contents_and_dir(from_ce, true /* ignore_if_missing */);
} }
if (needs_de_rollback) { if (needs_de_rollback) {
@ -1090,6 +1091,7 @@ binder::Status InstalldNativeService::restoreAppDataSnapshot(
res = error(rc, "Failed copying " + from_de + " to " + to_de); res = error(rc, "Failed copying " + from_de + " to " + to_de);
return res; return res;
} }
delete_dir_contents_and_dir(from_de, true /* ignore_if_missing */);
} }
// Finally, restore the SELinux label on the app data. // Finally, restore the SELinux label on the app data.