Camera: Add support for multi-resolution input and output streams

- Multi-resolution output streams allow for variable output sizes for
logical multi-camera.
- Multi-resolution reprocessing allows for reprocessing of
variable size images.

Test: Camera CTS, VTS
Bug: 156254356
Change-Id: I4e8b14a4d6aabdb4b194483d93af53e033c08e28
This commit is contained in:
Shuzhen Wang 2020-12-04 12:57:09 -08:00
parent 33750d296b
commit 25d67108b7
11 changed files with 517 additions and 18 deletions

View file

@ -0,0 +1,22 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "android.hardware.camera.device@3.7",
root: "android.hardware",
srcs: [
"types.hal",
"ICameraDevice.hal",
"ICameraDeviceSession.hal",
],
interfaces: [
"android.hardware.camera.common@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.device@3.6",
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
gen_java: false,
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (C) 2021 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.7;
import android.hardware.camera.common@1.0::Status;
import @3.6::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,
* @3.5::ICameraDeviceSession, @3.6::ICameraDeviceSession, or
* @3.7::ICameraDeviceSession.
*/
interface ICameraDevice extends @3.6::ICameraDevice {
/**
* isStreamCombinationSupported_3_7:
*
* Identical to @3.5::ICameraDevice.isStreamCombinationSupported, except
* that it takes a @3.7::StreamConfiguration parameter, which could contain
* information about multi-resolution input and output streams.
*
*/
isStreamCombinationSupported_3_7(StreamConfiguration streams)
generates (Status status, bool queryStatus);
};

View file

@ -0,0 +1,124 @@
/*
* Copyright (C) 2021 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.7;
import android.hardware.camera.common@1.0::Status;
import @3.2::BufferCache;
import @3.5::StreamConfiguration;
import @3.6::ICameraDeviceSession;
import @3.6::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.6::ICameraDeviceSession {
/**
* configureStreams_3_7:
*
* Identical to @3.6::ICameraDeviceSession.configureStreams_3_6, except that:
*
* - The requestedConfiguration allows the camera framework to configure
* stream groups.
* - For requested configurations of streams within the same group, the
* corresponding halConfiguration must have the same usage flags and
* maxBuffers.
* - Within a CaptureRequest, the application is guaranteed not to request
* more than one streams within the same stream group. When one of the
* stream within a stream group is requested, the camera HAL can either
* produce output on that stream, or any other stream within the same
* stream group.
* - The requestedConfiguration allows the camera framework to indicate that
* input images of different sizes may be submitted within capture
* requests.
*
* @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
* StreamConfigurationMode requirements
* for non-NORMAL mode, or the requested operation_mode is not
* supported by the HAL.
* - Unsupported usage flag
* - Unsupported stream groupIds, or unsupported multi-resolution
* input stream.
* 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_7(StreamConfiguration requestedConfiguration)
generates (Status status, @3.6::HalStreamConfiguration halConfiguration);
/**
* processCaptureRequest_3_7:
*
* Identical to @3.4::ICameraDeviceSession.processCaptureRequest, except that:
*
* - The capture request can include width and height of the input buffer for
* a reprocessing request.
*
* @return status Status code for the operation, one of:
* OK:
* On a successful start to processing the capture request
* ILLEGAL_ARGUMENT:
* If the input is malformed (the settings are empty when not
* allowed, the physical camera settings are invalid, there are 0
* output buffers, etc) and capture processing
* cannot start. Failures during request processing must be
* handled by calling ICameraDeviceCallback::notify(). In case of
* this error, the framework retains responsibility for the
* stream buffers' fences and the buffer handles; the HAL must not
* close the fences or return these buffers with
* ICameraDeviceCallback::processCaptureResult().
* In case of multi-resolution input image, this error must be returned
* if the caller passes in a CaptureRequest with an invalid
* [inputWith, inputHeight].
* INTERNAL_ERROR:
* If the camera device has encountered a serious error. After this
* error is returned, only the close() method can be successfully
* called by the framework.
* @return numRequestProcessed Number of requests successfully processed by
* camera HAL. When status is OK, this must be equal to the size of
* requests. When the call fails, this number is the number of requests
* that HAL processed successfully before HAL runs into an error.
*
*/
processCaptureRequest_3_7(vec<CaptureRequest> requests, vec<BufferCache> cachesToRemove)
generates (Status status, uint32_t numRequestProcessed);
};

