Pass both partition GUID and filesystem UUID.
FDE keys are indexed using the partition GUID, while FBE keys will be
indexed using the filesystem UUID, so pass both of those identifiers
along when forgetting a volume.
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 25861755
Change-Id: I6e239d5ba67a01c9a848d705f6167da00f975924
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index d8832d3..0053478 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -302,12 +302,14 @@
}
}
-binder::Status VoldNativeService::forgetPartition(const std::string& partGuid) {
+binder::Status VoldNativeService::forgetPartition(const std::string& partGuid,
+ const std::string& fsUuid) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_HEX(partGuid);
+ CHECK_ARGUMENT_HEX(fsUuid);
ACQUIRE_LOCK;
- return translate(VolumeManager::Instance()->forgetPartition(partGuid));
+ return translate(VolumeManager::Instance()->forgetPartition(partGuid, fsUuid));
}
binder::Status VoldNativeService::mount(const std::string& volId, int32_t mountFlags,
diff --git a/VoldNativeService.h b/VoldNativeService.h
index dd2b854..8368bdc 100644
--- a/VoldNativeService.h
+++ b/VoldNativeService.h
@@ -44,7 +44,7 @@
binder::Status onUserStopped(int32_t userId);
binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio);
- binder::Status forgetPartition(const std::string& partGuid);
+ binder::Status forgetPartition(const std::string& partGuid, const std::string& fsUuid);
binder::Status mount(const std::string& volId, int32_t mountFlags, int32_t mountUserId);
binder::Status unmount(const std::string& volId);
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index befb54d..3194e59 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -293,7 +293,7 @@
}
}
-int VolumeManager::forgetPartition(const std::string& partGuid) {
+int VolumeManager::forgetPartition(const std::string& partGuid, const std::string& fsUuid) {
std::string normalizedGuid;
if (android::vold::NormalizeHex(partGuid, normalizedGuid)) {
LOG(WARNING) << "Invalid GUID " << partGuid;
diff --git a/VolumeManager.h b/VolumeManager.h
index b66aa2f..8a780c4 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -89,7 +89,7 @@
void listVolumes(android::vold::VolumeBase::Type type, std::list<std::string>& list);
- int forgetPartition(const std::string& partGuid);
+ int forgetPartition(const std::string& partGuid, const std::string& fsUuid);
int onUserAdded(userid_t userId, int userSerialNumber);
int onUserRemoved(userid_t userId);
diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl
index d47f113..32d9b16 100644
--- a/binder/android/os/IVold.aidl
+++ b/binder/android/os/IVold.aidl
@@ -34,7 +34,7 @@
void onUserStopped(int userId);
void partition(@utf8InCpp String diskId, int partitionType, int ratio);
- void forgetPartition(@utf8InCpp String partGuid);
+ void forgetPartition(@utf8InCpp String partGuid, @utf8InCpp String fsUuid);
void mount(@utf8InCpp String volId, int mountFlags, int mountUserId);
void unmount(@utf8InCpp String volId);