summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2020-02-03 14:17:06 -0800
committerEmilian Peev <epeev@google.com>2020-02-04 10:12:15 -0800
commitf0aa3f01074af96678646028f17d289f901be4b5 (patch)
treef94acf8068342019ec69414c943d11226471394f /camera
parent64479a583b8d9e950d8920f94d18a793a76c1283 (diff)
downloadplatform_hardware_interfaces-f0aa3f01074af96678646028f17d289f901be4b5.tar.gz
platform_hardware_interfaces-f0aa3f01074af96678646028f17d289f901be4b5.tar.bz2
platform_hardware_interfaces-f0aa3f01074af96678646028f17d289f901be4b5.zip
Camera: Add ICameraDevice@3.6 subinterface
Camera device subinterface version 3.6 must inherit from the previous version 3.5 and continue to support device sessions with versions 3.2, 3.5 as well as the most recent 3.6. Bug: 148235329 Test: VtsHalCameraProviderV2_4TargetTest --gtest_filter=PerInstance/CameraHidlTest.switchToOffline/0_external_0 Change-Id: Ia46cbd771eb1d2624cc0cee808a3eb074fc775b6
Diffstat (limited to 'camera')
-rw-r--r--camera/device/3.6/Android.bp1
-rw-r--r--camera/device/3.6/ICameraDevice.hal31
-rw-r--r--camera/device/3.6/default/include/ext_device_v3_6_impl/ExternalCameraDevice_3_6.h51
-rw-r--r--camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp9
4 files changed, 88 insertions, 4 deletions
diff --git a/camera/device/3.6/Android.bp b/camera/device/3.6/Android.bp
index 8766b931f4..19adb3472d 100644
--- a/camera/device/3.6/Android.bp
+++ b/camera/device/3.6/Android.bp
@@ -8,6 +8,7 @@ hidl_interface {
},
srcs: [
"types.hal",
+ "ICameraDevice.hal",
"ICameraDeviceSession.hal",
"ICameraOfflineSession.hal",
],
diff --git a/camera/device/3.6/ICameraDevice.hal b/camera/device/3.6/ICameraDevice.hal
new file mode 100644
index 0000000000..e859606376
--- /dev/null
+++ b/camera/device/3.6/ICameraDevice.hal
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+package android.hardware.camera.device@3.6;
+
+import @3.5::ICameraDevice;
+
+/**
+ * Camera device interface
+ *
+ * Supports the android.hardware.Camera API, and the android.hardware.camera2
+ * API at LIMITED or better hardware level.
+ *
+ * ICameraDevice.open() must return @3.2::ICameraDeviceSession or
+ * @3.5::ICameraDeviceSession or @3.6::ICameraDeviceSession.
+ */
+interface ICameraDevice extends @3.5::ICameraDevice {
+};
diff --git a/camera/device/3.6/default/include/ext_device_v3_6_impl/ExternalCameraDevice_3_6.h b/camera/device/3.6/default/include/ext_device_v3_6_impl/ExternalCameraDevice_3_6.h
index 046c9d817e..020bec4a92 100644
--- a/camera/device/3.6/default/include/ext_device_v3_6_impl/ExternalCameraDevice_3_6.h
+++ b/camera/device/3.6/default/include/ext_device_v3_6_impl/ExternalCameraDevice_3_6.h
@@ -17,6 +17,8 @@
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE_H
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_6_EXTCAMERADEVICE_H
+#include <android/hardware/camera/device/3.6/ICameraDevice.h>
+
#include "ExternalCameraDeviceSession.h"
#include <../../../../3.5/default/include/ext_device_v3_5_impl/ExternalCameraDevice_3_5.h>
@@ -28,7 +30,7 @@ namespace V3_6 {
namespace implementation {
using namespace ::android::hardware::camera::device;
-using ::android::hardware::camera::device::V3_5::ICameraDevice;
+using ::android::hardware::camera::device::V3_6::ICameraDevice;
using ::android::hardware::camera::common::V1_0::CameraResourceCost;
using ::android::hardware::camera::common::V1_0::TorchMode;
using ::android::hardware::camera::common::V1_0::Status;
@@ -53,6 +55,10 @@ struct ExternalCameraDevice : public V3_5::implementation::ExternalCameraDevice
ExternalCameraDevice(const std::string& cameraId, const ExternalCameraConfig& cfg);
virtual ~ExternalCameraDevice();
+ virtual sp<V3_2::ICameraDevice> getInterface() override {
+ return new TrampolineDeviceInterface_3_6(this);
+ }
+
protected:
virtual sp<V3_4::implementation::ExternalCameraDeviceSession> createSession(
const sp<V3_2::ICameraDeviceCallback>&,
@@ -65,6 +71,49 @@ protected:
virtual status_t initAvailableCapabilities(
::android::hardware::camera::common::V1_0::helper::CameraMetadata*) override;
+
+private:
+ struct TrampolineDeviceInterface_3_6 : public ICameraDevice {
+ TrampolineDeviceInterface_3_6(sp<ExternalCameraDevice> parent) :
+ mParent(parent) {}
+
+ virtual Return<void> getResourceCost(V3_2::ICameraDevice::getResourceCost_cb _hidl_cb)
+ override {
+ return mParent->getResourceCost(_hidl_cb);
+ }
+
+ virtual Return<void> getCameraCharacteristics(
+ V3_2::ICameraDevice::getCameraCharacteristics_cb _hidl_cb) override {
+ return mParent->getCameraCharacteristics(_hidl_cb);
+ }
+
+ virtual Return<Status> setTorchMode(TorchMode mode) override {
+ return mParent->setTorchMode(mode);
+ }
+
+ virtual Return<void> open(const sp<V3_2::ICameraDeviceCallback>& callback,
+ V3_2::ICameraDevice::open_cb _hidl_cb) override {
+ return mParent->open(callback, _hidl_cb);
+ }
+
+ virtual Return<void> dumpState(const hidl_handle& fd) override {
+ return mParent->dumpState(fd);
+ }
+
+ virtual Return<void> getPhysicalCameraCharacteristics(const hidl_string& physicalCameraId,
+ V3_5::ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb) override {
+ return mParent->getPhysicalCameraCharacteristics(physicalCameraId, _hidl_cb);
+ }
+
+ virtual Return<void> isStreamCombinationSupported(
+ const V3_4::StreamConfiguration& streams,
+ V3_5::ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) override {
+ return mParent->isStreamCombinationSupported(streams, _hidl_cb);
+ }
+
+ private:
+ sp<ExternalCameraDevice> mParent;
+ };
};
} // namespace implementation
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index e3e53dd4b0..5c73aa2ab7 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -37,6 +37,7 @@
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
#include <android/hardware/camera/device/3.5/ICameraDeviceSession.h>
+#include <android/hardware/camera/device/3.6/ICameraDevice.h>
#include <android/hardware/camera/device/3.6/ICameraDeviceSession.h>
#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
@@ -5719,17 +5720,19 @@ void CameraHidlTest::configureOfflineStillStream(const std::string &name,
ASSERT_NE(nullptr, useHalBufManager);
std::vector<AvailableStream> outputStreams;
- ::android::sp<ICameraDevice> cameraDevice;
+ ::android::sp<device::V3_6::ICameraDevice> cameraDevice;
ALOGI("configureStreams: Testing camera device %s", name.c_str());
Return<void> ret;
ret = provider->getCameraDeviceInterface_V3_x(
name,
- [&](auto status, const auto& device) {
+ [&cameraDevice](auto status, const auto& device) {
ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
(int)status);
ASSERT_EQ(Status::OK, status);
ASSERT_NE(device, nullptr);
- cameraDevice = device;
+ auto castResult = device::V3_6::ICameraDevice::castFrom(device);
+ ASSERT_TRUE(castResult.isOk());
+ cameraDevice = castResult;
});
ASSERT_TRUE(ret.isOk());