diff options
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 98a980571..102833019 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -84,6 +84,7 @@ using namespace std::literals::string_literals; using android::base::Basename; +using android::base::SetProperty; using android::base::StartsWith; using android::base::StringPrintf; using android::base::unique_fd; @@ -561,16 +562,16 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) { LOG(ERROR) << "Userdata remount is not supported on FDE devices. How did you get here?"; trigger_shutdown("reboot,requested-userdata-remount-on-fde-device"); } - property_set("ro.crypto.state", "encrypted"); - property_set("ro.crypto.type", "block"); + SetProperty("ro.crypto.state", "encrypted"); + SetProperty("ro.crypto.type", "block"); ActionManager::GetInstance().QueueEventTrigger("defaultcrypto"); return {}; } else if (code == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) { - property_set("ro.crypto.state", "unencrypted"); + SetProperty("ro.crypto.state", "unencrypted"); ActionManager::GetInstance().QueueEventTrigger("nonencrypted"); return {}; } else if (code == FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE) { - property_set("ro.crypto.state", "unsupported"); + SetProperty("ro.crypto.state", "unsupported"); ActionManager::GetInstance().QueueEventTrigger("nonencrypted"); return {}; } else if (code == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY) { @@ -586,8 +587,8 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) { if (!FscryptInstallKeyring()) { return Error() << "FscryptInstallKeyring() failed"; } - property_set("ro.crypto.state", "encrypted"); - property_set("ro.crypto.type", "file"); + SetProperty("ro.crypto.state", "encrypted"); + SetProperty("ro.crypto.type", "file"); // Although encrypted, we have device key, so we do not need to // do anything different from the nonencrypted case. @@ -597,8 +598,8 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) { if (!FscryptInstallKeyring()) { return Error() << "FscryptInstallKeyring() failed"; } - property_set("ro.crypto.state", "encrypted"); - property_set("ro.crypto.type", "file"); + SetProperty("ro.crypto.state", "encrypted"); + SetProperty("ro.crypto.type", "file"); // Although encrypted, vold has already set the device up, so we do not need to // do anything different from the nonencrypted case. @@ -608,8 +609,8 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) { if (!FscryptInstallKeyring()) { return Error() << "FscryptInstallKeyring() failed"; } - property_set("ro.crypto.state", "encrypted"); - property_set("ro.crypto.type", "file"); + SetProperty("ro.crypto.state", "encrypted"); + SetProperty("ro.crypto.type", "file"); // Although encrypted, vold has already set the device up, so we do not need to // do anything different from the nonencrypted case. @@ -662,7 +663,7 @@ static Result<void> do_mount_all(const BuiltinArguments& args) { } auto mount_fstab_return_code = fs_mgr_mount_all(&fstab, mount_mode); - property_set(prop_name, std::to_string(t.duration().count())); + SetProperty(prop_name, std::to_string(t.duration().count())); if (import_rc && SelinuxGetVendorAndroidVersion() <= __ANDROID_API_Q__) { /* Paths of .rc files are specified at the 2nd argument and beyond */ @@ -718,7 +719,7 @@ static Result<void> do_setprop(const BuiltinArguments& args) { << "' from init; use the restorecon builtin directly"; } - property_set(args[1], args[2]); + SetProperty(args[1], args[2]); return {}; } @@ -832,7 +833,7 @@ static Result<void> do_verity_update_state(const BuiltinArguments& args) { // To be consistent in vboot 1.0 and vboot 2.0 (AVB), use "system" for the partition even // for system as root, so it has property [partition.system.verified]. std::string partition = entry.mount_point == "/" ? "system" : Basename(entry.mount_point); - property_set("partition." + partition + ".verified", std::to_string(mode)); + SetProperty("partition." + partition + ".verified", std::to_string(mode)); } return {}; @@ -1221,8 +1222,8 @@ static Result<void> do_enter_default_mount_ns(const BuiltinArguments& args) { static Result<void> do_finish_userspace_reboot(const BuiltinArguments&) { LOG(INFO) << "Userspace reboot successfully finished"; boot_clock::time_point now = boot_clock::now(); - property_set("sys.init.userspace_reboot.last_finished", - std::to_string(now.time_since_epoch().count())); + SetProperty("sys.init.userspace_reboot.last_finished", + std::to_string(now.time_since_epoch().count())); if (!android::sysprop::InitProperties::userspace_reboot_in_progress(false)) { return Error() << "Failed to set sys.init.userspace_reboot.in_progress property"; } |