From fa9516530079654092d9645ba6e8fee714292f78 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 2 Dec 2021 12:51:20 -0800 Subject: Use metadata_key_dir instead of metadata_encryption Eric pointed that metadata_key_dir is what specifies that metadata encryption is enabled, whereas metadata_encryption is the metadata encryption options, which don't have to be specified if the default options are sufficient. Bug: 208161227 Fixes: 80a1d8e34116 ("Avoid to format raw disk if metadata encryption is enabled") Signed-off-by: Eric Biggers Signed-off-by: Jaegeuk Kim Change-Id: I390450ba49c528b1f465c247d32174d36c7937a2 --- recovery_utils/roots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recovery_utils/roots.cpp b/recovery_utils/roots.cpp index d761e7525..7fe385b5e 100644 --- a/recovery_utils/roots.cpp +++ b/recovery_utils/roots.cpp @@ -182,7 +182,7 @@ int format_volume(const std::string& volume, const std::string& directory) { // to get any failure in the process. In order to avoid it, let's simply wipe // the raw disk if we don't reserve any space, which behaves exactly same as booting // after "fastboot -w". - if (!v->metadata_encryption.empty() && length == 0) { + if (!v->metadata_key_dir.empty() && length == 0) { android::base::unique_fd fd(open(v->blk_device.c_str(), O_RDWR)); if (fd == -1) { PLOG(ERROR) << "format_volume: failed to open " << v->blk_device; -- cgit v1.2.3