Add IVold::destroyDsuMetadataKey()
destroyDsuMetadataKey() / destroy_dsu_metadata_key() calls
android::gsi::GetDsuMetadataKeyDir() to query the DSU metadata
encryption key dir and destroy the key.
This releases the resource and allows consecutive DSU installations to
use the same key *directory*, but not the same key *blob*.
Bug: 168571434
Test: 1. Install a DSU system.
2. Boot the DSU system and reboot back to the host system.
3. Wipe the DSU installation.
4. DSU metadata key dir /metadata/vold/metadata_encryption/dsu/dsu is
destroyed.
Change-Id: Ib851177315a5a266807f46ccfd446de1848232cf
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index d310acd..3fb4e65 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -950,5 +950,12 @@
return translate(incfs::bindMount(sourceDir, targetDir));
}
+binder::Status VoldNativeService::destroyDsuMetadataKey(const std::string& dsuSlot) {
+ ENFORCE_SYSTEM_OR_ROOT;
+ ACQUIRE_LOCK;
+
+ return translateBool(destroy_dsu_metadata_key(dsuSlot));
+}
+
} // namespace vold
} // namespace android