136
camera/device/3.7/types.hal Normal file
View file

@ -0,0 +1,136 @@
/*
* Copyright (C) 2021 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.7;
import @3.2::CameraMetadata;
import @3.2::StreamConfigurationMode;
import @3.4::CaptureRequest;
import @3.4::Stream;
/**
* Stream:
*
* A descriptor for a single camera input or output stream. A stream is defined
* by the framework by its buffer resolution and format, and additionally by the
* HAL with the gralloc usage flags and the maximum in-flight buffer count.
*
* This version extends the @3.4 Stream with the multi-resolution output surface
* group Id field.
*/
struct Stream {
/**
* The definition of Stream from the prior version.
*/
@3.4::Stream v3_4;
/**
* The surface group id used for multi-resolution output streams.
*
* This works simliar to the surfaceGroupId of OutputConfiguration in the
* public API, with the exception that this is for multi-resolution image
* reader and is used by the camera HAL to choose a target stream within
* the same group to which images are written. All streams in the same group
* will have the same image format, data space, and usage flag.
*
* The framework must only call processCaptureRequest on at most one of the
* streams within a surface group. Depending on current active physical
* camera backing the logical multi-camera, or the pixel mode the camera is
* running in, the HAL can choose to request and return a buffer from any
* stream within the same group. -1 means that this stream is an input
* stream, or is an output stream which doesn't belong to any group.
*
* Streams with the same non-negative group id must have the same format and
* usage flag.
*/
int32_t groupId;
};
/**
* StreamConfiguration:
*
* Identical to @3.5::StreamConfiguration, except that the streams
* vector contains @3.7::Stream.
*/
struct StreamConfiguration {
/**
* An array of camera stream pointers, defining the input/output
* configuration for the camera HAL device.
*/
vec<Stream> streams;
/**
* The definition of operation mode from prior version.
*
*/
@3.2::StreamConfigurationMode operationMode;
/**
* The definition of session parameters from prior version.
*/
@3.2::CameraMetadata sessionParams;
/**
* The definition of stream configuration counter from prior version.
*/
uint32_t streamConfigCounter;
/**
* If an input stream is configured, whether the input stream is expected to
* receive variable resolution images.
*
* This flag can only be set to true if the camera device supports
* multi-resolution input streams by advertising input stream configurations in
* physicalCameraMultiResolutionStreamConfigurations in its physical cameras'
* characteristics.
*
* When this flag is set to true, the input stream's width and height can be
* any one of the supported multi-resolution input stream sizes.
*/
bool multiResolutionInputImage;
};
/**
* CaptureRequest:
*
* This version extends 3.4::CaptureRequest with the input buffer's width and
* height.
*/
struct CaptureRequest {
/**
* The definition of CaptureRequest from the prior version.
*/
@3.4::CaptureRequest v3_4;
/**
* The width and height of the input buffer for this capture request.
*
* These fields will be [0, 0] if no input buffer exists in the capture
* request.
*
* If the stream configuration contains an input stream and has the
* multiResolutionInputImage flag set to true, the camera client may submit a
* reprocessing request with input buffer size different than the
* configured input stream size. In that case, the inputWith and inputHeight
* fields will be the actual size of the input image.
*
* If the stream configuration contains an input stream and the
* multiResolutionInputImage flag is false, the inputWidth and inputHeight must
* match the input stream size.
*/
uint32_t inputWidth;
uint32_t inputHeight;
};

View file

