mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Camera: Bump device version to 3.4
Camera devices supporting version 3.4 will be able to receive session parameters during the stream configuration phase. Bug: 64450664 Test: Camera CTS run commandAndExit vts --skip-all-system-status-check --skip-preconditions --primary-abi-only --module VtsHalCameraProviderV2_4Target -l INFO Change-Id: Ifd83bfe0e512fe75b63602b4aba98f4cc1cdeb53
This commit is contained in:
@@ -803,6 +803,89 @@ android_dataspace CameraDeviceSession::mapToLegacyDataspace(
|
||||
return dataSpace;
|
||||
}
|
||||
|
||||
bool CameraDeviceSession::preProcessConfigurationLocked(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
camera3_stream_configuration_t *stream_list /*out*/,
|
||||
hidl_vec<camera3_stream_t*> *streams /*out*/) {
|
||||
|
||||
if ((stream_list == nullptr) || (streams == nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream_list->operation_mode = (uint32_t) requestedConfiguration.operationMode;
|
||||
stream_list->num_streams = requestedConfiguration.streams.size();
|
||||
streams->resize(stream_list->num_streams);
|
||||
stream_list->streams = streams->data();
|
||||
|
||||
for (uint32_t i = 0; i < stream_list->num_streams; i++) {
|
||||
int id = requestedConfiguration.streams[i].id;
|
||||
|
||||
if (mStreamMap.count(id) == 0) {
|
||||
Camera3Stream stream;
|
||||
convertFromHidl(requestedConfiguration.streams[i], &stream);
|
||||
mStreamMap[id] = stream;
|
||||
mStreamMap[id].data_space = mapToLegacyDataspace(
|
||||
mStreamMap[id].data_space);
|
||||
mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
|
||||
} else {
|
||||
// width/height/format must not change, but usage/rotation might need to change
|
||||
if (mStreamMap[id].stream_type !=
|
||||
(int) requestedConfiguration.streams[i].streamType ||
|
||||
mStreamMap[id].width != requestedConfiguration.streams[i].width ||
|
||||
mStreamMap[id].height != requestedConfiguration.streams[i].height ||
|
||||
mStreamMap[id].format != (int) requestedConfiguration.streams[i].format ||
|
||||
mStreamMap[id].data_space !=
|
||||
mapToLegacyDataspace( static_cast<android_dataspace_t> (
|
||||
requestedConfiguration.streams[i].dataSpace))) {
|
||||
ALOGE("%s: stream %d configuration changed!", __FUNCTION__, id);
|
||||
return false;
|
||||
}
|
||||
mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].rotation;
|
||||
mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].usage;
|
||||
}
|
||||
(*streams)[i] = &mStreamMap[id];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CameraDeviceSession::postProcessConfigurationLocked(
|
||||
const StreamConfiguration& requestedConfiguration) {
|
||||
// delete unused streams, note we do this after adding new streams to ensure new stream
|
||||
// will not have the same address as deleted stream, and HAL has a chance to reference
|
||||
// the to be deleted stream in configure_streams call
|
||||
for(auto it = mStreamMap.begin(); it != mStreamMap.end();) {
|
||||
int id = it->first;
|
||||
bool found = false;
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (id == stream.id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// Unmap all buffers of deleted stream
|
||||
// in case the configuration call succeeds and HAL
|
||||
// is able to release the corresponding resources too.
|
||||
cleanupBuffersLocked(id);
|
||||
it = mStreamMap.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// Track video streams
|
||||
mVideoStreamIds.clear();
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (stream.streamType == StreamType::OUTPUT &&
|
||||
stream.usage &
|
||||
graphics::common::V1_0::BufferUsage::VIDEO_ENCODER) {
|
||||
mVideoStreamIds.push_back(stream.id);
|
||||
}
|
||||
}
|
||||
mResultBatcher.setBatchedStreams(mVideoStreamIds);
|
||||
}
|
||||
|
||||
Return<void> CameraDeviceSession::configureStreams(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_cb _hidl_cb) {
|
||||
@@ -840,42 +923,11 @@ Return<void> CameraDeviceSession::configureStreams(
|
||||
return Void();
|
||||
}
|
||||
|
||||
camera3_stream_configuration_t stream_list;
|
||||
camera3_stream_configuration_t stream_list{};
|
||||
hidl_vec<camera3_stream_t*> streams;
|
||||
|
||||
stream_list.operation_mode = (uint32_t) requestedConfiguration.operationMode;
|
||||
stream_list.num_streams = requestedConfiguration.streams.size();
|
||||
streams.resize(stream_list.num_streams);
|
||||
stream_list.streams = streams.data();
|
||||
|
||||
for (uint32_t i = 0; i < stream_list.num_streams; i++) {
|
||||
int id = requestedConfiguration.streams[i].id;
|
||||
|
||||
if (mStreamMap.count(id) == 0) {
|
||||
Camera3Stream stream;
|
||||
convertFromHidl(requestedConfiguration.streams[i], &stream);
|
||||
mStreamMap[id] = stream;
|
||||
mStreamMap[id].data_space = mapToLegacyDataspace(
|
||||
mStreamMap[id].data_space);
|
||||
mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
|
||||
} else {
|
||||
// width/height/format must not change, but usage/rotation might need to change
|
||||
if (mStreamMap[id].stream_type !=
|
||||
(int) requestedConfiguration.streams[i].streamType ||
|
||||
mStreamMap[id].width != requestedConfiguration.streams[i].width ||
|
||||
mStreamMap[id].height != requestedConfiguration.streams[i].height ||
|
||||
mStreamMap[id].format != (int) requestedConfiguration.streams[i].format ||
|
||||
mStreamMap[id].data_space !=
|
||||
mapToLegacyDataspace( static_cast<android_dataspace_t> (
|
||||
requestedConfiguration.streams[i].dataSpace))) {
|
||||
ALOGE("%s: stream %d configuration changed!", __FUNCTION__, id);
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].rotation;
|
||||
mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].usage;
|
||||
}
|
||||
streams[i] = &mStreamMap[id];
|
||||
if (!preProcessConfigurationLocked(requestedConfiguration, &stream_list, &streams)) {
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
ATRACE_BEGIN("camera3->configure_streams");
|
||||
@@ -885,39 +937,7 @@ Return<void> CameraDeviceSession::configureStreams(
|
||||
// In case Hal returns error most likely it was not able to release
|
||||
// the corresponding resources of the deleted streams.
|
||||
if (ret == OK) {
|
||||
// delete unused streams, note we do this after adding new streams to ensure new stream
|
||||
// will not have the same address as deleted stream, and HAL has a chance to reference
|
||||
// the to be deleted stream in configure_streams call
|
||||
for(auto it = mStreamMap.begin(); it != mStreamMap.end();) {
|
||||
int id = it->first;
|
||||
bool found = false;
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (id == stream.id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// Unmap all buffers of deleted stream
|
||||
// in case the configuration call succeeds and HAL
|
||||
// is able to release the corresponding resources too.
|
||||
cleanupBuffersLocked(id);
|
||||
it = mStreamMap.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// Track video streams
|
||||
mVideoStreamIds.clear();
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (stream.streamType == StreamType::OUTPUT &&
|
||||
stream.usage &
|
||||
graphics::common::V1_0::BufferUsage::VIDEO_ENCODER) {
|
||||
mVideoStreamIds.push_back(stream.id);
|
||||
}
|
||||
}
|
||||
mResultBatcher.setBatchedStreams(mVideoStreamIds);
|
||||
postProcessConfigurationLocked(requestedConfiguration);
|
||||
}
|
||||
|
||||
if (ret == -EINVAL) {
|
||||
|
||||
@@ -112,6 +112,12 @@ protected:
|
||||
Return<Status> flush();
|
||||
Return<void> close();
|
||||
|
||||
//Helper methods
|
||||
bool preProcessConfigurationLocked(const StreamConfiguration& requestedConfiguration,
|
||||
camera3_stream_configuration_t *stream_list /*out*/,
|
||||
hidl_vec<camera3_stream_t*> *streams /*out*/);
|
||||
void postProcessConfigurationLocked(const StreamConfiguration& requestedConfiguration);
|
||||
|
||||
protected:
|
||||
|
||||
// protecting mClosed/mDisconnected/mInitFail
|
||||
|
||||
@@ -77,42 +77,11 @@ Return<void> CameraDeviceSession::configureStreams_3_3(
|
||||
return Void();
|
||||
}
|
||||
|
||||
camera3_stream_configuration_t stream_list;
|
||||
camera3_stream_configuration_t stream_list{};
|
||||
hidl_vec<camera3_stream_t*> streams;
|
||||
|
||||
stream_list.operation_mode = (uint32_t) requestedConfiguration.operationMode;
|
||||
stream_list.num_streams = requestedConfiguration.streams.size();
|
||||
streams.resize(stream_list.num_streams);
|
||||
stream_list.streams = streams.data();
|
||||
|
||||
for (uint32_t i = 0; i < stream_list.num_streams; i++) {
|
||||
int id = requestedConfiguration.streams[i].id;
|
||||
|
||||
if (mStreamMap.count(id) == 0) {
|
||||
Camera3Stream stream;
|
||||
V3_2::implementation::convertFromHidl(requestedConfiguration.streams[i], &stream);
|
||||
mStreamMap[id] = stream;
|
||||
mStreamMap[id].data_space = mapToLegacyDataspace(
|
||||
mStreamMap[id].data_space);
|
||||
mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
|
||||
} else {
|
||||
// width/height/format must not change, but usage/rotation might need to change
|
||||
if (mStreamMap[id].stream_type !=
|
||||
(int) requestedConfiguration.streams[i].streamType ||
|
||||
mStreamMap[id].width != requestedConfiguration.streams[i].width ||
|
||||
mStreamMap[id].height != requestedConfiguration.streams[i].height ||
|
||||
mStreamMap[id].format != (int) requestedConfiguration.streams[i].format ||
|
||||
mStreamMap[id].data_space !=
|
||||
mapToLegacyDataspace( static_cast<android_dataspace_t> (
|
||||
requestedConfiguration.streams[i].dataSpace))) {
|
||||
ALOGE("%s: stream %d configuration changed!", __FUNCTION__, id);
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].rotation;
|
||||
mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].usage;
|
||||
}
|
||||
streams[i] = &mStreamMap[id];
|
||||
if (!preProcessConfigurationLocked(requestedConfiguration, &stream_list, &streams)) {
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
ATRACE_BEGIN("camera3->configure_streams");
|
||||
@@ -122,39 +91,7 @@ Return<void> CameraDeviceSession::configureStreams_3_3(
|
||||
// In case Hal returns error most likely it was not able to release
|
||||
// the corresponding resources of the deleted streams.
|
||||
if (ret == OK) {
|
||||
// delete unused streams, note we do this after adding new streams to ensure new stream
|
||||
// will not have the same address as deleted stream, and HAL has a chance to reference
|
||||
// the to be deleted stream in configure_streams call
|
||||
for(auto it = mStreamMap.begin(); it != mStreamMap.end();) {
|
||||
int id = it->first;
|
||||
bool found = false;
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (id == stream.id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// Unmap all buffers of deleted stream
|
||||
// in case the configuration call succeeds and HAL
|
||||
// is able to release the corresponding resources too.
|
||||
cleanupBuffersLocked(id);
|
||||
it = mStreamMap.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
// Track video streams
|
||||
mVideoStreamIds.clear();
|
||||
for (const auto& stream : requestedConfiguration.streams) {
|
||||
if (stream.streamType == V3_2::StreamType::OUTPUT &&
|
||||
stream.usage &
|
||||
graphics::common::V1_0::BufferUsage::VIDEO_ENCODER) {
|
||||
mVideoStreamIds.push_back(stream.id);
|
||||
}
|
||||
}
|
||||
mResultBatcher.setBatchedStreams(mVideoStreamIds);
|
||||
postProcessConfigurationLocked(requestedConfiguration);
|
||||
}
|
||||
|
||||
if (ret == -EINVAL) {
|
||||
|
||||
25
camera/device/3.4/Android.bp
Normal file
25
camera/device/3.4/Android.bp
Normal file
@@ -0,0 +1,25 @@
|
||||
// This file is autogenerated by hidl-gen -Landroidbp.
|
||||
|
||||
hidl_interface {
|
||||
name: "android.hardware.camera.device@3.4",
|
||||
root: "android.hardware",
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"ICameraDeviceSession.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hardware.camera.common@1.0",
|
||||
"android.hardware.camera.device@3.2",
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.graphics.common@1.0",
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
types: [
|
||||
"StreamConfiguration",
|
||||
],
|
||||
gen_java: false,
|
||||
}
|
||||
|
||||
74
camera/device/3.4/ICameraDeviceSession.hal
Normal file
74
camera/device/3.4/ICameraDeviceSession.hal
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
package android.hardware.camera.device@3.4;
|
||||
|
||||
import android.hardware.camera.common@1.0::Status;
|
||||
import @3.3::ICameraDeviceSession;
|
||||
import @3.3::HalStreamConfiguration;
|
||||
|
||||
/**
|
||||
* Camera device active session interface.
|
||||
*
|
||||
* Obtained via ICameraDevice::open(), this interface contains the methods to
|
||||
* configure and request captures from an active camera device.
|
||||
*/
|
||||
interface ICameraDeviceSession extends @3.3::ICameraDeviceSession {
|
||||
|
||||
/**
|
||||
* configureStreams_3_4:
|
||||
*
|
||||
* Identical to @3.3::ICameraDeviceSession.configureStreams, except that:
|
||||
*
|
||||
* - The requested configuration includes session parameters.
|
||||
*
|
||||
* @return Status Status code for the operation, one of:
|
||||
* OK:
|
||||
* On successful stream configuration.
|
||||
* INTERNAL_ERROR:
|
||||
* If there has been a fatal error and the device is no longer
|
||||
* operational. Only close() can be called successfully by the
|
||||
* framework after this error is returned.
|
||||
* ILLEGAL_ARGUMENT:
|
||||
* If the requested stream configuration is invalid. Some examples
|
||||
* of invalid stream configurations include:
|
||||
* - Including more than 1 INPUT stream
|
||||
* - Not including any OUTPUT streams
|
||||
* - Including streams with unsupported formats, or an unsupported
|
||||
* size for that format.
|
||||
* - Including too many output streams of a certain format.
|
||||
* - Unsupported rotation configuration
|
||||
* - Stream sizes/formats don't satisfy the
|
||||
* camera3_stream_configuration_t->operation_mode requirements
|
||||
* for non-NORMAL mode, or the requested operation_mode is not
|
||||
* supported by the HAL.
|
||||
* - Unsupported usage flag
|
||||
* The camera service cannot filter out all possible illegal stream
|
||||
* configurations, since some devices may support more simultaneous
|
||||
* streams or larger stream resolutions than the minimum required
|
||||
* for a given camera device hardware level. The HAL must return an
|
||||
* ILLEGAL_ARGUMENT for any unsupported stream set, and then be
|
||||
* ready to accept a future valid stream configuration in a later
|
||||
* configureStreams call.
|
||||
* @return halConfiguration The stream parameters desired by the HAL for
|
||||
* each stream, including maximum buffers, the usage flags, and the
|
||||
* override format.
|
||||
*/
|
||||
configureStreams_3_4(@3.4::StreamConfiguration requestedConfiguration)
|
||||
generates (Status status,
|
||||
@3.3::HalStreamConfiguration halConfiguration);
|
||||
|
||||
};
|
||||
56
camera/device/3.4/default/Android.bp
Normal file
56
camera/device/3.4/default/Android.bp
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright (C) 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.
|
||||
//
|
||||
|
||||
cc_library_headers {
|
||||
name: "camera.device@3.4-impl_headers",
|
||||
vendor: true,
|
||||
export_include_dirs: ["include/device_v3_4_impl"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "camera.device@3.4-impl",
|
||||
defaults: ["hidl_defaults"],
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"CameraDevice.cpp",
|
||||
"CameraDeviceSession.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"camera.device@3.2-impl",
|
||||
"camera.device@3.3-impl",
|
||||
"android.hardware.camera.device@3.2",
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.camera.device@3.4",
|
||||
"android.hardware.camera.provider@2.4",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
"liblog",
|
||||
"libhardware",
|
||||
"libcamera_metadata",
|
||||
"libfmq",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.camera.common@1.0-helper",
|
||||
],
|
||||
local_include_dirs: ["include/device_v3_4_impl"],
|
||||
export_shared_lib_headers: [
|
||||
"libfmq",
|
||||
],
|
||||
}
|
||||
67
camera/device/3.4/default/CameraDevice.cpp
Normal file
67
camera/device/3.4/default/CameraDevice.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 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 "CamDev@3.4-impl"
|
||||
#include <log/log.h>
|
||||
|
||||
#include <utils/Vector.h>
|
||||
#include <utils/Trace.h>
|
||||
#include "CameraDevice_3_4.h"
|
||||
#include <include/convert.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_4 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::camera::common::V1_0::Status;
|
||||
using namespace ::android::hardware::camera::device;
|
||||
|
||||
CameraDevice::CameraDevice(
|
||||
sp<CameraModule> module, const std::string& cameraId,
|
||||
const SortedVector<std::pair<std::string, std::string>>& cameraDeviceNames) :
|
||||
V3_2::implementation::CameraDevice(module, cameraId, cameraDeviceNames) {
|
||||
}
|
||||
|
||||
CameraDevice::~CameraDevice() {
|
||||
}
|
||||
|
||||
sp<V3_2::implementation::CameraDeviceSession> CameraDevice::createSession(camera3_device_t* device,
|
||||
const camera_metadata_t* deviceInfo,
|
||||
const sp<V3_2::ICameraDeviceCallback>& callback) {
|
||||
sp<CameraDeviceSession> session = new CameraDeviceSession(device, deviceInfo, callback);
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
// End of methods from ::android::hardware::camera::device::V3_2::ICameraDevice.
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_4
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
122
camera/device/3.4/default/CameraDeviceSession.cpp
Normal file
122
camera/device/3.4/default/CameraDeviceSession.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 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 "CamDevSession@3.4-impl"
|
||||
#include <android/log.h>
|
||||
|
||||
#include <set>
|
||||
#include <utils/Trace.h>
|
||||
#include <hardware/gralloc.h>
|
||||
#include <hardware/gralloc1.h>
|
||||
#include "CameraDeviceSession.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_4 {
|
||||
namespace implementation {
|
||||
|
||||
CameraDeviceSession::CameraDeviceSession(
|
||||
camera3_device_t* device,
|
||||
const camera_metadata_t* deviceInfo,
|
||||
const sp<V3_2::ICameraDeviceCallback>& callback) :
|
||||
V3_3::implementation::CameraDeviceSession(device, deviceInfo, callback) {
|
||||
}
|
||||
|
||||
CameraDeviceSession::~CameraDeviceSession() {
|
||||
}
|
||||
|
||||
Return<void> CameraDeviceSession::configureStreams_3_4(
|
||||
const V3_4::StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_3_3_cb _hidl_cb) {
|
||||
Status status = initStatus();
|
||||
HalStreamConfiguration outStreams;
|
||||
|
||||
// hold the inflight lock for entire configureStreams scope since there must not be any
|
||||
// inflight request/results during stream configuration.
|
||||
Mutex::Autolock _l(mInflightLock);
|
||||
if (!mInflightBuffers.empty()) {
|
||||
ALOGE("%s: trying to configureStreams while there are still %zu inflight buffers!",
|
||||
__FUNCTION__, mInflightBuffers.size());
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (!mInflightAETriggerOverrides.empty()) {
|
||||
ALOGE("%s: trying to configureStreams while there are still %zu inflight"
|
||||
" trigger overrides!", __FUNCTION__,
|
||||
mInflightAETriggerOverrides.size());
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (!mInflightRawBoostPresent.empty()) {
|
||||
ALOGE("%s: trying to configureStreams while there are still %zu inflight"
|
||||
" boost overrides!", __FUNCTION__,
|
||||
mInflightRawBoostPresent.size());
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
if (status != Status::OK) {
|
||||
_hidl_cb(status, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
const camera_metadata_t *paramBuffer = nullptr;
|
||||
if (0 < requestedConfiguration.sessionParams.size()) {
|
||||
::android::hardware::camera::common::V1_0::helper::CameraMetadata sessionParams;
|
||||
V3_2::implementation::convertFromHidl(requestedConfiguration.sessionParams, ¶mBuffer);
|
||||
}
|
||||
|
||||
camera3_stream_configuration_t stream_list{};
|
||||
hidl_vec<camera3_stream_t*> streams;
|
||||
stream_list.session_parameters = paramBuffer;
|
||||
if (!preProcessConfigurationLocked(requestedConfiguration.v3_2, &stream_list, &streams)) {
|
||||
_hidl_cb(Status::INTERNAL_ERROR, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
ATRACE_BEGIN("camera3->configure_streams");
|
||||
status_t ret = mDevice->ops->configure_streams(mDevice, &stream_list);
|
||||
ATRACE_END();
|
||||
|
||||
// In case Hal returns error most likely it was not able to release
|
||||
// the corresponding resources of the deleted streams.
|
||||
if (ret == OK) {
|
||||
postProcessConfigurationLocked(requestedConfiguration.v3_2);
|
||||
}
|
||||
|
||||
if (ret == -EINVAL) {
|
||||
status = Status::ILLEGAL_ARGUMENT;
|
||||
} else if (ret != OK) {
|
||||
status = Status::INTERNAL_ERROR;
|
||||
} else {
|
||||
V3_3::implementation::convertToHidl(stream_list, &outStreams);
|
||||
mFirstRequest = true;
|
||||
}
|
||||
|
||||
_hidl_cb(status, outStreams);
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_4
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
6
camera/device/3.4/default/OWNERS
Normal file
6
camera/device/3.4/default/OWNERS
Normal file
@@ -0,0 +1,6 @@
|
||||
cychen@google.com
|
||||
epeev@google.com
|
||||
etalvala@google.com
|
||||
shuzhenwang@google.com
|
||||
yinchiayeh@google.com
|
||||
zhijunhe@google.com
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE3SESSION_H
|
||||
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE3SESSION_H
|
||||
|
||||
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
|
||||
#include <android/hardware/camera/device/3.3/ICameraDeviceSession.h>
|
||||
#include <android/hardware/camera/device/3.4/ICameraDeviceSession.h>
|
||||
#include <../../3.3/default/CameraDeviceSession.h>
|
||||
#include <../../3.3/default/include/convert.h>
|
||||
#include <fmq/MessageQueue.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include "CameraMetadata.h"
|
||||
#include "HandleImporter.h"
|
||||
#include "hardware/camera3.h"
|
||||
#include "hardware/camera_common.h"
|
||||
#include "utils/Mutex.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_4 {
|
||||
namespace implementation {
|
||||
|
||||
using namespace ::android::hardware::camera::device;
|
||||
using ::android::hardware::camera::device::V3_2::CaptureRequest;
|
||||
using ::android::hardware::camera::device::V3_2::StreamConfiguration;
|
||||
using ::android::hardware::camera::device::V3_3::HalStreamConfiguration;
|
||||
using ::android::hardware::camera::device::V3_4::ICameraDeviceSession;
|
||||
using ::android::hardware::camera::common::V1_0::Status;
|
||||
using ::android::hardware::camera::common::V1_0::helper::HandleImporter;
|
||||
using ::android::hardware::kSynchronizedReadWrite;
|
||||
using ::android::hardware::MessageQueue;
|
||||
using ::android::hardware::MQDescriptorSync;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using ::android::Mutex;
|
||||
|
||||
struct CameraDeviceSession : public V3_3::implementation::CameraDeviceSession {
|
||||
|
||||
CameraDeviceSession(camera3_device_t*,
|
||||
const camera_metadata_t* deviceInfo,
|
||||
const sp<V3_2::ICameraDeviceCallback>&);
|
||||
virtual ~CameraDeviceSession();
|
||||
|
||||
virtual sp<V3_2::ICameraDeviceSession> getInterface() override {
|
||||
return new TrampolineSessionInterface_3_4(this);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Methods from v3.3 and earlier will trampoline to inherited implementation
|
||||
|
||||
// New methods for v3.4
|
||||
|
||||
Return<void> configureStreams_3_4(
|
||||
const V3_4::StreamConfiguration& requestedConfiguration,
|
||||
ICameraDeviceSession::configureStreams_3_3_cb _hidl_cb);
|
||||
private:
|
||||
|
||||
struct TrampolineSessionInterface_3_4 : public ICameraDeviceSession {
|
||||
TrampolineSessionInterface_3_4(sp<CameraDeviceSession> parent) :
|
||||
mParent(parent) {}
|
||||
|
||||
virtual Return<void> constructDefaultRequestSettings(
|
||||
V3_2::RequestTemplate type,
|
||||
V3_3::ICameraDeviceSession::constructDefaultRequestSettings_cb _hidl_cb) override {
|
||||
return mParent->constructDefaultRequestSettings(type, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
V3_3::ICameraDeviceSession::configureStreams_cb _hidl_cb) override {
|
||||
return mParent->configureStreams(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> processCaptureRequest(const hidl_vec<V3_2::CaptureRequest>& requests,
|
||||
const hidl_vec<V3_2::BufferCache>& cachesToRemove,
|
||||
V3_3::ICameraDeviceSession::processCaptureRequest_cb _hidl_cb) override {
|
||||
return mParent->processCaptureRequest(requests, cachesToRemove, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> getCaptureRequestMetadataQueue(
|
||||
V3_3::ICameraDeviceSession::getCaptureRequestMetadataQueue_cb _hidl_cb) override {
|
||||
return mParent->getCaptureRequestMetadataQueue(_hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> getCaptureResultMetadataQueue(
|
||||
V3_3::ICameraDeviceSession::getCaptureResultMetadataQueue_cb _hidl_cb) override {
|
||||
return mParent->getCaptureResultMetadataQueue(_hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<Status> flush() override {
|
||||
return mParent->flush();
|
||||
}
|
||||
|
||||
virtual Return<void> close() override {
|
||||
return mParent->close();
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_3(
|
||||
const StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_3_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_3(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
virtual Return<void> configureStreams_3_4(
|
||||
const V3_4::StreamConfiguration& requestedConfiguration,
|
||||
configureStreams_3_3_cb _hidl_cb) override {
|
||||
return mParent->configureStreams_3_4(requestedConfiguration, _hidl_cb);
|
||||
}
|
||||
|
||||
private:
|
||||
sp<CameraDeviceSession> mParent;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_4
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE3SESSION_H
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE_H
|
||||
#define ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE_H
|
||||
|
||||
#include "utils/Mutex.h"
|
||||
#include "CameraModule.h"
|
||||
#include "CameraMetadata.h"
|
||||
#include "CameraDeviceSession.h"
|
||||
#include <../../3.2/default/CameraDevice_3_2.h>
|
||||
|
||||
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace camera {
|
||||
namespace device {
|
||||
namespace V3_4 {
|
||||
namespace implementation {
|
||||
|
||||
using namespace ::android::hardware::camera::device;
|
||||
using ::android::hardware::camera::common::V1_0::helper::CameraModule;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
|
||||
/*
|
||||
* The camera device HAL implementation is opened lazily (via the open call)
|
||||
*/
|
||||
struct CameraDevice : public V3_2::implementation::CameraDevice {
|
||||
|
||||
// Called by provider HAL.
|
||||
// Provider HAL must ensure the uniqueness of CameraDevice object per cameraId, or there could
|
||||
// be multiple CameraDevice trying to access the same physical camera. Also, provider will have
|
||||
// to keep track of all CameraDevice objects in order to notify CameraDevice when the underlying
|
||||
// camera is detached.
|
||||
// Delegates nearly all work to CameraDevice_3_2
|
||||
CameraDevice(sp<CameraModule> module,
|
||||
const std::string& cameraId,
|
||||
const SortedVector<std::pair<std::string, std::string>>& cameraDeviceNames);
|
||||
~CameraDevice();
|
||||
|
||||
protected:
|
||||
virtual sp<V3_2::implementation::CameraDeviceSession> createSession(camera3_device_t*,
|
||||
const camera_metadata_t* deviceInfo,
|
||||
const sp<V3_2::ICameraDeviceCallback>&) override;
|
||||
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V3_4
|
||||
} // namespace device
|
||||
} // namespace camera
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_CAMERA_DEVICE_V3_4_CAMERADEVICE_H
|
||||
46
camera/device/3.4/types.hal
Normal file
46
camera/device/3.4/types.hal
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
package android.hardware.camera.device@3.4;
|
||||
|
||||
import @3.2::StreamConfiguration;
|
||||
import @3.2::types;
|
||||
|
||||
/**
|
||||
* StreamConfiguration:
|
||||
*
|
||||
* Identical to @3.2::StreamConfiguration, except that it contains session parameters.
|
||||
*/
|
||||
struct StreamConfiguration {
|
||||
/**
|
||||
* The definition of StreamConfiguration from the prior version.
|
||||
*/
|
||||
@3.2::StreamConfiguration v3_2;
|
||||
|
||||
/**
|
||||
* Session wide camera parameters.
|
||||
*
|
||||
* The session parameters contain the initial values of any request keys that were
|
||||
* made available via ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. The Hal implementation
|
||||
* can advertise any settings that can potentially introduce unexpected delays when
|
||||
* their value changes during active process requests. Typical examples are
|
||||
* parameters that trigger time-consuming HW re-configurations or internal camera
|
||||
* pipeline updates. The field is optional, clients can choose to ignore it and avoid
|
||||
* including any initial settings. If parameters are present, then hal must examine
|
||||
* their values and configure the internal camera pipeline accordingly.
|
||||
*/
|
||||
CameraMetadata sessionParams;
|
||||
};
|
||||
@@ -87,3 +87,11 @@ A minor revision to the ICameraDevice.hal@3.2.
|
||||
supported in the legacy camera HAL.
|
||||
|
||||
Added in Android 8.1.
|
||||
|
||||
### ICameraDevice.hal@3.4:
|
||||
|
||||
A minor revision to the ICameraDevice.hal@3.3.
|
||||
|
||||
- Adds support for session parameters during stream configuration.
|
||||
|
||||
Added in Android 9
|
||||
|
||||
@@ -12,9 +12,11 @@ cc_library_shared {
|
||||
"android.hardware.camera.device@1.0",
|
||||
"android.hardware.camera.device@3.2",
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.camera.device@3.4",
|
||||
"camera.device@1.0-impl",
|
||||
"camera.device@3.2-impl",
|
||||
"camera.device@3.3-impl",
|
||||
"camera.device@3.4-impl",
|
||||
"android.hardware.camera.provider@2.4",
|
||||
"android.hardware.camera.common@1.0",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
@@ -22,11 +24,14 @@ cc_library_shared {
|
||||
"android.hidl.memory@1.0",
|
||||
"liblog",
|
||||
"libhardware",
|
||||
"libcamera_metadata"
|
||||
"libcamera_metadata",
|
||||
],
|
||||
header_libs: [
|
||||
"camera.device@3.4-impl_headers",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.camera.common@1.0-helper"
|
||||
]
|
||||
"android.hardware.camera.common@1.0-helper",
|
||||
],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
@@ -46,6 +51,7 @@ cc_binary {
|
||||
"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.provider@2.4",
|
||||
"android.hardware.camera.common@1.0",
|
||||
],
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CameraProvider.h"
|
||||
#include "CameraDevice_1_0.h"
|
||||
#include "CameraDevice_3_3.h"
|
||||
#include "CameraDevice_3_4.h"
|
||||
#include <cutils/properties.h>
|
||||
#include <string.h>
|
||||
#include <utils/Trace.h>
|
||||
@@ -39,6 +40,7 @@ const char *kLegacyProviderName = "legacy/0";
|
||||
const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/legacy/(.+)");
|
||||
const char *kHAL3_2 = "3.2";
|
||||
const char *kHAL3_3 = "3.3";
|
||||
const char *kHAL3_4 = "3.4";
|
||||
const char *kHAL1_0 = "1.0";
|
||||
const int kMaxCameraDeviceNameLen = 128;
|
||||
const int kMaxCameraIdLen = 16;
|
||||
@@ -159,12 +161,16 @@ std::string CameraProvider::getHidlDeviceName(
|
||||
if (deviceVersion != CAMERA_DEVICE_API_VERSION_1_0 &&
|
||||
deviceVersion != CAMERA_DEVICE_API_VERSION_3_2 &&
|
||||
deviceVersion != CAMERA_DEVICE_API_VERSION_3_3 &&
|
||||
deviceVersion != CAMERA_DEVICE_API_VERSION_3_4 ) {
|
||||
deviceVersion != CAMERA_DEVICE_API_VERSION_3_4 &&
|
||||
deviceVersion != CAMERA_DEVICE_API_VERSION_3_5) {
|
||||
return hidl_string("");
|
||||
}
|
||||
bool isV1 = deviceVersion == CAMERA_DEVICE_API_VERSION_1_0;
|
||||
int versionMajor = isV1 ? 1 : 3;
|
||||
int versionMinor = isV1 ? 0 : mPreferredHal3MinorVersion;
|
||||
if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
|
||||
versionMinor = 4;
|
||||
}
|
||||
char deviceName[kMaxCameraDeviceNameLen];
|
||||
snprintf(deviceName, sizeof(deviceName), "device@%d.%d/legacy/%s",
|
||||
versionMajor, versionMinor, cameraId.c_str());
|
||||
@@ -220,7 +226,8 @@ bool CameraProvider::initialize() {
|
||||
break;
|
||||
default:
|
||||
ALOGW("Unknown minor camera device HAL version %d in property "
|
||||
"'camera.wrapper.hal3TrebleMinorVersion', defaulting to 3", mPreferredHal3MinorVersion);
|
||||
"'camera.wrapper.hal3TrebleMinorVersion', defaulting to 3",
|
||||
mPreferredHal3MinorVersion);
|
||||
mPreferredHal3MinorVersion = 3;
|
||||
}
|
||||
|
||||
@@ -292,6 +299,7 @@ int CameraProvider::checkCameraVersion(int id, camera_info info) {
|
||||
case CAMERA_DEVICE_API_VERSION_3_2:
|
||||
case CAMERA_DEVICE_API_VERSION_3_3:
|
||||
case CAMERA_DEVICE_API_VERSION_3_4:
|
||||
case CAMERA_DEVICE_API_VERSION_3_5:
|
||||
// in support
|
||||
break;
|
||||
case CAMERA_DEVICE_API_VERSION_2_0:
|
||||
@@ -480,10 +488,27 @@ Return<void> CameraProvider::getCameraDeviceInterface_V3_x(
|
||||
return Void();
|
||||
}
|
||||
|
||||
sp<android::hardware::camera::device::V3_2::ICameraDevice> device;
|
||||
if (deviceVersion == kHAL3_4) {
|
||||
ALOGV("Constructing v3.4 camera device");
|
||||
sp<android::hardware::camera::device::V3_2::implementation::CameraDevice> deviceImpl =
|
||||
new android::hardware::camera::device::V3_4::implementation::CameraDevice(
|
||||
mModule, cameraId, mCameraDeviceNames);
|
||||
if (deviceImpl == nullptr || deviceImpl->isInitFailed()) {
|
||||
ALOGE("%s: camera device %s init failed!", __FUNCTION__, cameraId.c_str());
|
||||
device = nullptr;
|
||||
_hidl_cb(Status::INTERNAL_ERROR, nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
device = deviceImpl;
|
||||
_hidl_cb (Status::OK, device);
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Since some Treble HAL revisions can map to the same legacy HAL version(s), we default
|
||||
// to the newest possible Treble HAL revision, but allow for override if needed via
|
||||
// system property.
|
||||
sp<android::hardware::camera::device::V3_2::ICameraDevice> device;
|
||||
switch (mPreferredHal3MinorVersion) {
|
||||
case 2: { // Map legacy camera device v3 HAL to Treble camera device HAL v3.2
|
||||
ALOGV("Constructing v3.2 camera device");
|
||||
|
||||
@@ -35,6 +35,7 @@ cc_test {
|
||||
"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.provider@2.4",
|
||||
"android.hardware.graphics.common@1.0",
|
||||
"android.hardware.graphics.mapper@2.0",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user