From 6c01baf075b6c9de1939afca86b6069355348710 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 9 Mar 2021 13:49:59 -0800 Subject: [PATCH] init: check for verifiedbootstate in properties This check in export_oem_lock_status happens after PropertyInit() so all of the ro.boot.* properties will be set. There is no need to import the kernel cmdline again. Test: build and boot cuttlefish Bug: 173815685 Change-Id: I5df7c0105566d4617442dbb8e77eb26e465775f1 --- init/init.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/init/init.cpp b/init/init.cpp index 70d68097f..7264b22f0 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -518,11 +518,9 @@ static void export_oem_lock_status() { if (!android::base::GetBoolProperty("ro.oem_unlock_supported", false)) { return; } - ImportKernelCmdline([](const std::string& key, const std::string& value) { - if (key == "androidboot.verifiedbootstate") { - SetProperty("ro.boot.flash.locked", value == "orange" ? "0" : "1"); - } - }); + SetProperty( + "ro.boot.flash.locked", + android::base::GetProperty("ro.boot.verifiedbootstate", "") == "orange" ? "0" : "1"); } static Result property_enable_triggers_action(const BuiltinArguments& args) {