Add installd method to delete CE snapshots.
This adds a new installd service method to allow CE snapshots to be
deleted.
The existing method for deleting snapshots - destroyAppDataSnapshot -
does not work if the user is not unlocked. Although it takes the inode
of the snapshot directory, it still cannot access the parent directory
and so the delete fails.
The new method is destroyCeSnapshotsNotSpecified, as it deletes all
CE snapshots for the specified user, except for those with snapshot ids
in a provided list.
RollbackManager will call this method when the user unlocks, passing a
list of all current rollbacks. This will ensure that all expired
snapshots are deleted. It will also allow any "orphaned" snapshots
(e.g. from tests or previous snapshots that have not been deleted) to
be cleaned up.
The new method is expected to be called when the user has unlocked -
it will fail if the user is not unlocked.
Bug: 147806409
Test: atest AppDataSnapshotTest#DestroyCeSnapshotsNotSpecified (new test)
Change-Id: Iab048733ac794261f906ffb9e3b19f331dc67a76
Merged-In: Iab048733ac794261f906ffb9e3b19f331dc67a76
diff --git a/cmds/installd/InstalldNativeService.h b/cmds/installd/InstalldNativeService.h
index 80a88b4..1a8da5f 100644
--- a/cmds/installd/InstalldNativeService.h
+++ b/cmds/installd/InstalldNativeService.h
@@ -69,6 +69,8 @@
binder::Status destroyAppDataSnapshot(const std::optional<std::string> &volumeUuid,
const std::string& packageName, const int32_t user, const int64_t ceSnapshotInode,
const int32_t snapshotId, int32_t storageFlags);
+ binder::Status destroyCeSnapshotsNotSpecified(const std::optional<std::string> &volumeUuid,
+ const int32_t user, const std::vector<int32_t>& retainSnapshotIds);
binder::Status getAppSize(const std::optional<std::string>& uuid,
const std::vector<std::string>& packageNames, int32_t userId, int32_t flags,