Merge "vold: use __ANDROID_API_Q__ instead of pre_gki_level" am: ee1a70c129
am: c6f47996d6
am: 124f3575be
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1395128 Change-Id: I09a23c705c2fe0bc01c321f38c3eadb7bd1e44da
This commit is contained in:
commit
86eefdac89
3 changed files with 5 additions and 7 deletions
|
@ -269,10 +269,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)) {
|
||||
|
|
|
@ -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<unsigned int>(
|
||||
"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) {
|
||||
|
|
|
@ -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<uint64_t>("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;
|
||||
|
|
Loading…
Reference in a new issue