Allow setupwizard.mode to be changed in the launcher

BUG: 114768938
Test: Yes
Change-Id: I8e89bb2aeb454431c89f7f43ae8a507b6de4a30b
(cherry picked from commit 5986ae368e64106ff2bb43112072078ae5741d46)
diff --git a/host/commands/launch/main.cc b/host/commands/launch/main.cc
index 1b6cd63..0cf4f28 100644
--- a/host/commands/launch/main.cc
+++ b/host/commands/launch/main.cc
@@ -181,6 +181,8 @@
 
 DEFINE_string(device_title, "", "Human readable name for the instance, "
               "used by the vnc_server for its server title");
+DEFINE_string(setupwizard_mode, "DISABLED",
+	      "One of DISABLED,OPTIONAL,REQUIRED");
 
 DECLARE_string(config_file);
 
@@ -502,6 +504,7 @@
   config->set_memory_mb(FLAGS_memory_mb);
 
   config->set_dpi(FLAGS_dpi);
+  config->set_setupwizard_mode(FLAGS_setupwizard_mode);
   config->set_x_res(FLAGS_x_res);
   config->set_y_res(FLAGS_y_res);
   config->set_refresh_rate_hz(FLAGS_refresh_rate_hz);
@@ -539,6 +542,8 @@
       concat("androidboot.serialno=", FLAGS_serial_number));
   config->add_kernel_cmdline("mac80211_hwsim.radios=0");
   config->add_kernel_cmdline(concat("androidboot.lcd_density=", FLAGS_dpi));
+  config->add_kernel_cmdline(concat("androidboot.setupwizard_mode=",
+				    FLAGS_setupwizard_mode));
   config->add_kernel_cmdline(concat("loop.max_part=", FLAGS_loop_max_part));
   if (!FLAGS_console.empty()) {
     config->add_kernel_cmdline(concat("console=", FLAGS_console));
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index ffc9410..d1507f8 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -118,6 +118,7 @@
 const char* kCuttlefishEnvPath = "cuttlefish_env_path";
 
 const char* kAdbMode = "adb_mode";
+const char* kSetupWizardMode = "setupwizard_mode";
 }  // namespace
 
 namespace vsoc {
@@ -479,6 +480,14 @@
   (*dictionary_)[kDeviceTitle] = title;
 }
 
+std::string CuttlefishConfig::setupwizard_mode() const {
+  return (*dictionary_)[kSetupWizardMode].asString();
+}
+
+void CuttlefishConfig::set_setupwizard_mode(const std::string& mode) {
+  (*dictionary_)[kSetupWizardMode] = mode;
+}
+
 // Creates the (initially empty) config object and populates it with values from
 // the config file if the --config_file command line argument is present.
 // Returns nullptr if there was an error loading from file
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index ed0a0a3..cbe280d 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -189,6 +189,9 @@
   void set_device_title(const std::string& title);
   std::string device_title() const;
 
+  void set_setupwizard_mode(const std::string& title);
+  std::string setupwizard_mode() const;
+
  private:
   std::unique_ptr<Json::Value> dictionary_;