blob: dad09a0e6fbe2d6fb6094eee2d8cb30e10788cc8 [file] [log] [blame]
Mårten Kongstad02751232018-04-27 13:16:32 +02001/*
2 * Copyright (C) 2018 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 ATRACE_TAG ATRACE_TAG_RESOURCES
Yurii Zubrytskyi280a4cf2022-02-15 09:03:50 -080018#define LOG_TAG "idmap2d"
19#include "android-base/logging.h"
Mårten Kongstad02751232018-04-27 13:16:32 +020020
21#include <binder/BinderService.h>
22#include <binder/IPCThreadState.h>
23#include <binder/ProcessState.h>
24
25#include <cstdlib> // EXIT_{FAILURE,SUCCESS}
Mårten Kongstad02751232018-04-27 13:16:32 +020026
Mårten Kongstad02751232018-04-27 13:16:32 +020027#include "Idmap2Service.h"
Ryan Mitchell52e1f7a2019-04-12 12:31:42 -070028#include "android-base/macros.h"
Mårten Kongstad02751232018-04-27 13:16:32 +020029
30using android::BinderService;
31using android::IPCThreadState;
32using android::ProcessState;
33using android::sp;
34using android::status_t;
35using android::os::Idmap2Service;
36
37int main(int argc ATTRIBUTE_UNUSED, char** argv ATTRIBUTE_UNUSED) {
Yurii Zubrytskyi280a4cf2022-02-15 09:03:50 -080038 LOG(INFO) << "Starting";
Mårten Kongstadb8779022018-11-29 09:53:17 +010039 IPCThreadState::disableBackgroundScheduling(true);
Mårten Kongstad02751232018-04-27 13:16:32 +020040 status_t ret = BinderService<Idmap2Service>::publish();
41 if (ret != android::OK) {
Yurii Zubrytskyi280a4cf2022-02-15 09:03:50 -080042 LOG(ERROR) << "Failed to start: " << ret;
Mårten Kongstad02751232018-04-27 13:16:32 +020043 return EXIT_FAILURE;
44 }
45 sp<ProcessState> ps(ProcessState::self());
46 ps->startThreadPool();
47 ps->giveThreadPoolName();
48 IPCThreadState::self()->joinThreadPool();
Yurii Zubrytskyi280a4cf2022-02-15 09:03:50 -080049 LOG(INFO) << "Exiting";
Mårten Kongstad02751232018-04-27 13:16:32 +020050 return EXIT_SUCCESS;
51}