diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp index f8f058e26b..5fb1fd852d 100644 --- a/camera/provider/2.4/vts/functional/Android.bp +++ b/camera/provider/2.4/vts/functional/Android.bp @@ -40,6 +40,7 @@ cc_test { "android.hardware.camera.device@3.5", "android.hardware.camera.metadata@3.4", "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.5", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.common@1.0", "android.hardware.graphics.mapper@2.0", diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 211240a06b..5965cc1bd4 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ using namespace ::android::hardware::camera::device; using ::android::hardware::Return; using ::android::hardware::Void; +using ::android::hardware::hidl_bitfield; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; @@ -543,6 +545,9 @@ public: uint32_t id; ASSERT_TRUE(parseProviderName(service_name, &mProviderType, &id)); + + castProvider(mProvider, &mProvider2_5); + notifyDeviceState(provider::V2_5::DeviceState::NORMAL); } virtual void TearDown() override {} @@ -680,6 +685,8 @@ public: CameraHidlTest *mParent; // Parent object }; + void notifyDeviceState(::android::hardware::camera::provider::V2_5::DeviceState newState); + void openCameraDevice(const std::string &name, sp provider, sp<::android::hardware::camera::device::V1_0::ICameraDevice> *device /*out*/); void setupPreviewWindow( @@ -709,6 +716,8 @@ public: sp *session /*out*/, camera_metadata_t **staticMeta /*out*/, ::android::sp *device = nullptr/*out*/); + void castProvider(const sp &provider, + sp *provider2_5 /*out*/); void castSession(const sp &session, int32_t deviceVersion, sp *session3_3 /*out*/, sp *session3_4 /*out*/, @@ -898,6 +907,8 @@ protected: // Camera provider service sp mProvider; + sp<::android::hardware::camera::provider::V2_5::ICameraProvider> mProvider2_5; + // Camera provider type. std::string mProviderType; }; @@ -4681,6 +4692,13 @@ TEST_F(CameraHidlTest, flushEmpty) { } } +// Test camera provider@2.5 notify method +TEST_F(CameraHidlTest, providerDeviceStateNotification) { + + notifyDeviceState(provider::V2_5::DeviceState::BACK_COVERED); + notifyDeviceState(provider::V2_5::DeviceState::NORMAL); +} + // Retrieve all valid output stream resolutions from the camera // static characteristics. Status CameraHidlTest::getAvailableOutputStreams(camera_metadata_t *staticMeta, @@ -5362,6 +5380,16 @@ void CameraHidlTest::castDevice(const sp &device, } } +//Cast camera provider to corresponding version if available +void CameraHidlTest::castProvider(const sp &provider, + sp *provider2_5 /*out*/) { + ASSERT_NE(nullptr, provider2_5); + auto castResult = provider::V2_5::ICameraProvider::castFrom(provider); + if (castResult.isOk()) { + *provider2_5 = castResult; + } +} + //Cast camera device session to corresponding version void CameraHidlTest::castSession(const sp &session, int32_t deviceVersion, sp *session3_3 /*out*/, @@ -5774,6 +5802,13 @@ void CameraHidlTest::openEmptyDeviceSession(const std::string &name, spnotifyDeviceStateChange( + static_cast>(newState)); +} + // Open a particular camera device. void CameraHidlTest::openCameraDevice(const std::string &name, sp provider, diff --git a/camera/provider/2.5/default/Android.bp b/camera/provider/2.5/default/Android.bp new file mode 100644 index 0000000000..cd1caebe37 --- /dev/null +++ b/camera/provider/2.5/default/Android.bp @@ -0,0 +1,187 @@ +cc_library_shared { + name: "android.hardware.camera.provider@2.5-legacy", + proprietary: true, + srcs: ["LegacyCameraProviderImpl_2_5.cpp"], + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.4-legacy", + "android.hardware.camera.provider@2.5", + "android.hardware.graphics.mapper@2.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "camera.device@1.0-impl", + "camera.device@3.2-impl", + "camera.device@3.3-impl", + "camera.device@3.4-impl", + "camera.device@3.5-impl", + "libcamera_metadata", + "libcutils", + "libhardware", + "libhidlbase", + "libhidltransport", + "liblog", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-impl_headers", + "camera.device@3.5-impl_headers", + ], + export_include_dirs: ["."], +} + +cc_library_shared { + name: "android.hardware.camera.provider@2.5-external", + proprietary: true, + srcs: ["ExternalCameraProviderImpl_2_5.cpp"], + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.4-external", + "android.hardware.camera.provider@2.5", + "android.hardware.graphics.mapper@2.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "camera.device@3.3-impl", + "camera.device@3.4-external-impl", + "camera.device@3.4-impl", + "camera.device@3.5-external-impl", + "camera.device@3.5-impl", + "libcamera_metadata", + "libcutils", + "libhardware", + "libhidlbase", + "libhidltransport", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-external-impl_headers", + "camera.device@3.5-external-impl_headers" + ], + export_include_dirs: ["."], +} + +cc_defaults { + name: "camera_service_2_5_defaults", + defaults: ["hidl_defaults"], + proprietary: true, + relative_install_path: "hw", + srcs: ["service.cpp"], + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.4-legacy", + "android.hardware.camera.provider@2.5", + "android.hardware.camera.provider@2.5-legacy", + "android.hardware.graphics.mapper@2.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "libbinder", + "libcamera_metadata", + "libhardware", + "libhidlbase", + "libhidltransport", + "liblog", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-impl_headers", + "camera.device@3.5-impl_headers" + ], +} + +cc_binary { + name: "android.hardware.camera.provider@2.5-service", + defaults: ["camera_service_2_5_defaults"], + compile_multilib: "32", + init_rc: ["android.hardware.camera.provider@2.5-service.rc"], +} + +cc_binary { + name: "android.hardware.camera.provider@2.5-service_64", + defaults: ["camera_service_2_5_defaults"], + compile_multilib: "64", + init_rc: ["android.hardware.camera.provider@2.5-service_64.rc"], +} + +cc_binary { + name: "android.hardware.camera.provider@2.5-service-lazy", + overrides: ["android.hardware.camera.provider@2.5-service"], + defaults: ["camera_service_2_5_defaults"], + compile_multilib: "32", + init_rc: ["android.hardware.camera.provider@2.5-service-lazy.rc"], + cflags: ["-DLAZY_SERVICE"], +} + +cc_binary { + name: "android.hardware.camera.provider@2.5-service-lazy_64", + overrides: ["android.hardware.camera.provider@2.5-service_64"], + defaults: ["camera_service_2_5_defaults"], + compile_multilib: "64", + init_rc: ["android.hardware.camera.provider@2.5-service-lazy_64.rc"], + cflags: ["-DLAZY_SERVICE"], +} + +cc_binary { + name: "android.hardware.camera.provider@2.5-external-service", + defaults: ["hidl_defaults"], + proprietary: true, + relative_install_path: "hw", + srcs: ["external-service.cpp"], + compile_multilib: "32", + init_rc: ["android.hardware.camera.provider@2.5-external-service.rc"], + shared_libs: [ + "android.hardware.camera.common@1.0", + "android.hardware.camera.device@1.0", + "android.hardware.camera.device@3.2", + "android.hardware.camera.device@3.3", + "android.hardware.camera.device@3.4", + "android.hardware.camera.device@3.5", + "android.hardware.camera.provider@2.4", + "android.hardware.camera.provider@2.4-external", + "android.hardware.camera.provider@2.5", + "android.hardware.camera.provider@2.5-external", + "android.hardware.graphics.mapper@2.0", + "libbinder", + "libhidlbase", + "libhidltransport", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + header_libs: [ + "camera.device@3.4-external-impl_headers", + "camera.device@3.4-impl_headers", + "camera.device@3.5-external-impl_headers", + "camera.device@3.5-impl_headers", + ], +} diff --git a/camera/provider/2.5/default/CameraProvider_2_5.h b/camera/provider/2.5/default/CameraProvider_2_5.h new file mode 100644 index 0000000000..d0f1ddaaf5 --- /dev/null +++ b/camera/provider/2.5/default/CameraProvider_2_5.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2019 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. + */ + +#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H +#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H + +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_5 { +namespace implementation { + +using ::android::hardware::camera::common::V1_0::Status; +using ::android::hardware::camera::provider::V2_5::ICameraProvider; +using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback; +using ::android::hardware::Return; +using ::android::hardware::hidl_string; +using ::android::sp; + +// Default recommended RPC thread count for camera provider implementations +const int HWBINDER_THREAD_COUNT = 6; + +template +struct CameraProvider : public ICameraProvider { + CameraProvider() : impl() {} + ~CameraProvider() {} + + // Caller must use this method to check if CameraProvider ctor failed + bool isInitFailed() { return impl.isInitFailed(); } + + // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow. + Return setCallback(const sp& callback) override { + return impl.setCallback(callback); + } + + Return getVendorTags(getVendorTags_cb _hidl_cb) override { + return impl.getVendorTags(_hidl_cb); + } + + Return getCameraIdList(getCameraIdList_cb _hidl_cb) override { + return impl.getCameraIdList(_hidl_cb); + } + + Return isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override { + return impl.isSetTorchModeSupported(_hidl_cb); + } + + Return getCameraDeviceInterface_V1_x( + const hidl_string& cameraDeviceName, + getCameraDeviceInterface_V1_x_cb _hidl_cb) override { + return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb); + } + + Return getCameraDeviceInterface_V3_x( + const hidl_string& cameraDeviceName, + getCameraDeviceInterface_V3_x_cb _hidl_cb) override { + return impl.getCameraDeviceInterface_V3_x(cameraDeviceName, _hidl_cb); + } + + // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow. + Return notifyDeviceStateChange(hardware::hidl_bitfield newState) override { + return impl.notifyDeviceStateChange(newState); + } + +private: + IMPL impl; +}; + +} // namespace implementation +} // namespace V2_5 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H diff --git a/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp new file mode 100644 index 0000000000..87851cd4b1 --- /dev/null +++ b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 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 "CamPrvdr@2.5-external" +//#define LOG_NDEBUG 0 +#include + +#include "ExternalCameraProviderImpl_2_5.h" + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_5 { +namespace implementation { + +ExternalCameraProviderImpl_2_5::ExternalCameraProviderImpl_2_5() : + ExternalCameraProviderImpl_2_4() { +} + +ExternalCameraProviderImpl_2_5::~ExternalCameraProviderImpl_2_5() { +} + +Return ExternalCameraProviderImpl_2_5::notifyDeviceStateChange( + hidl_bitfield /*newState*/) { + return Void(); +} + +} // namespace implementation +} // namespace V2_5 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h new file mode 100644 index 0000000000..eeaa7cca06 --- /dev/null +++ b/camera/provider/2.5/default/ExternalCameraProviderImpl_2_5.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2019 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. + */ + +#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H +#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H + +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_5 { +namespace implementation { + +using namespace ::android::hardware::camera::provider; + +using ::android::hardware::camera::common::V1_0::CameraDeviceStatus; +using ::android::hardware::camera::common::V1_0::Status; +using ::android::hardware::camera::common::V1_0::VendorTagSection; +using ::android::hardware::camera::external::common::ExternalCameraConfig; +using ::android::hardware::camera::provider::V2_5::ICameraProvider; +using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::hardware::hidl_bitfield; + +struct ExternalCameraProviderImpl_2_5 : + public V2_4::implementation::ExternalCameraProviderImpl_2_4 { + ExternalCameraProviderImpl_2_5(); + ~ExternalCameraProviderImpl_2_5(); + + // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow. + Return notifyDeviceStateChange(hidl_bitfield newState); +private: +}; + +} // namespace implementation +} // namespace V2_5 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H diff --git a/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp new file mode 100644 index 0000000000..5233397bb8 --- /dev/null +++ b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2019 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 "CamPrvdr@2.5-legacy" +//#define LOG_NDEBUG 0 +#include +#include + +#include "LegacyCameraProviderImpl_2_5.h" +#include "CameraProvider_2_5.h" + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_5 { +namespace implementation { + +template struct CameraProvider; + +LegacyCameraProviderImpl_2_5::LegacyCameraProviderImpl_2_5() : + LegacyCameraProviderImpl_2_4() { +} + +LegacyCameraProviderImpl_2_5::~LegacyCameraProviderImpl_2_5() {} + +Return LegacyCameraProviderImpl_2_5::notifyDeviceStateChange( + hidl_bitfield newState) { + ALOGD("%s: New device state: 0x%" PRIx64, __FUNCTION__, newState); + uint64_t state = static_cast(newState); + mModule->notifyDeviceStateChange(state); + return Void(); +} + +} // namespace implementation +} // namespace V2_5 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h new file mode 100644 index 0000000000..62dd97f590 --- /dev/null +++ b/camera/provider/2.5/default/LegacyCameraProviderImpl_2_5.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2019 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. + */ + +#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_LEGACYCAMERAPROVIDER_H +#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_LEGACYCAMERAPROVIDER_H + +#include + +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace V2_5 { +namespace implementation { + +using namespace ::android::hardware::camera::provider; + +using ::android::hardware::camera::common::V1_0::CameraDeviceStatus; +using ::android::hardware::camera::common::V1_0::Status; +using ::android::hardware::camera::common::V1_0::TorchModeStatus; +using ::android::hardware::camera::common::V1_0::VendorTag; +using ::android::hardware::camera::common::V1_0::VendorTagSection; +using ::android::hardware::camera::common::V1_0::helper::CameraModule; +using ::android::hardware::camera::common::V1_0::helper::VendorTagDescriptor; +using ::android::hardware::camera::provider::V2_5::DeviceState; +using ::android::hardware::hidl_bitfield; +using ::android::hardware::Return; + +struct LegacyCameraProviderImpl_2_5 : public V2_4::implementation::LegacyCameraProviderImpl_2_4 { + LegacyCameraProviderImpl_2_5(); + ~LegacyCameraProviderImpl_2_5(); + + // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow. + Return notifyDeviceStateChange(hidl_bitfield newState); +private: +}; + +} // namespace implementation +} // namespace V2_5 +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H diff --git a/camera/provider/2.5/default/OWNERS b/camera/provider/2.5/default/OWNERS new file mode 100644 index 0000000000..369b2048cb --- /dev/null +++ b/camera/provider/2.5/default/OWNERS @@ -0,0 +1,7 @@ +cychen@google.com +epeev@google.com +etalvala@google.com +jchowdhary@google.com +shuzhenwang@google.com +yinchiayeh@google.com +zhijunhe@google.com diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc new file mode 100644 index 0000000000..107097e661 --- /dev/null +++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-external-service.rc @@ -0,0 +1,9 @@ +service vendor.camera-provider-2-5-ext /vendor/bin/hw/android.hardware.camera.provider@2.5-external-service + interface android.hardware.camera.provider@2.5::ICameraProvider external/0 + interface android.hardware.camera.provider@2.4::ICameraProvider external/0 + class hal + user cameraserver + group audio camera input drmrpc usb + ioprio rt 4 + capabilities SYS_NICE + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc new file mode 100644 index 0000000000..b45158a082 --- /dev/null +++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy.rc @@ -0,0 +1,11 @@ +service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service-lazy + interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0 + interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0 + oneshot + disabled + class hal + user cameraserver + group audio camera input drmrpc + ioprio rt 4 + capabilities SYS_NICE + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc new file mode 100644 index 0000000000..aa070d9b3a --- /dev/null +++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service-lazy_64.rc @@ -0,0 +1,11 @@ +service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service-lazy_64 + interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0 + interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0 + oneshot + disabled + class hal + user cameraserver + group audio camera input drmrpc + ioprio rt 4 + capabilities SYS_NICE + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc new file mode 100644 index 0000000000..c065815fab --- /dev/null +++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service.rc @@ -0,0 +1,9 @@ +service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service + interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0 + interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0 + class hal + user cameraserver + group audio camera input drmrpc + ioprio rt 4 + capabilities SYS_NICE + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks diff --git a/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc new file mode 100644 index 0000000000..63dd11d349 --- /dev/null +++ b/camera/provider/2.5/default/android.hardware.camera.provider@2.5-service_64.rc @@ -0,0 +1,9 @@ +service vendor.camera-provider-2-5 /vendor/bin/hw/android.hardware.camera.provider@2.5-service_64 + interface android.hardware.camera.provider@2.5::ICameraProvider legacy/0 + interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0 + class hal + user cameraserver + group audio camera input drmrpc + ioprio rt 4 + capabilities SYS_NICE + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks diff --git a/camera/provider/2.5/default/external-service.cpp b/camera/provider/2.5/default/external-service.cpp new file mode 100644 index 0000000000..8788916cf3 --- /dev/null +++ b/camera/provider/2.5/default/external-service.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2019 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.5-external-service" + +#include +#include +#include + +#include "CameraProvider_2_5.h" +#include "ExternalCameraProviderImpl_2_5.h" + +using android::status_t; +using android::hardware::camera::provider::V2_5::ICameraProvider; + +int main() +{ + using namespace android::hardware::camera::provider::V2_5::implementation; + + ALOGI("CameraProvider@2.5 external webcam service is starting."); + + ::android::hardware::configureRpcThreadpool(/*threads*/ HWBINDER_THREAD_COUNT, /*willJoin*/ true); + + ::android::sp provider = new CameraProvider(); + + status_t status = provider->registerAsService("external/0"); + LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering provider service: %d", + status); + + ::android::hardware::joinRpcThreadpool(); + + return 0; +} diff --git a/camera/provider/2.5/default/service.cpp b/camera/provider/2.5/default/service.cpp new file mode 100644 index 0000000000..604215d71c --- /dev/null +++ b/camera/provider/2.5/default/service.cpp @@ -0,0 +1,63 @@ +/* + * Copyright 2019 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. + */ + +#ifdef LAZY_SERVICE +#define LOG_TAG "android.hardware.camera.provider@2.5-service-lazy" +#else +#define LOG_TAG "android.hardware.camera.provider@2.5-service" +#endif + +#include +#include +#include +#include + +#include "CameraProvider_2_5.h" +#include "LegacyCameraProviderImpl_2_5.h" + +using android::status_t; +using android::hardware::camera::provider::V2_5::ICameraProvider; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main() +{ + using namespace android::hardware::camera::provider::V2_5::implementation; + + ALOGI("CameraProvider@2.5 legacy service is starting."); + + ::android::hardware::configureRpcThreadpool(/*threads*/ HWBINDER_THREAD_COUNT, /*willJoin*/ true); + + ::android::sp provider = new CameraProvider(); + + status_t status; + if (kLazyService) { + auto serviceRegistrar = std::make_shared<::android::hardware::LazyServiceRegistrar>(); + status = serviceRegistrar->registerService(provider, "legacy/0"); + } else { + status = provider->registerAsService("legacy/0"); + } + LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering provider service: %d", + status); + + ::android::hardware::joinRpcThreadpool(); + + return 0; +}