Camera: Add default implementation of camera.device@3.3
Inherit as much as possible from camera.device@3.2
- Refactor CameraDeviceSession@3.2 implementation to separate out the
HIDL session interface from the main implementation object. This
avoids multiple inheritance issues
- Create CameraDeviceSession@3.3 with support for the new
overrideDataspace field
- Add virtual factory method for CameraDevice to create the right version
of Session.
- Create CameraDevice@3.3, which overrides createSession to return a
CameraDeviceSession@3.3.
- Add system property to override selection of which minor HIDL
version is used for legal HAL version 3.x; set the default to the
newest available minor version.
Test: Camera CTS passes on device using @3.3.
Bug: 62358514
Change-Id: I497e4bc0de798b56ecdb2ea6467b79afccaf89f7
diff --git a/camera/device/3.2/default/CameraDevice.cpp b/camera/device/3.2/default/CameraDevice.cpp
index 637a1e6..295ee32 100644
--- a/camera/device/3.2/default/CameraDevice.cpp
+++ b/camera/device/3.2/default/CameraDevice.cpp
@@ -177,7 +177,7 @@
if (callback == nullptr) {
ALOGE("%s: cannot open camera %s. callback is null!",
__FUNCTION__, mCameraId.c_str());
- _hidl_cb(Status::ILLEGAL_ARGUMENT, session);
+ _hidl_cb(Status::ILLEGAL_ARGUMENT, nullptr);
return Void();
}
@@ -186,7 +186,7 @@
// this must be a disconnected camera
ALOGE("%s: cannot open camera %s. camera is disconnected!",
__FUNCTION__, mCameraId.c_str());
- _hidl_cb(Status::CAMERA_DISCONNECTED, session);
+ _hidl_cb(Status::CAMERA_DISCONNECTED, nullptr);
return Void();
} else {
mLock.lock();
@@ -239,7 +239,7 @@
return Void();
}
- session = new CameraDeviceSession(
+ session = createSession(
device, info.static_camera_characteristics, callback);
if (session == nullptr) {
ALOGE("%s: camera device session allocation failed", __FUNCTION__);
@@ -255,9 +255,19 @@
return Void();
}
mSession = session;
+
+ IF_ALOGV() {
+ session->getInterface()->interfaceChain([](
+ ::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) {
+ ALOGV("Session interface chain:");
+ for (auto iface : interfaceChain) {
+ ALOGV(" %s", iface.c_str());
+ }
+ });
+ }
mLock.unlock();
}
- _hidl_cb(status, session);
+ _hidl_cb(status, session->getInterface());
return Void();
}
@@ -286,6 +296,13 @@
session->dumpState(handle);
return Void();
}
+
+sp<CameraDeviceSession> CameraDevice::createSession(camera3_device_t* device,
+ const camera_metadata_t* deviceInfo,
+ const sp<ICameraDeviceCallback>& callback) {
+ return new CameraDeviceSession(device, deviceInfo, callback);
+}
+
// End of methods from ::android::hardware::camera::device::V3_2::ICameraDevice.
} // namespace implementation