blob: 2723dee9c19445c9de7e0ae783a2437d24fde2a1 [file] [log] [blame]
Yin-Chia Yeh10d68342017-01-10 14:21:06 -08001/*
2 * Copyright 2017 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.camera.provider@2.4-service"
18
19#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
20#include <CameraProvider.h>
21
22#include <hidl/HidlTransportSupport.h>
23#include <utils/StrongPointer.h>
24
25using android::hardware::configureRpcThreadpool;
26using android::hardware::joinRpcThreadpool;
27using android::sp;
28using android::hardware::camera::provider::V2_4::ICameraProvider;
29using android::hardware::camera::provider::V2_4::implementation::HIDL_FETCH_ICameraProvider;
30
31int main()
32{
33 const char instance[] = "legacy/0";
34
35 ALOGI("Camera provider Service is starting.");
36
37 configureRpcThreadpool(1, true /* callerWillJoin */);
38 // TODO (b/34510650): check the passthrough/binderized dev key
39 sp<ICameraProvider> service = HIDL_FETCH_ICameraProvider(instance);
40 if (service == nullptr) {
41 ALOGI("Camera provider getService returned NULL");
42 return -1;
43 }
44
45 LOG_FATAL_IF(service->isRemote(), "Camera provider service is REMOTE!");
46
47 service->registerAsService(instance);
48 joinRpcThreadpool();
49
50 return 0;
51}