summaryrefslogtreecommitdiff
path: root/artd/artd_main.cc
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-01-31 10:26:02 +0800
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-02-06 05:08:04 +0000
commitc5ee51b87354b5f741eb956528ef9367917e9030 (patch)
tree1f0115d98e23b8a2e48f713838e2023b268a72b4 /artd/artd_main.cc
parenteeb1396a833d0df33da1578c3f4efed41673562d (diff)
Add service dexopt_chroot_setup and artd_pre_reboot.
Boilerplate changes. Bug: 311377497 Test: manual - Call getDexoptChrootSetupServiceRegisterer().waitForService() Test: manual - Set up a chroot environment and call getArtdPreRebootServiceRegisterer().waitForService() Test: manual - Test the fuzzers on host and on device following the instructions at https://source.android.com/docs/security/test/libfuzzer. Change-Id: Ic576d741ae0fe058833d3bbad6ebb5188ccf200a
Diffstat (limited to 'artd/artd_main.cc')
-rw-r--r--artd/artd_main.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/artd/artd_main.cc b/artd/artd_main.cc
index 9fe5bd81b4..212e9c4046 100644
--- a/artd/artd_main.cc
+++ b/artd/artd_main.cc
@@ -22,10 +22,39 @@
#include "android/binder_process.h"
#include "artd.h"
+namespace art {
+namespace artd {
+namespace {
+
+constexpr int kErrorUsage = 100;
+
+[[noreturn]] void ParseError(const std::string& error_msg) {
+ LOG(ERROR) << error_msg;
+ std::cerr << error_msg << "\n";
+ exit(kErrorUsage);
+}
+
+Options ParseOptions(int argc, char** argv) {
+ Options options;
+ for (int i = 1; i < argc; i++) {
+ std::string_view arg = argv[i];
+ if (arg == "--pre-reboot") {
+ options.is_pre_reboot = true;
+ } else {
+ ParseError("Unknown option " + std::string(arg));
+ }
+ }
+ return options;
+}
+
+} // namespace
+} // namespace artd
+} // namespace art
+
int main([[maybe_unused]] int argc, char* argv[]) {
android::base::InitLogging(argv);
- auto artd = ndk::SharedRefBase::make<art::artd::Artd>();
+ auto artd = ndk::SharedRefBase::make<art::artd::Artd>(art::artd::ParseOptions(argc, argv));
LOG(INFO) << "Starting artd";