blob: a1739f9ad84d6e2ae33453510ea9af9630058ad8 [file] [log] [blame]
Jiyong Parka7266ac2021-05-17 21:57:24 +09001/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Alan Stokesd1a30dd2022-11-30 09:39:54 +000016
Inseob Kim06a64d62021-09-07 21:21:45 +090017#include <aidl/com/android/microdroid/testservice/BnTestService.h>
Alan Stokes63fa37b2023-02-22 14:56:57 +000018#include <aidl/com/android/microdroid/testservice/BnVmCallback.h>
19#include <aidl/com/android/microdroid/testservice/IAppCallback.h>
Inseob Kimdb319702022-01-20 13:12:43 +090020#include <android-base/file.h>
Inseob Kim691df6a2022-01-20 12:54:30 +090021#include <android-base/properties.h>
Andrew Scull11cf0902021-06-22 12:08:10 +000022#include <android-base/result.h>
Nikita Ioffe3452ee22022-12-15 00:31:56 +000023#include <android-base/scopeguard.h>
Alan Stokesd1a30dd2022-11-30 09:39:54 +000024#include <android/log.h>
Inseob Kim06a64d62021-09-07 21:21:45 +090025#include <fcntl.h>
Nikita Ioffe29e15c82023-02-25 02:31:51 +000026#include <fstab/fstab.h>
Inseob Kimdb319702022-01-20 13:12:43 +090027#include <fsverity_digests.pb.h>
Inseob Kim06a64d62021-09-07 21:21:45 +090028#include <linux/vm_sockets.h>
29#include <stdint.h>
Jiyong Parka7266ac2021-05-17 21:57:24 +090030#include <stdio.h>
Nikita Ioffe3452ee22022-12-15 00:31:56 +000031#include <sys/capability.h>
Jiyong Park23934392021-06-16 01:59:10 +090032#include <sys/system_properties.h>
Inseob Kim06a64d62021-09-07 21:21:45 +090033#include <unistd.h>
Alan Stokes52d3c722022-10-04 17:27:13 +010034#include <vm_main.h>
Alan Stokesd4ea5a82022-11-10 12:17:42 +000035#include <vm_payload_restricted.h>
Inseob Kim06a64d62021-09-07 21:21:45 +090036
Nikita Ioffed5846dc2024-11-01 18:44:45 +000037#include <cstdint>
Inseob Kim691df6a2022-01-20 12:54:30 +090038#include <string>
Alan Stokesd1a30dd2022-11-30 09:39:54 +000039#include <thread>
Jiyong Parka7266ac2021-05-17 21:57:24 +090040
Alan Stokesd1a30dd2022-11-30 09:39:54 +000041using android::base::borrowed_fd;
Inseob Kim06a64d62021-09-07 21:21:45 +090042using android::base::ErrnoError;
Andrew Scull11cf0902021-06-22 12:08:10 +000043using android::base::Error;
Nikita Ioffe3452ee22022-12-15 00:31:56 +000044using android::base::make_scope_guard;
Andrew Scull11cf0902021-06-22 12:08:10 +000045using android::base::Result;
Alan Stokesd1a30dd2022-11-30 09:39:54 +000046using android::base::unique_fd;
Nikita Ioffe29e15c82023-02-25 02:31:51 +000047using android::fs_mgr::Fstab;
48using android::fs_mgr::FstabEntry;
49using android::fs_mgr::GetEntryForMountPoint;
50using android::fs_mgr::ReadFstabFromFile;
Alan Stokesd1a30dd2022-11-30 09:39:54 +000051
52using aidl::com::android::microdroid::testservice::BnTestService;
Alan Stokes63fa37b2023-02-22 14:56:57 +000053using aidl::com::android::microdroid::testservice::BnVmCallback;
54using aidl::com::android::microdroid::testservice::IAppCallback;
Alan Stokesd1a30dd2022-11-30 09:39:54 +000055using ndk::ScopedAStatus;
Andrew Scull66616612021-06-17 16:41:03 +000056
Jiyong Parkfe5b28e2021-06-24 00:19:02 +090057extern void testlib_sub();
58
Andrew Scull66616612021-06-17 16:41:03 +000059namespace {
60
Alan Stokesd1a30dd2022-11-30 09:39:54 +000061constexpr char TAG[] = "testbinary";
62
Andrew Scull11cf0902021-06-22 12:08:10 +000063template <typename T>
Andrew Sculledbe75e2021-07-06 10:44:31 +000064Result<T> report_test(std::string name, Result<T> result) {
Andrew Scull11cf0902021-06-22 12:08:10 +000065 auto property = "debug.microdroid.test." + name;
66 std::stringstream outcome;
67 if (result.ok()) {
68 outcome << "PASS";
69 } else {
70 outcome << "FAIL: " << result.error();
Alan Stokesd1a30dd2022-11-30 09:39:54 +000071 // Log the error in case the property is truncated.
72 std::string message = name + ": " + outcome.str();
73 __android_log_write(ANDROID_LOG_WARN, TAG, message.c_str());
Andrew Scull11cf0902021-06-22 12:08:10 +000074 }
75 __system_property_set(property.c_str(), outcome.str().c_str());
Andrew Sculledbe75e2021-07-06 10:44:31 +000076 return result;
Andrew Scull66616612021-06-17 16:41:03 +000077}
78
Alan Stokesd1a30dd2022-11-30 09:39:54 +000079Result<void> run_echo_reverse_server(borrowed_fd listening_fd) {
80 struct sockaddr_vm client_sa = {};
81 socklen_t client_sa_len = sizeof(client_sa);
82 unique_fd connect_fd{accept4(listening_fd.get(), (struct sockaddr*)&client_sa, &client_sa_len,
83 SOCK_CLOEXEC)};
84 if (!connect_fd.ok()) {
85 return ErrnoError() << "Failed to accept vsock connection";
86 }
87
88 unique_fd input_fd{fcntl(connect_fd, F_DUPFD_CLOEXEC, 0)};
89 if (!input_fd.ok()) {
90 return ErrnoError() << "Failed to dup";
91 }
92 FILE* input = fdopen(input_fd.release(), "r");
93 if (!input) {
94 return ErrnoError() << "Failed to fdopen";
95 }
96
David Brazdilbcce3512023-02-23 15:32:55 +000097 // Run forever, reverse one line at a time.
98 while (true) {
99 char* line = nullptr;
100 size_t size = 0;
101 if (getline(&line, &size, input) < 0) {
102 return ErrnoError() << "Failed to read";
103 }
104
105 std::string_view original = line;
106 if (!original.empty() && original.back() == '\n') {
107 original = original.substr(0, original.size() - 1);
108 }
109
110 std::string reversed(original.rbegin(), original.rend());
111 reversed += "\n";
112
113 if (write(connect_fd, reversed.data(), reversed.size()) < 0) {
114 return ErrnoError() << "Failed to write";
115 }
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000116 }
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000117}
118
119Result<void> start_echo_reverse_server() {
120 unique_fd server_fd{TEMP_FAILURE_RETRY(socket(AF_VSOCK, SOCK_STREAM | SOCK_CLOEXEC, 0))};
121 if (!server_fd.ok()) {
122 return ErrnoError() << "Failed to create vsock socket";
123 }
124 struct sockaddr_vm server_sa = (struct sockaddr_vm){
125 .svm_family = AF_VSOCK,
Alan Stokes10c47672022-12-13 17:17:08 +0000126 .svm_port = static_cast<uint32_t>(BnTestService::ECHO_REVERSE_PORT),
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000127 .svm_cid = VMADDR_CID_ANY,
128 };
129 int ret = TEMP_FAILURE_RETRY(bind(server_fd, (struct sockaddr*)&server_sa, sizeof(server_sa)));
130 if (ret < 0) {
131 return ErrnoError() << "Failed to bind vsock socket";
132 }
133 ret = TEMP_FAILURE_RETRY(listen(server_fd, /*backlog=*/1));
134 if (ret < 0) {
135 return ErrnoError() << "Failed to listen";
136 }
137
138 std::thread accept_thread{[listening_fd = std::move(server_fd)] {
139 auto result = run_echo_reverse_server(listening_fd);
140 if (!result.ok()) {
141 __android_log_write(ANDROID_LOG_ERROR, TAG, result.error().message().c_str());
142 // Make sure the VM exits so the test will fail solidly
143 exit(1);
144 }
145 }};
146 accept_thread.detach();
147
148 return {};
149}
150
Inseob Kim06a64d62021-09-07 21:21:45 +0900151Result<void> start_test_service() {
Alan Stokes63fa37b2023-02-22 14:56:57 +0000152 class VmCallbackImpl : public BnVmCallback {
153 private:
154 std::shared_ptr<IAppCallback> mAppCallback;
155
156 public:
157 explicit VmCallbackImpl(const std::shared_ptr<IAppCallback>& appCallback)
158 : mAppCallback(appCallback) {}
159
160 ScopedAStatus echoMessage(const std::string& message) override {
161 std::thread callback_thread{[=, appCallback = mAppCallback] {
162 appCallback->onEchoRequestReceived("Received: " + message);
163 }};
164 callback_thread.detach();
165 return ScopedAStatus::ok();
166 }
167 };
168
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000169 class TestService : public BnTestService {
Alan Stokes63fa37b2023-02-22 14:56:57 +0000170 public:
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000171 ScopedAStatus addInteger(int32_t a, int32_t b, int32_t* out) override {
Inseob Kim06a64d62021-09-07 21:21:45 +0900172 *out = a + b;
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000173 return ScopedAStatus::ok();
Inseob Kim06a64d62021-09-07 21:21:45 +0900174 }
Inseob Kim691df6a2022-01-20 12:54:30 +0900175
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000176 ScopedAStatus readProperty(const std::string& prop, std::string* out) override {
Inseob Kim691df6a2022-01-20 12:54:30 +0900177 *out = android::base::GetProperty(prop, "");
178 if (out->empty()) {
179 std::string msg = "cannot find property " + prop;
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000180 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
181 msg.c_str());
Inseob Kim691df6a2022-01-20 12:54:30 +0900182 }
183
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000184 return ScopedAStatus::ok();
Inseob Kim691df6a2022-01-20 12:54:30 +0900185 }
Andrew Scull2e6ab792022-01-30 16:04:08 +0000186
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000187 ScopedAStatus insecurelyExposeVmInstanceSecret(std::vector<uint8_t>* out) override {
Andrew Scull102067a2022-10-07 00:34:40 +0000188 const uint8_t identifier[] = {1, 2, 3, 4};
Andrew Scull655e98e2022-10-10 22:24:58 +0000189 out->resize(32);
Alan Stokes65bbb912022-11-23 09:39:34 +0000190 AVmPayload_getVmInstanceSecret(identifier, sizeof(identifier), out->data(),
191 out->size());
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000192 return ScopedAStatus::ok();
Andrew Scull2e6ab792022-01-30 16:04:08 +0000193 }
Andrew Scull1f6ca352022-02-20 22:51:12 +0000194
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000195 ScopedAStatus insecurelyExposeAttestationCdi(std::vector<uint8_t>* out) override {
Alan Stokes65bbb912022-11-23 09:39:34 +0000196 size_t cdi_size = AVmPayload_getDiceAttestationCdi(nullptr, 0);
Andrew Scull655e98e2022-10-10 22:24:58 +0000197 out->resize(cdi_size);
Alan Stokes65bbb912022-11-23 09:39:34 +0000198 AVmPayload_getDiceAttestationCdi(out->data(), out->size());
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000199 return ScopedAStatus::ok();
Andrew Scull1f6ca352022-02-20 22:51:12 +0000200 }
Andrew Scull61892082022-02-21 00:07:25 +0000201
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000202 ScopedAStatus getBcc(std::vector<uint8_t>* out) override {
Alan Stokes65bbb912022-11-23 09:39:34 +0000203 size_t bcc_size = AVmPayload_getDiceAttestationChain(nullptr, 0);
Andrew Scull655e98e2022-10-10 22:24:58 +0000204 out->resize(bcc_size);
Alan Stokes65bbb912022-11-23 09:39:34 +0000205 AVmPayload_getDiceAttestationChain(out->data(), out->size());
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000206 return ScopedAStatus::ok();
Andrew Scull61892082022-02-21 00:07:25 +0000207 }
Alice Wang6bbb6da2022-10-26 12:44:06 +0000208
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000209 ScopedAStatus getApkContentsPath(std::string* out) override {
Alice Wang6bbb6da2022-10-26 12:44:06 +0000210 const char* path_c = AVmPayload_getApkContentsPath();
211 if (path_c == nullptr) {
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000212 return ScopedAStatus::
Alice Wang6bbb6da2022-10-26 12:44:06 +0000213 fromServiceSpecificErrorWithMessage(0, "Failed to get APK contents path");
214 }
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000215 *out = path_c;
216 return ScopedAStatus::ok();
Alice Wang6bbb6da2022-10-26 12:44:06 +0000217 }
Alan Stokes78d24702022-11-21 15:28:31 +0000218
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000219 ScopedAStatus getEncryptedStoragePath(std::string* out) override {
Alan Stokes78d24702022-11-21 15:28:31 +0000220 const char* path_c = AVmPayload_getEncryptedStoragePath();
221 if (path_c == nullptr) {
222 out->clear();
223 } else {
224 *out = path_c;
225 }
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000226 return ScopedAStatus::ok();
227 }
228
Nikita Ioffe3452ee22022-12-15 00:31:56 +0000229 ScopedAStatus getEffectiveCapabilities(std::vector<std::string>* out) override {
230 if (out == nullptr) {
231 return ScopedAStatus::ok();
232 }
233 cap_t cap = cap_get_proc();
234 auto guard = make_scope_guard([&cap]() { cap_free(cap); });
235 for (cap_value_t cap_id = 0; cap_id < CAP_LAST_CAP + 1; cap_id++) {
236 cap_flag_value_t value;
237 if (cap_get_flag(cap, cap_id, CAP_EFFECTIVE, &value) != 0) {
238 return ScopedAStatus::
239 fromServiceSpecificErrorWithMessage(0, "cap_get_flag failed");
240 }
241 if (value == CAP_SET) {
242 // Ideally we would just send back the cap_ids, but I wasn't able to find java
243 // APIs for linux capabilities, hence we transform to the human readable name
244 // here.
245 char* name = cap_to_name(cap_id);
246 out->push_back(std::string(name) + "(" + std::to_string(cap_id) + ")");
247 }
248 }
249 return ScopedAStatus::ok();
250 }
251
Alan Stokes1294f942023-08-21 14:34:12 +0100252 ScopedAStatus getUid(int* out) override {
253 *out = getuid();
254 return ScopedAStatus::ok();
255 }
256
Alan Stokes63fa37b2023-02-22 14:56:57 +0000257 ScopedAStatus runEchoReverseServer() override {
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000258 auto result = start_echo_reverse_server();
259 if (result.ok()) {
260 return ScopedAStatus::ok();
261 } else {
262 std::string message = result.error().message();
263 return ScopedAStatus::fromServiceSpecificErrorWithMessage(-1, message.c_str());
264 }
Alan Stokes78d24702022-11-21 15:28:31 +0000265 }
Shikha Panwardc11b7e2022-12-15 12:24:11 +0000266
267 ScopedAStatus writeToFile(const std::string& content, const std::string& path) override {
268 if (!android::base::WriteStringToFile(content, path)) {
269 std::string msg = "Failed to write " + content + " to file " + path +
270 ". Errono: " + std::to_string(errno);
271 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
272 msg.c_str());
273 }
Shikha Panwardc11b7e2022-12-15 12:24:11 +0000274 return ScopedAStatus::ok();
275 }
276
277 ScopedAStatus readFromFile(const std::string& path, std::string* out) override {
278 if (!android::base::ReadFileToString(path, out)) {
279 std::string msg =
280 "Failed to read " + path + " to string. Errono: " + std::to_string(errno);
281 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
282 msg.c_str());
283 }
284 return ScopedAStatus::ok();
285 }
Shikha Panwardef7ef92023-01-06 08:35:48 +0000286
Nikita Ioffea7cb3672023-02-24 23:10:34 +0000287 ScopedAStatus getFilePermissions(const std::string& path, int32_t* out) override {
288 struct stat sb;
289 if (stat(path.c_str(), &sb) != -1) {
290 *out = sb.st_mode;
291 } else {
292 std::string msg = "stat " + path + " failed : " + std::strerror(errno);
293 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
294 msg.c_str());
295 }
296 return ScopedAStatus::ok();
297 }
298
Nikita Ioffe29e15c82023-02-25 02:31:51 +0000299 ScopedAStatus getMountFlags(const std::string& mount_point, int32_t* out) override {
300 Fstab fstab;
301 if (!ReadFstabFromFile("/proc/mounts", &fstab)) {
302 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
303 "Failed to read /proc/mounts");
304 }
305 FstabEntry* entry = GetEntryForMountPoint(&fstab, mount_point);
306 if (entry == nullptr) {
307 std::string msg = mount_point + " not found in /proc/mounts";
308 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
309 msg.c_str());
310 }
311 *out = entry->flags;
312 return ScopedAStatus::ok();
313 }
314
Nikita Ioffed5846dc2024-11-01 18:44:45 +0000315 ScopedAStatus getPageSize(int32_t* out) override {
316 *out = getpagesize();
317 return ScopedAStatus::ok();
318 }
319
Alan Stokes63fa37b2023-02-22 14:56:57 +0000320 ScopedAStatus requestCallback(const std::shared_ptr<IAppCallback>& appCallback) {
321 auto vmCallback = ndk::SharedRefBase::make<VmCallbackImpl>(appCallback);
322 std::thread callback_thread{[=] { appCallback->setVmCallback(vmCallback); }};
323 callback_thread.detach();
324 return ScopedAStatus::ok();
325 }
326
Jiyong Park92e34722023-06-27 00:43:39 +0900327 ScopedAStatus readLineFromConsole(std::string* out) {
328 FILE* f = fopen("/dev/console", "r");
329 if (f == nullptr) {
330 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
331 "failed to open /dev/console");
332 }
333 char* line = nullptr;
334 size_t len = 0;
335 ssize_t nread = getline(&line, &len, f);
336
337 if (nread == -1) {
338 free(line);
339 return ScopedAStatus::fromExceptionCodeWithMessage(EX_SERVICE_SPECIFIC,
340 "failed to read /dev/console");
341 }
342 out->append(line, nread);
343 free(line);
344 return ScopedAStatus::ok();
345 }
346
Shikha Panwar0c3a2fa2024-12-06 18:38:06 +0000347 ScopedAStatus insecurelyReadPayloadRpData(std::array<uint8_t, 32>* out) override {
348 int32_t ret = AVmPayload_readRollbackProtectedSecret(out->data(), 32);
349 if (ret != 32) {
350 return ScopedAStatus::fromServiceSpecificError(ret);
351 }
352 return ScopedAStatus::ok();
353 }
354
355 ScopedAStatus insecurelyWritePayloadRpData(
356 const std::array<uint8_t, 32>& inputData) override {
357 int32_t ret = AVmPayload_writeRollbackProtectedSecret(inputData.data(), 32);
358 if (ret != 32) {
359 return ScopedAStatus::fromServiceSpecificError(ret);
360 }
361 return ScopedAStatus::ok();
362 }
363
Shikha Panwardef7ef92023-01-06 08:35:48 +0000364 ScopedAStatus quit() override { exit(0); }
Inseob Kim06a64d62021-09-07 21:21:45 +0900365 };
366 auto testService = ndk::SharedRefBase::make<TestService>();
367
Alan Stokes65bbb912022-11-23 09:39:34 +0000368 auto callback = []([[maybe_unused]] void* param) { AVmPayload_notifyPayloadReady(); };
Devin Moorecaf7b952023-04-24 20:14:35 +0000369 AVmPayload_runVsockRpcServer(testService->asBinder().get(), testService->PORT, callback,
Alan Stokese0945ad2022-11-24 13:29:57 +0000370 nullptr);
Inseob Kim06a64d62021-09-07 21:21:45 +0900371
372 return {};
373}
374
Alan Stokes4b31a482024-02-01 17:56:06 +0000375Result<void> verify_build_manifest() {
Inseob Kimdb319702022-01-20 13:12:43 +0900376 const char* path = "/mnt/extra-apk/0/assets/build_manifest.pb";
377
378 std::string str;
379 if (!android::base::ReadFileToString(path, &str)) {
380 return ErrnoError() << "failed to read build_manifest.pb";
381 }
382
383 if (!android::security::fsverity::FSVerityDigests().ParseFromString(str)) {
384 return Error() << "invalid build_manifest.pb";
385 }
386
387 return {};
388}
389
Alan Stokes4b31a482024-02-01 17:56:06 +0000390Result<void> verify_vm_share() {
391 const char* path = "/mnt/extra-apk/0/assets/vmshareapp.txt";
392
393 std::string str;
394 if (!android::base::ReadFileToString(path, &str)) {
395 return ErrnoError() << "failed to read vmshareapp.txt";
396 }
397
398 return {};
399}
400
Andrew Scull66616612021-06-17 16:41:03 +0000401} // Anonymous namespace
402
Alan Stokes52d3c722022-10-04 17:27:13 +0100403extern "C" int AVmPayload_main() {
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000404 __android_log_write(ANDROID_LOG_INFO, TAG, "Hello Microdroid");
Inseob Kim06a64d62021-09-07 21:21:45 +0900405
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000406 // Make sure we can call into other shared libraries.
Jiyong Parkfe5b28e2021-06-24 00:19:02 +0900407 testlib_sub();
Jiyong Park23934392021-06-16 01:59:10 +0900408
Alan Stokes4b31a482024-02-01 17:56:06 +0000409 // Report various things that aren't always fatal - these are checked in MicrodroidTests as
410 // appropriate.
411 report_test("extra_apk_build_manifest", verify_build_manifest());
412 report_test("extra_apk_vm_share", verify_vm_share());
Inseob Kimdb319702022-01-20 13:12:43 +0900413
Jiyong Park23934392021-06-16 01:59:10 +0900414 __system_property_set("debug.microdroid.app.run", "true");
Andrew Sculledbe75e2021-07-06 10:44:31 +0000415
Inseob Kim06a64d62021-09-07 21:21:45 +0900416 if (auto res = start_test_service(); res.ok()) {
417 return 0;
418 } else {
Alan Stokesd1a30dd2022-11-30 09:39:54 +0000419 __android_log_write(ANDROID_LOG_ERROR, TAG, res.error().message().c_str());
Inseob Kim06a64d62021-09-07 21:21:45 +0900420 return 1;
421 }
Jiyong Parka7266ac2021-05-17 21:57:24 +0900422}