Move some properties users to __system_property_read_callback()
This is needed if they will ever handle ro. properties that have
values longer than 92 characters.
Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
diff --git a/fs_mgr/Android.bp b/fs_mgr/Android.bp
index 7fd67c2..2f530ef 100644
--- a/fs_mgr/Android.bp
+++ b/fs_mgr/Android.bp
@@ -55,12 +55,22 @@
"liblogwrap",
"libfstab",
],
+ cppflags: [
+ "-DALLOW_SKIP_SECURE_CHECK=0",
+ "-DALLOW_ADBD_DISABLE_VERITY=0",
+ ],
product_variables: {
debuggable: {
- cppflags: ["-DALLOW_ADBD_DISABLE_VERITY=1"],
+ cppflags: [
+ "-UALLOW_ADBD_DISABLE_VERITY",
+ "-DALLOW_ADBD_DISABLE_VERITY=1",
+ ],
},
eng: {
- cppflags: ["-DALLOW_SKIP_SECURE_CHECK=1"],
+ cppflags: [
+ "-UALLOW_SKIP_SECURE_CHECK",
+ "-DALLOW_SKIP_SECURE_CHECK=1",
+ ],
},
},
}
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 874189a..47e3e17 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -543,15 +543,6 @@
return ret;
}
-static int device_is_force_encrypted() {
- int ret = -1;
- char value[PROP_VALUE_MAX];
- ret = __system_property_get("ro.vold.forceencryption", value);
- if (ret < 0)
- return 0;
- return strcmp(value, "1") ? 0 : 1;
-}
-
/*
* Tries to mount any of the consecutive fstab entries that match
* the mountpoint of the one given by fstab->recs[start_idx].
@@ -726,7 +717,9 @@
static bool needs_block_encryption(const struct fstab_rec* rec)
{
- if (device_is_force_encrypted() && fs_mgr_is_encryptable(rec)) return true;
+ if (android::base::GetBoolProperty("ro.vold.forceencryption", false) &&
+ fs_mgr_is_encryptable(rec))
+ return true;
if (rec->fs_mgr_flags & MF_FORCECRYPT) return true;
if (rec->fs_mgr_flags & MF_CRYPT) {
/* Check for existence of convert_fde breadcrumb file */
@@ -769,20 +762,7 @@
}
bool is_device_secure() {
- int ret = -1;
- char value[PROP_VALUE_MAX];
- ret = __system_property_get("ro.secure", value);
- if (ret == 0) {
-#ifdef ALLOW_SKIP_SECURE_CHECK
- // Allow eng builds to skip this check if the property
- // is not readable (happens during early mount)
- return false;
-#else
- // If error and not an 'eng' build, we want to fail secure.
- return true;
-#endif
- }
- return strcmp(value, "0") ? true : false;
+ return android::base::GetBoolProperty("ro.secure", ALLOW_SKIP_SECURE_CHECK ? false : true);
}
/* When multiple fstab records share the same mount_point, it will