Camera: Add default 2.5 provider for legacy and external webcam HALs

Add 2.5 implementations, which do not support passthrough mode and
therefore doesn't need the HIDL_Fetch methods or a specially-named
-impl library in the /hw directory.  Instead, the service directly
instantiates the necessary service.

Also add VTS tests for the new notification

Test: Verify device state changes are logged by HAL
Test: Camera starts as usual with both 2.4 and 2.5 providers on
      walleye.  Camera CTS completes.
Test: New VTS tests pass
Bug: 121379978
Change-Id: I0fc99379eb7e01c5b2efb20afb5753bb6ce8b627
This commit is contained in:
Eino-Ville Talvala
2019-01-18 17:33:14 -08:00
parent 2951804146
commit aa04b3ba10
16 changed files with 706 additions and 0 deletions

View File

@@ -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",

View File

@@ -35,6 +35,7 @@
#include <android/hardware/camera/device/3.4/ICameraDeviceCallback.h>
#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
@@ -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<ICameraProvider> provider,
sp<::android::hardware::camera::device::V1_0::ICameraDevice> *device /*out*/);
void setupPreviewWindow(
@@ -709,6 +716,8 @@ public:
sp<ICameraDeviceSession> *session /*out*/,
camera_metadata_t **staticMeta /*out*/,
::android::sp<ICameraDevice> *device = nullptr/*out*/);
void castProvider(const sp<provider::V2_4::ICameraProvider> &provider,
sp<provider::V2_5::ICameraProvider> *provider2_5 /*out*/);
void castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
@@ -898,6 +907,8 @@ protected:
// Camera provider service
sp<ICameraProvider> 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::V3_2::ICameraDevice> &device,
}
}
//Cast camera provider to corresponding version if available
void CameraHidlTest::castProvider(const sp<ICameraProvider> &provider,
sp<provider::V2_5::ICameraProvider> *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<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
@@ -5774,6 +5802,13 @@ void CameraHidlTest::openEmptyDeviceSession(const std::string &name, sp<ICameraP
ASSERT_TRUE(ret.isOk());
}
void CameraHidlTest::notifyDeviceState(provider::V2_5::DeviceState newState) {
if (mProvider2_5.get() == nullptr) return;
mProvider2_5->notifyDeviceStateChange(
static_cast<hidl_bitfield<provider::V2_5::DeviceState>>(newState));
}
// Open a particular camera device.
void CameraHidlTest::openCameraDevice(const std::string &name,
sp<ICameraProvider> provider,

View File

@@ -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",
],
}

View File

@@ -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 <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
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<typename IMPL>
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<Status> setCallback(const sp<ICameraProviderCallback>& callback) override {
return impl.setCallback(callback);
}
Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override {
return impl.getVendorTags(_hidl_cb);
}
Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override {
return impl.getCameraIdList(_hidl_cb);
}
Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override {
return impl.isSetTorchModeSupported(_hidl_cb);
}
Return<void> getCameraDeviceInterface_V1_x(
const hidl_string& cameraDeviceName,
getCameraDeviceInterface_V1_x_cb _hidl_cb) override {
return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb);
}
Return<void> 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<void> notifyDeviceStateChange(hardware::hidl_bitfield<DeviceState> 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

View File

@@ -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 <log/log.h>
#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<void> ExternalCameraProviderImpl_2_5::notifyDeviceStateChange(
hidl_bitfield<DeviceState> /*newState*/) {
return Void();
}
} // namespace implementation
} // namespace V2_5
} // namespace provider
} // namespace camera
} // namespace hardware
} // namespace android

View File

@@ -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 <ExternalCameraProviderImpl_2_4.h>
#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
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<void> notifyDeviceStateChange(hidl_bitfield<DeviceState> newState);
private:
};
} // namespace implementation
} // namespace V2_5
} // namespace provider
} // namespace camera
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_EXTCAMERAPROVIDER_H

View File

@@ -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 <android/log.h>
#include <inttypes.h>
#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_5() :
LegacyCameraProviderImpl_2_4() {
}
LegacyCameraProviderImpl_2_5::~LegacyCameraProviderImpl_2_5() {}
Return<void> LegacyCameraProviderImpl_2_5::notifyDeviceStateChange(
hidl_bitfield<DeviceState> newState) {
ALOGD("%s: New device state: 0x%" PRIx64, __FUNCTION__, newState);
uint64_t state = static_cast<uint64_t>(newState);
mModule->notifyDeviceStateChange(state);
return Void();
}
} // namespace implementation
} // namespace V2_5
} // namespace provider
} // namespace camera
} // namespace hardware
} // namespace android

View File

@@ -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 <LegacyCameraProviderImpl_2_4.h>
#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <hidl/Status.h>
#include <hidl/MQDescriptor.h>
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<void> notifyDeviceStateChange(hidl_bitfield<DeviceState> newState);
private:
};
} // namespace implementation
} // namespace V2_5
} // namespace provider
} // namespace camera
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
#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<ICameraProvider> provider = new CameraProvider<ExternalCameraProviderImpl_2_5>();
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;
}

View File

@@ -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 <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <binder/ProcessState.h>
#include <hidl/HidlLazyUtils.h>
#include <hidl/HidlTransportSupport.h>
#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<ICameraProvider> provider = new CameraProvider<LegacyCameraProviderImpl_2_5>();
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;
}