Move LogcatReceiverBinary, ConfigServerBinary into a new known_paths.h file
These cannot be configured at runtime, so they do not have to be stored
in the config.
Test: m -j && launch_cvd --daemon
Bug: 160900931
Change-Id: I9a1a1869307eb397948eac3b333d50741ff1a8f9
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 9d82252..670f86d 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -428,10 +428,6 @@
}
tmp_config_obj.set_deprecated_boot_completed(FLAGS_deprecated_boot_completed);
- tmp_config_obj.set_logcat_receiver_binary(
- cuttlefish::DefaultHostArtifactsPath("bin/logcat_receiver"));
- tmp_config_obj.set_config_server_binary(
- cuttlefish::DefaultHostArtifactsPath("bin/config_server"));
tmp_config_obj.set_qemu_binary(FLAGS_qemu_binary);
tmp_config_obj.set_crosvm_binary(FLAGS_crosvm_binary);
diff --git a/host/commands/run_cvd/launch.cc b/host/commands/run_cvd/launch.cc
index d3818d5..e0855c9 100644
--- a/host/commands/run_cvd/launch.cc
+++ b/host/commands/run_cvd/launch.cc
@@ -10,6 +10,7 @@
#include "common/libs/utils/size_utils.h"
#include "host/commands/run_cvd/pre_launch_initializers.h"
#include "host/commands/run_cvd/runner_defs.h"
+#include "host/libs/config/known_paths.h"
#include "host/libs/vm_manager/crosvm_manager.h"
#include "host/libs/vm_manager/qemu_manager.h"
@@ -188,7 +189,7 @@
// due to the usage counters in the kernel reaching zero. If this is not done
// and the logcat_receiver crashes for some reason the VMM may get SIGPIPE.
pipe = cuttlefish::SharedFD::Open(log_name.c_str(), O_RDWR);
- cuttlefish::Command command(config.logcat_receiver_binary());
+ cuttlefish::Command command(cuttlefish::LogcatReceiverBinary());
command.AddParameter("-log_pipe_fd=", pipe);
process_monitor->StartSubprocess(std::move(command),
@@ -206,7 +207,7 @@
<< socket->StrError();
std::exit(RunnerExitCodes::kConfigServerError);
}
- cuttlefish::Command cmd(config.config_server_binary());
+ cuttlefish::Command cmd(cuttlefish::ConfigServerBinary());
cmd.AddParameter("-server_fd=", socket);
process_monitor->StartSubprocess(std::move(cmd),
GetOnSubprocessExitCallback(config));
diff --git a/host/libs/config/Android.bp b/host/libs/config/Android.bp
index 47d2ff8..bfdd667 100644
--- a/host/libs/config/Android.bp
+++ b/host/libs/config/Android.bp
@@ -21,6 +21,7 @@
"data_image.cpp",
"fetcher_config.cpp",
"kernel_args.cpp",
+ "known_paths.cpp",
"logging.cpp",
],
shared_libs: [
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 492d63e..d075525 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -133,9 +133,6 @@
const char* kBlankDataImageMb = "blank_data_image_mb";
const char* kBlankDataImageFmt = "blank_data_image_fmt";
-const char* kLogcatReceiverBinary = "logcat_receiver_binary";
-const char* kConfigServerBinary = "config_server_binary";
-
const char* kTombstoneReceiverBinary = "tombstone_receiver_binary";
const char* kWebRTCCertsDir = "webrtc_certs_dir";
@@ -578,22 +575,6 @@
(*dictionary_)[kBlankDataImageFmt] = blank_data_image_fmt;
}
-void CuttlefishConfig::set_logcat_receiver_binary(const std::string& binary) {
- SetPath(kLogcatReceiverBinary, binary);
-}
-
-std::string CuttlefishConfig::logcat_receiver_binary() const {
- return (*dictionary_)[kLogcatReceiverBinary].asString();
-}
-
-void CuttlefishConfig::set_config_server_binary(const std::string& binary) {
- SetPath(kConfigServerBinary, binary);
-}
-
-std::string CuttlefishConfig::config_server_binary() const {
- return (*dictionary_)[kConfigServerBinary].asString();
-}
-
std::string CuttlefishConfig::tombstone_receiver_binary() const {
return (*dictionary_)[kTombstoneReceiverBinary].asString();
}
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index d8025ef..f835af8 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -144,12 +144,6 @@
bool deprecated_boot_completed() const;
void set_deprecated_boot_completed(bool deprecated_boot_completed);
- std::string logcat_receiver_binary() const;
- void set_logcat_receiver_binary(const std::string& binary);
-
- std::string config_server_binary() const;
- void set_config_server_binary(const std::string& binary);
-
void set_cuttlefish_env_path(const std::string& path);
std::string cuttlefish_env_path() const;
diff --git a/host/libs/config/known_paths.cpp b/host/libs/config/known_paths.cpp
new file mode 100644
index 0000000..ac0c0bf
--- /dev/null
+++ b/host/libs/config/known_paths.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/libs/config/known_paths.h"
+
+#include "host/libs/config/cuttlefish_config.h"
+
+namespace cuttlefish {
+
+std::string ConfigServerBinary() {
+ return DefaultHostArtifactsPath("bin/config_server");
+}
+
+std::string LogcatReceiverBinary() {
+ return DefaultHostArtifactsPath("bin/logcat_receiver");
+}
+
+} // namespace cuttlefish
diff --git a/host/libs/config/known_paths.h b/host/libs/config/known_paths.h
new file mode 100644
index 0000000..e61dc31
--- /dev/null
+++ b/host/libs/config/known_paths.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+
+namespace cuttlefish {
+
+std::string ConfigServerBinary();
+std::string LogcatReceiverBinary();
+
+} // namespace cuttlefish