blob: f07682e9648695ee7e700a302d7ffe91b31d0389 [file] [log] [blame]
Jason Chiu5d247d12023-11-27 16:42:44 +08001/*
2 * Copyright (C) 2020 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 */
16
17#define LOG_TAG "android.hardware.boot@1.2-service"
18
19#include <android/hardware/boot/1.2/IBootControl.h>
20#include <hidl/HidlTransportSupport.h>
21#include <hidl/Status.h>
22#include <log/log.h>
23
24#include "BootControl.h"
25
26using ::android::status_t;
27
28using ::android::hardware::boot::V1_2::IBootControl;
29
30using ::android::hardware::boot::V1_2::implementation::BootControl;
31// using ::android::hardware::boot::implementation::BootControl;
32
33int main(int /* argc */, char * /* argv */[]) {
34 // This function must be called before you join to ensure the proper
35 // number of threads are created. The threadpool will never exceed
36 // size one because of this call.
37 ::android::hardware::configureRpcThreadpool(1 /*threads*/, true /*willJoin*/);
38
39 ::android::sp bootctrl = new BootControl();
40 const status_t status = bootctrl->registerAsService();
41 if (status != ::android::OK) {
42 return 1; // or handle error
43 }
44
45 // Adds this thread to the threadpool, resulting in one total
46 // thread in the threadpool. We could also do other things, but
47 // would have to specify 'false' to willJoin in configureRpcThreadpool.
48 ::android::hardware::joinRpcThreadpool();
49 return 1; // joinRpcThreadpool should never return
50}