Merge "init: fix DumpState() logging" am: f31abeb973 am: a968df9edb
am: 032f0a2655

Change-Id: I777b0fe5d423add331fd85eee2450a2efa6d1201
diff --git a/init/action.cpp b/init/action.cpp
index 09de81a..1bba0f2 100644
--- a/init/action.cpp
+++ b/init/action.cpp
@@ -246,20 +246,16 @@
 }
 
 std::string Action::BuildTriggersString() const {
-    std::string result;
+    std::vector<std::string> triggers;
 
     for (const auto& [trigger_name, trigger_value] : property_triggers_) {
-        result += trigger_name;
-        result += '=';
-        result += trigger_value;
-        result += ' ';
+        triggers.emplace_back(trigger_name + '=' + trigger_value);
     }
     if (!event_trigger_.empty()) {
-        result += event_trigger_;
-        result += ' ';
+        triggers.emplace_back(event_trigger_);
     }
-    result.pop_back();
-    return result;
+
+    return Join(triggers, " && ");
 }
 
 void Action::DumpState() const {
@@ -268,7 +264,7 @@
 
     for (const auto& c : commands_) {
         std::string cmd_str = c.BuildCommandString();
-        LOG(INFO) << "  %s" << cmd_str;
+        LOG(INFO) << "  " << cmd_str;
     }
 }
 
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 507c4a0..43eb378 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -494,6 +494,10 @@
             parser.ParseConfig(args[i]);
         }
     }
+
+    // Turning this on and letting the INFO logging be discarded adds 0.2s to
+    // Nexus 9 boot time, so it's disabled by default.
+    if (false) parser.DumpState();
 }
 
 /* mount_fstab
diff --git a/init/init.cpp b/init/init.cpp
index 5ab421b..4e31865 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -1254,6 +1254,10 @@
         parser.set_is_odm_etc_init_loaded(true);
     }
 
+    // Turning this on and letting the INFO logging be discarded adds 0.2s to
+    // Nexus 9 boot time, so it's disabled by default.
+    if (false) parser.DumpState();
+
     ActionManager& am = ActionManager::GetInstance();
 
     am.QueueEventTrigger("early-init");
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index 406b339..326ebf2 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -106,10 +106,6 @@
         sp.second->EndFile(path);
     }
 
-    // Turning this on and letting the INFO logging be discarded adds 0.2s to
-    // Nexus 9 boot time, so it's disabled by default.
-    if (false) DumpState();
-
     LOG(VERBOSE) << "(Parsing " << path << " took " << t << ".)";
     return true;
 }