diff --git a/FsCrypt.cpp b/FsCrypt.cpp index 6c120a7..a94c97c 100644 --- a/FsCrypt.cpp +++ b/FsCrypt.cpp @@ -265,10 +265,9 @@ static bool get_volume_file_encryption_options(EncryptionOptions* options) { // HEH as default was always a mistake. Use the libfscrypt default (CTS) // for devices launching on versions above Android 10. auto first_api_level = GetFirstApiLevel(); - constexpr uint64_t pre_gki_level = 29; auto filenames_mode = android::base::GetProperty("ro.crypto.volume.filenames_mode", - first_api_level > pre_gki_level ? "" : "aes-256-heh"); + first_api_level > __ANDROID_API_Q__ ? "" : "aes-256-heh"); auto options_string = android::base::GetProperty("ro.crypto.volume.options", contents_mode + ":" + filenames_mode); if (!ParseOptionsForApiLevel(first_api_level, options_string, options)) { diff --git a/MetadataCrypt.cpp b/MetadataCrypt.cpp index ca2813d..c61132c 100644 --- a/MetadataCrypt.cpp +++ b/MetadataCrypt.cpp @@ -283,10 +283,9 @@ bool fscrypt_mount_metadata_encrypted(const std::string& blk_device, const std:: return false; } - constexpr unsigned int pre_gki_level = 29; unsigned int options_format_version = android::base::GetUintProperty( "ro.crypto.dm_default_key.options_format.version", - (GetFirstApiLevel() <= pre_gki_level ? 1 : 2)); + (GetFirstApiLevel() <= __ANDROID_API_Q__ ? 1 : 2)); CryptoOptions options; if (options_format_version == 1) { diff --git a/model/VolumeEncryption.cpp b/model/VolumeEncryption.cpp index 5b0e73d..e6a55a9 100644 --- a/model/VolumeEncryption.cpp +++ b/model/VolumeEncryption.cpp @@ -32,16 +32,16 @@ namespace vold { enum class VolumeMethod { kFailed, kCrypt, kDefaultKey }; static VolumeMethod lookup_volume_method() { - constexpr uint64_t pre_gki_level = 29; auto first_api_level = android::base::GetUintProperty("ro.product.first_api_level", 0); auto method = android::base::GetProperty("ro.crypto.volume.metadata.method", "default"); if (method == "default") { - return first_api_level > pre_gki_level ? VolumeMethod::kDefaultKey : VolumeMethod::kCrypt; + return first_api_level > __ANDROID_API_Q__ ? VolumeMethod::kDefaultKey + : VolumeMethod::kCrypt; } else if (method == "dm-default-key") { return VolumeMethod::kDefaultKey; } else if (method == "dm-crypt") { - if (first_api_level > pre_gki_level) { + if (first_api_level > __ANDROID_API_Q__) { LOG(ERROR) << "volume encryption method dm-crypt cannot be used, " "ro.product.first_api_level = " << first_api_level;