@ -42,6 +42,14 @@ enum CameraMetadataTag : @3.5::CameraMetadataTag {
*/
ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE = android.hardware.camera.metadata@3.5::CameraMetadataTag:ANDROID_SCALER_END_3_5,
/** android.scaler.physicalCameraMultiResolutionStreamConfigurations [static, enum[], ndk_public]
*
* <p>The available multi-resolution stream configurations that this
* physical camera device supports
* (i.e. format, width, height, output/input stream).</p>
*/
ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS,
ANDROID_SCALER_END_3_6,
};
@ -49,3 +57,11 @@ enum CameraMetadataTag : @3.5::CameraMetadataTag {
/*
* Enumeration definitions for the various entries that need them
*/
/** android.scaler.physicalCameraMultiResolutionStreamConfigurations enumeration values
* @see ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS
*/
enum CameraMetadataEnumAndroidScalerPhysicalCameraMultiResolutionStreamConfigurations : uint32_t {
ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT,
ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT,
};

View file

@ -48,10 +48,12 @@ cc_test {
"android.hardware.camera.device@3.4",
"android.hardware.camera.device@3.5",
"android.hardware.camera.device@3.6",
"android.hardware.camera.device@3.7",
"android.hardware.camera.metadata@3.4",
"android.hardware.camera.provider@2.4",
"android.hardware.camera.provider@2.5",
"android.hardware.camera.provider@2.6",
"android.hardware.camera.provider@2.7",
"android.hardware.graphics.common@1.0",
"android.hidl.allocator@1.0",
"libgrallocusage",

View file

@ -40,11 +40,14 @@
#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/device/3.7/ICameraDevice.h>
#include <android/hardware/camera/device/3.7/ICameraDeviceSession.h>
#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <android/hardware/camera/provider/2.5/ICameraProvider.h>
#include <android/hardware/camera/provider/2.6/ICameraProvider.h>
#include <android/hardware/camera/provider/2.6/ICameraProviderCallback.h>
#include <android/hardware/camera/provider/2.7/ICameraProvider.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
#include <cutils/properties.h>
@ -189,12 +192,14 @@ enum SystemCameraKind {
namespace {
// "device@<version>/legacy/<id>"
const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)";
const int CAMERA_DEVICE_API_VERSION_3_7 = 0x307;
const int CAMERA_DEVICE_API_VERSION_3_6 = 0x306;
const int CAMERA_DEVICE_API_VERSION_3_5 = 0x305;
const int CAMERA_DEVICE_API_VERSION_3_4 = 0x304;
const int CAMERA_DEVICE_API_VERSION_3_3 = 0x303;
const int CAMERA_DEVICE_API_VERSION_3_2 = 0x302;
const int CAMERA_DEVICE_API_VERSION_1_0 = 0x100;
const char *kHAL3_7 = "3.7";
const char *kHAL3_6 = "3.6";
const char *kHAL3_5 = "3.5";
const char *kHAL3_4 = "3.4";
@ -231,7 +236,9 @@ namespace {
return -1;
}
if (version.compare(kHAL3_6) == 0) {
if (version.compare(kHAL3_7) == 0) {
return CAMERA_DEVICE_API_VERSION_3_7;
} else if (version.compare(kHAL3_6) == 0) {
return CAMERA_DEVICE_API_VERSION_3_6;
} else if (version.compare(kHAL3_5) == 0) {
return CAMERA_DEVICE_API_VERSION_3_5;
@ -756,7 +763,8 @@ public:
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/);
sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/,
sp<device::V3_7::ICameraDeviceSession> *session3_7 /*out*/);
void castDevice(const sp<device::V3_2::ICameraDevice> &device, int32_t deviceVersion,
sp<device::V3_5::ICameraDevice> *device3_5/*out*/);
void createStreamConfiguration(const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
@ -1883,6 +1891,7 @@ TEST_P(CameraHidlTest, getCameraDeviceInterface) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -1926,6 +1935,7 @@ TEST_P(CameraHidlTest, getResourceCost) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -2666,6 +2676,7 @@ TEST_P(CameraHidlTest, systemCameraTest) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -2752,6 +2763,7 @@ TEST_P(CameraHidlTest, getCameraCharacteristics) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -2832,6 +2844,7 @@ TEST_P(CameraHidlTest, setTorchMode) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -2959,6 +2972,7 @@ TEST_P(CameraHidlTest, dumpState) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -3025,6 +3039,7 @@ TEST_P(CameraHidlTest, openClose) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -3056,9 +3071,13 @@ TEST_P(CameraHidlTest, openClose) {
sp<device::V3_4::ICameraDeviceSession> sessionV3_4;
sp<device::V3_5::ICameraDeviceSession> sessionV3_5;
sp<device::V3_6::ICameraDeviceSession> sessionV3_6;
sp<device::V3_7::ICameraDeviceSession> sessionV3_7;
castSession(session, deviceVersion, &sessionV3_3,
&sessionV3_4, &sessionV3_5, &sessionV3_6);
if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_6) {
&sessionV3_4, &sessionV3_5, &sessionV3_6,
&sessionV3_7);
if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_7) {
ASSERT_TRUE(sessionV3_7.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_6) {
ASSERT_TRUE(sessionV3_6.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
ASSERT_TRUE(sessionV3_5.get() != nullptr);
@ -3122,6 +3141,7 @@ TEST_P(CameraHidlTest, constructDefaultRequestSettings) {
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
case CAMERA_DEVICE_API_VERSION_3_4:
@ -3221,11 +3241,13 @@ TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider,
&session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputStreams.clear();
@ -3307,6 +3329,7 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
@ -3344,7 +3367,7 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) {
openEmptyDeviceSession(name, mProvider2_6, &cti.session /*out*/,
&cti.staticMeta /*out*/, &cti.cameraDevice /*out*/);
castSession(cti.session, deviceVersion, &cti.session3_3, &cti.session3_4,
&cti.session3_5, &cti.session3_6);
&cti.session3_5, &cti.session3_6, &cti.session3_7);
castDevice(cti.cameraDevice, deviceVersion, &cti.cameraDevice3_5);
outputStreams.clear();
@ -3462,11 +3485,13 @@ TEST_P(CameraHidlTest, configureStreamsInvalidOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
outputStreams.clear();
@ -3660,11 +3685,13 @@ TEST_P(CameraHidlTest, configureStreamsZSLInputOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
Status rc = isZSLModeAvailable(staticMeta);
@ -3828,8 +3855,10 @@ TEST_P(CameraHidlTest, configureStreamsWithSessionParameters) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
ASSERT_NE(session3_4, nullptr);
} else {
@ -3951,11 +3980,13 @@ TEST_P(CameraHidlTest, configureStreamsPreviewStillOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
// Check if camera support depth only
@ -4069,11 +4100,13 @@ TEST_P(CameraHidlTest, configureStreamsConstrainedOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
Status rc = isConstrainedModeAvailable(staticMeta);
@ -4281,11 +4314,13 @@ TEST_P(CameraHidlTest, configureStreamsVideoStillOutputs) {
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
castDevice(cameraDevice, deviceVersion, &cameraDevice3_5);
// Check if camera support depth only
@ -6103,7 +6138,9 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_6::ICameraDeviceSession> session3_6;
castSession(session, deviceVersion, &session3_3, session3_4, session3_5, &session3_6);
sp<device::V3_7::ICameraDeviceSession> session3_7;
castSession(session, deviceVersion, &session3_3, session3_4, session3_5,
&session3_6, &session3_7);
ASSERT_NE(nullptr, (*session3_4).get());
*useHalBufManager = false;
@ -6144,7 +6181,7 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t
});
ASSERT_TRUE(ret.isOk());
ASSERT_TRUE(!allowUnsupport || deviceVersion == CAMERA_DEVICE_API_VERSION_3_5);
ASSERT_TRUE(!allowUnsupport || deviceVersion >= CAMERA_DEVICE_API_VERSION_3_5);
if (allowUnsupport) {
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
castDevice(device3_x, deviceVersion, &cameraDevice3_5);
@ -6446,7 +6483,9 @@ void CameraHidlTest::configureSingleStream(
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
sp<device::V3_7::ICameraDeviceSession> session3_7;
castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
*useHalBufManager = false;
status = find_camera_metadata_ro_entry(staticMeta,
@ -6583,13 +6622,21 @@ void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/) {
sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/,
sp<device::V3_7::ICameraDeviceSession> *session3_7 /*out*/) {
ASSERT_NE(nullptr, session3_3);
ASSERT_NE(nullptr, session3_4);
ASSERT_NE(nullptr, session3_5);
ASSERT_NE(nullptr, session3_6);
ASSERT_NE(nullptr, session3_7);
switch (deviceVersion) {
case CAMERA_DEVICE_API_VERSION_3_7: {
auto castResult = device::V3_7::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
*session3_7 = castResult;
}
[[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_6: {
auto castResult = device::V3_6::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
@ -7233,7 +7280,9 @@ void CameraHidlTest::verifyBuffersReturned(
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6);
sp<device::V3_7::ICameraDeviceSession> session3_7;
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
&session3_6, &session3_7);
ASSERT_NE(nullptr, session3_5.get());
hidl_vec<int32_t> streamIds(1);

View file

@ -0,0 +1,26 @@
// This file is autogenerated by hidl-gen -Landroidbp.
hidl_interface {
name: "android.hardware.camera.provider@2.7",
root: "android.hardware",
srcs: [
"types.hal",
"ICameraProvider.hal",
],
interfaces: [
"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.device@3.6",
"android.hardware.camera.device@3.7",
"android.hardware.camera.provider@2.4",
"android.hardware.camera.provider@2.5",
"android.hardware.camera.provider@2.6",
"android.hardware.graphics.common@1.0",
"android.hidl.base@1.0",
],
gen_java: false,
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2021 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.provider@2.7;
import @2.6::ICameraProvider;
import android.hardware.camera.common@1.0::Status;
/**
* Camera provider HAL
*
* Adds support for the isConcurrentStreamCombinationSupported() with
* ICameraDevice@3.7::StreamConfiguration.
*/
interface ICameraProvider extends @2.6::ICameraProvider {
/**
* isConcurrentStreamCombinationSupported_2_7:
*
* Identical to @2.6::isConcurrentStreamCombinationSupported except that
* this function takes a vector of @3.7::StreamConfiguration.
*
* @param configs a vector of camera ids and their corresponding stream
* configurations that need to be queried for support.
*
* @return status Status code for the operation, one of:
* OK:
* On successful stream combination query.
* METHOD_NOT_SUPPORTED:
* The camera provider does not support stream combination query.
* INTERNAL_ERROR:
* The stream combination query cannot complete due to internal
* error.
* @return true in case the stream combination is supported, false otherwise.
*
*/
isConcurrentStreamCombinationSupported_2_7(vec<CameraIdAndStreamCombination> configs)
generates (Status status, bool queryStatus);
};

View file

@ -0,0 +1,30 @@
/*
* Copyright (C) 2021 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.provider@2.7;
import android.hardware.camera.device@3.7::StreamConfiguration;
/**
* CameraIdAndStreamCombination:
*
* This is identical to @2.6::CameraIdAndStreamCombination except that
* streamConfiguration is of version @3.7.
*/
struct CameraIdAndStreamCombination {
string cameraId;
@3.7::StreamConfiguration streamConfiguration;
};

View file

@ -165,7 +165,7 @@
</hal>
<hal format="hidl" optional="true">
<name>android.hardware.camera.provider</name>
<version>2.4-6</version>
<version>2.4-7</version>
<interface>
<name>ICameraProvider</name>
<regex-instance>[^/]+/[0-9]+</regex-instance>