diff --git a/camera/device/3.2/default/Android.bp b/camera/device/3.2/default/Android.bp index 9820220088..40d42535fc 100644 --- a/camera/device/3.2/default/Android.bp +++ b/camera/device/3.2/default/Android.bp @@ -20,3 +20,27 @@ cc_library_shared { ], export_include_dirs: ["."] } + +cc_library_shared { + name: "android.hardware.camera.device@3.2-impl-binderized", + srcs: ["CameraDevice.cpp", + "CameraDeviceSession.cpp", + "convert.cpp"], + cppflags: ["-DBINDERIZED"], + shared_libs: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "libcutils", + "android.hardware.camera.device@3.2", + "android.hardware.camera.provider@2.4", + "liblog", + "libhardware", + "libcamera_metadata" + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper" + ], + export_include_dirs: ["."] +} diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp index f28c9cd757..ee40ce506d 100644 --- a/camera/provider/2.4/default/Android.bp +++ b/camera/provider/2.4/default/Android.bp @@ -21,3 +21,29 @@ cc_library_shared { "android.hardware.camera.common@1.0-helper" ] } + +cc_binary { + name: "android.hardware.camera.provider@2.4-service", + relative_install_path: "hw", + srcs: ["service.cpp", "CameraProvider.cpp"], + compile_multilib: "32", + init_rc: ["android.hardware.camera.provider@2.4-service.rc"], + shared_libs: [ + "libhidlbase", + "libhidltransport", + "liblog", + "libhwbinder", + "libutils", + "libhardware", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.common@1.0", + "libcutils", + "android.hardware.camera.device@3.2-impl-binderized", + "libcamera_metadata" + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper" + ] +} diff --git a/camera/provider/2.4/default/CameraProvider.cpp b/camera/provider/2.4/default/CameraProvider.cpp index 9617d8d0d4..1a34aa63e9 100644 --- a/camera/provider/2.4/default/CameraProvider.cpp +++ b/camera/provider/2.4/default/CameraProvider.cpp @@ -17,8 +17,6 @@ #define LOG_TAG "CamProvider@2.4-impl" #include -#include - #include "CameraProvider.h" #include "CameraDevice.h" #include diff --git a/camera/provider/2.4/default/CameraProvider.h b/camera/provider/2.4/default/CameraProvider.h index 8497ff3dd8..2a43e2f3a3 100644 --- a/camera/provider/2.4/default/CameraProvider.h +++ b/camera/provider/2.4/default/CameraProvider.h @@ -17,6 +17,7 @@ #ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H #define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H +#include #include "hardware/camera_common.h" #include "utils/Mutex.h" #include "utils/SortedVector.h" diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc new file mode 100644 index 0000000000..31f08104ff --- /dev/null +++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc @@ -0,0 +1,6 @@ +service camera-provider-2-4 /system/bin/hw/android.hardware.camera.provider@2.4-service + class hal + user cameraserver + group audio camera input drmrpc + ioprio rt 4 + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks \ No newline at end of file diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp new file mode 100644 index 0000000000..2723dee9c1 --- /dev/null +++ b/camera/provider/2.4/default/service.cpp @@ -0,0 +1,51 @@ +/* + * Copyright 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "android.hardware.camera.provider@2.4-service" + +#include +#include + +#include +#include + +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::sp; +using android::hardware::camera::provider::V2_4::ICameraProvider; +using android::hardware::camera::provider::V2_4::implementation::HIDL_FETCH_ICameraProvider; + +int main() +{ + const char instance[] = "legacy/0"; + + ALOGI("Camera provider Service is starting."); + + configureRpcThreadpool(1, true /* callerWillJoin */); + // TODO (b/34510650): check the passthrough/binderized dev key + sp service = HIDL_FETCH_ICameraProvider(instance); + if (service == nullptr) { + ALOGI("Camera provider getService returned NULL"); + return -1; + } + + LOG_FATAL_IF(service->isRemote(), "Camera provider service is REMOTE!"); + + service->registerAsService(instance); + joinRpcThreadpool(); + + return 0; +} \ No newline at end of file