Add method to forget private partition keys.

Report both the disk and the partition GUID for private volumes to
userspace, and offer to forget the encryption key for a given
partition GUID.

Bug: 21782268
Change-Id: Ie77a3a58e47bf3563cdb3e4b0edfab1de4d0e6b4
diff --git a/Disk.cpp b/Disk.cpp
index a536dbf..c680a43 100644
--- a/Disk.cpp
+++ b/Disk.cpp
@@ -72,8 +72,6 @@
 static const char* kGptAndroidMeta = "19A710A2-B3CA-11E4-B026-10604B889DCF";
 static const char* kGptAndroidExpand = "193D1EA4-B3CA-11E4-B075-10604B889DCF";
 
-static const char* kKeyPath = "/data/misc/vold";
-
 enum class Table {
     kUnknown,
     kMbr,
@@ -126,10 +124,6 @@
     return OK;
 }
 
-static std::string BuildKeyPath(const std::string& partGuid) {
-    return StringPrintf("%s/expand_%s.key", kKeyPath, partGuid.c_str());
-}
-
 void Disk::createPublicVolume(dev_t device) {
     auto vol = std::shared_ptr<VolumeBase>(new PublicVolume(device));
     if (mJustPartitioned) {
@@ -147,13 +141,11 @@
 }
 
 void Disk::createPrivateVolume(dev_t device, const std::string& partGuid) {
-    std::string tmp;
     std::string normalizedGuid;
-    if (HexToStr(partGuid, tmp)) {
+    if (NormalizeHex(partGuid, normalizedGuid)) {
         LOG(WARNING) << "Invalid GUID " << partGuid;
         return;
     }
-    StrToHex(tmp, normalizedGuid);
 
     std::string keyRaw;
     if (!ReadFileToString(BuildKeyPath(normalizedGuid), &keyRaw)) {
@@ -175,6 +167,7 @@
 
     mVolumes.push_back(vol);
     vol->setDiskId(getId());
+    vol->setPartGuid(partGuid);
     vol->create();
 }