Merge "Add multiple provision attempts in vts openSession test" into tm-dev
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash
index 7bb15e8..f478504 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash
@@ -1 +1 @@
-38469e5a0359c95015bea304c463b686cf4ee9ca
+8610b651e162c614a97542d6f4ed039c969823e5
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
index 7e48eba..d7b874a 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
@@ -36,5 +36,5 @@
enum VehicleApPowerStateConfigFlag {
ENABLE_DEEP_SLEEP_FLAG = 1,
CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2,
- ENABLE_HIBERNATION_FLAG = 3,
+ ENABLE_HIBERNATION_FLAG = 4,
}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
index 7e48eba..d7b874a 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
@@ -36,5 +36,5 @@
enum VehicleApPowerStateConfigFlag {
ENABLE_DEEP_SLEEP_FLAG = 1,
CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2,
- ENABLE_HIBERNATION_FLAG = 3,
+ ENABLE_HIBERNATION_FLAG = 4,
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
index 4d8e2f5..8b0190ce 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl
@@ -37,5 +37,5 @@
* (via VehicleApPowerStateShutdownParam#CAN_HIBERNATE or
* VehicleApPowerStateShutdownParam#HIBERNATE_IMMEDIATELY flags)
*/
- ENABLE_HIBERNATION_FLAG = 0x3,
+ ENABLE_HIBERNATION_FLAG = 0x4,
}
diff --git a/camera/device/3.8/Android.bp b/camera/device/3.8/Android.bp
deleted file mode 100644
index c3c2941..0000000
--- a/camera/device/3.8/Android.bp
+++ /dev/null
@@ -1,39 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "hardware_interfaces_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-hidl_interface {
- name: "android.hardware.camera.device@3.8",
- root: "android.hardware",
- srcs: [
- "types.hal",
- "ICameraDevice.hal",
- "ICameraDeviceCallback.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.camera.device@3.7",
- "android.hardware.camera.metadata@3.2",
- "android.hardware.camera.metadata@3.3",
- "android.hardware.camera.metadata@3.4",
- "android.hardware.camera.metadata@3.5",
- "android.hardware.camera.metadata@3.6",
- "android.hardware.camera.metadata@3.8",
- "android.hardware.graphics.common@1.0",
- "android.hidl.base@1.0",
- ],
- gen_java: false,
-}
diff --git a/camera/device/3.8/ICameraDevice.hal b/camera/device/3.8/ICameraDevice.hal
deleted file mode 100644
index 09edb8b..0000000
--- a/camera/device/3.8/ICameraDevice.hal
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.8;
-
-import android.hardware.camera.common@1.0::Status;
-import @3.7::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,
- * @3.7::ICameraDeviceSession, or @3.8::ICameraDeviceSession.
- */
-interface ICameraDevice extends @3.7::ICameraDevice {
- /**
- * turnOnTorchWithStrengthLevel:
- *
- * Change the brightness level of the flash unit associated with this camera device
- * and set it to value in torchStrength. This function also turns ON the torch
- * with specified torchStrength if the torch is OFF.
- *
- * The torchStrength value must be within the valid range i.e. >=1 and
- * <= FLASH_INFO_STRENGTH_MAXIMUM_LEVEL. Whenever the torch is turned OFF,
- * the brightness level will reset to FLASH_INFO_STRENGTH_DEFAULT_LEVEL.
- * When the client calls setTorchMode(ON) after turnOnTorchWithStrengthLevel(N),
- * the flash unit will have brightness level equal to N. This level does not
- * represent the real brightness units. It is linear in nature i.e. flashlight
- * at level 10 is twice as bright as at level 5.
- *
- * @param torchStrength Brightness level to be set for the flashlight.
- *
- * @return status Status code for the operation, one of:
- * OK:
- * On a successful change to the torch strength level.
- * INTERNAL_ERROR:
- * The flash unit cannot be operated due to an unexpected internal
- * error.
- * CAMERA_IN_USE:
- * This status code is returned when:
- * - This camera device has been opened, so the torch cannot be
- * controlled until it is closed.
- * - Due to other camera devices being open, or due to other
- * resource constraints, the torch cannot be controlled currently.
- * ILLEGAL_ARGUMENT:
- * If the torchStrength value is not within the range i.e. < 1 or
- * > FLASH_INFO_STRENGTH_MAXIMUM_LEVEL.
- * METHOD_NOT_SUPPORTED:
- * This status code is returned when:
- * - This camera device does not support direct operation of flashlight
- * torch mode. The framework must open the camera device and turn
- * the torch on through the device interface.
- * - This camera device does not have a flash unit.
- * - This camera device has flash unit but does not support torch
- * strength control.
- * CAMERA_DISCONNECTED:
- * An external camera device has been disconnected, and is no longer
- * available. This camera device interface is now stale, and a new
- * instance must be acquired if the device is reconnected. All
- * subsequent calls on this interface must return
- * CAMERA_DISCONNECTED.
- *
- */
- turnOnTorchWithStrengthLevel(int32_t torchStrength) generates (Status status);
-
- /**
- * getTorchStrengthLevel:
- *
- * Get current torch strength level.
- * If the device supports torch strength control, when the torch is OFF the
- * strength level will reset to default level, so the return
- * value in this case will be equal to FLASH_INFO_STRENGTH_DEFAULT_LEVEL.
- *
- * @return status Status code for the operation, one of:
- * OK:
- * On success.
- * INTERNAL_ERROR:
- * An unexpected error occurred and the information is not
- * available.
- * METHOD_NOT_SUPPORTED:
- * This status code is returned when:
- * - This camera device does not support direct operation of flashlight
- * torch mode. The framework must open the camera device and turn
- * the torch on through the device interface.
- * - This camera device does not have a flash unit.
- * - This camera device has flash unit but does not support torch
- * strength control.
- *
- * @return torchStrength Current torch strength level.
- *
- */
- getTorchStrengthLevel() generates (Status status, int32_t torchStrength);
-
- /**
- * isStreamCombinationSupported_3_8:
- *
- * Identical to @3.7::ICameraDevice.isStreamCombinationSupported, except
- * that it takes a @3.8::StreamConfiguration parameter, which could contain
- * additional information about a specific 10-bit dynamic range profile or
- * stream use case.
- *
- */
- isStreamCombinationSupported_3_8(StreamConfiguration streams)
- generates (Status status, bool queryStatus);
-};
diff --git a/camera/device/3.8/ICameraDeviceCallback.hal b/camera/device/3.8/ICameraDeviceCallback.hal
deleted file mode 100644
index de0775d..0000000
--- a/camera/device/3.8/ICameraDeviceCallback.hal
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.8;
-
-import @3.5::ICameraDeviceCallback;
-
-/**
- * Callback methods for the HAL to call into the framework.
- */
-interface ICameraDeviceCallback extends @3.5::ICameraDeviceCallback {
- /**
- * Identical to @3.5::ICameraDeviceCallback.notify, except that it takes a
- * list of @3.8::NotifyMsg which contain readout timestamp in addition
- * to exposure start timestamp for shutter.
- *
- * The readout timestamp is used for the framework to re-time the viewfinder
- * frames targeted for SurfaceView so that preview jitter can be reduced.
- */
- notify_3_8(vec<NotifyMsg> msgs);
-};
diff --git a/camera/device/3.8/ICameraDeviceSession.hal b/camera/device/3.8/ICameraDeviceSession.hal
deleted file mode 100644
index c3aa836..0000000
--- a/camera/device/3.8/ICameraDeviceSession.hal
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.8;
-
-import android.hardware.camera.common@1.0::Status;
-import @3.5::StreamConfiguration;
-import @3.7::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.7::ICameraDeviceSession {
- /**
- * configureStreams_3_8:
- *
- * Identical to @3.7::ICameraDeviceSession.configureStreams_3_7, except that:
- *
- * - The requestedConfiguration allows the camera framework to configure
- * 10-bit dynamic range profile.
- * - The requestedConfiguration allows the camera framework to configure
- * stream use cases.
- *
- * @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.
- * - Invalid combination between a 10-bit dynamic range profile
- * and none impl. defined 8-bit format for a particular stream.
- * - Unsupported stream use case
- * 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 and dataspace.
- */
- configureStreams_3_8(StreamConfiguration requestedConfiguration)
- generates (Status status, @3.6::HalStreamConfiguration halConfiguration);
-
- /**
- * repeatingRequestEnd:
- *
- * Notification about the last frame number in a repeating request along with the
- * ids of all streams included in the repeating request.
- *
- * This can be called at any point after 'processCaptureRequest' in response
- * to camera clients disabling an active repeating request.
- *
- * Performance requirements:
- * The call must not be blocked for extensive periods and should be extremely lightweight. There
- * must be no frame rate degradation or frame jitter introduced.
- *
- * This method must always succeed, even if the device has encountered a
- * serious error.
- */
- repeatingRequestEnd(uint32_t frameNumber, vec<int32_t> streamIds);
-};
diff --git a/camera/device/3.8/types.hal b/camera/device/3.8/types.hal
deleted file mode 100644
index 04a2450..0000000
--- a/camera/device/3.8/types.hal
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.8;
-
-import @3.2::ErrorMsg;
-import @3.2::CameraMetadata;
-import @3.2::MsgType;
-import @3.2::ShutterMsg;
-import @3.2::CameraMetadata;
-import @3.2::StreamConfigurationMode;
-import @3.7::Stream;
-
-import android.hardware.camera.metadata@3.8::CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap;
-import android.hardware.camera.metadata@3.8::CameraMetadataEnumAndroidScalerAvailableStreamUseCases;
-
-/**
- * ShutterMsg:
- *
- * Message contents for MsgType::SHUTTER
- *
- * This version extends the @3.2 ShutterMsg with the readout timestamp.
- */
-struct ShutterMsg {
- /**
- * The definition of ShutterMsg from prior version.
- */
- @3.2::ShutterMsg v3_2;
-
- /**
- * Timestamp for the capture readout. This must be in the same time domain
- * as v3_2.timestamp, and for a rolling shutter sensor, the value must be
- * v3_2.timestamp + exposureTime + t_crop_top where t_crop_top is the exposure time
- * skew of the cropped lines on the top.
- */
- uint64_t readoutTimestamp;
-};
-
-/**
- * NotifyMsg:
- *
- * The message structure sent to ICameraDevice3Callback::notify()
- *
- * This version extends the @3.2 NotifyMsg with the @3.8 version of ShutterMsg.
- */
-struct NotifyMsg {
- /**
- * The message type.
- */
- @3.2::MsgType type;
-
- union Message {
- /**
- * Error message contents. Valid if type is MsgType::ERROR
- */
- @3.2::ErrorMsg error;
-
- /**
- * Shutter message contents. Valid if type is MsgType::SHUTTER
- */
- ShutterMsg shutter;
- } msg;
-};
-
-/**
- * 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.7 Stream with the dynamic range profile and the
- * stream use case field.
- */
-struct Stream {
- /**
- * The definition of Stream from the prior version.
- */
- @3.7::Stream v3_7;
-
- /**
- * The dynamic range profile for this stream.
- *
- * This field is valid and must only be considered for streams with format
- * android.hardware.graphics.common.PixelFormat.YCBCR_P010 or
- * android.hardware.graphics.common.PixelFormat.IMPLEMENTATION_DEFINED on devices supporting the
- * ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_10_BIT capability.
- *
- */
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap dynamicRangeProfile;
-
- /**
- * The stream use case describing the stream's purpose
- *
- * This flag provides the camera device a hint on what user scenario this
- * stream is intended for. With this flag, the camera device can optimize
- * camera pipeline parameters, such as tuning, sensor mode, and ISP settings,
- * for the intended use case.
- *
- * When this field is set to DEFAULT, the camera device should behave in
- * the same way as in previous HAL versions, and optimize the camera pipeline
- * based on stream format, data space, usage flag, and other stream properties.
- *
- * The HAL reports supported stream use cases in
- * ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES. If the HAL doesn't support
- * setting stream use cases, the camera framework leaves this field as
- * DEFAULT.
- */
- CameraMetadataEnumAndroidScalerAvailableStreamUseCases useCase;
-};
-
-/**
- * StreamConfiguration:
- *
- * Identical to @3.7::StreamConfiguration, except that the streams
- * vector contains @3.8::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;
-
- /**
- * The definition of multi-resolution input image flag from prior version.
- */
- bool multiResolutionInputImage;
-};
diff --git a/camera/metadata/3.8/Android.bp b/camera/metadata/3.8/Android.bp
deleted file mode 100644
index ead9543..0000000
--- a/camera/metadata/3.8/Android.bp
+++ /dev/null
@@ -1,27 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "hardware_interfaces_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-hidl_interface {
- name: "android.hardware.camera.metadata@3.8",
- root: "android.hardware",
- srcs: [
- "types.hal",
- ],
- interfaces: [
- "android.hardware.camera.metadata@3.2",
- "android.hardware.camera.metadata@3.3",
- "android.hardware.camera.metadata@3.4",
- "android.hardware.camera.metadata@3.5",
- "android.hardware.camera.metadata@3.6",
- "android.hardware.camera.metadata@3.7",
- ],
- gen_java: true,
-}
diff --git a/camera/metadata/3.8/types.hal b/camera/metadata/3.8/types.hal
deleted file mode 100644
index 8cc6646..0000000
--- a/camera/metadata/3.8/types.hal
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Autogenerated from camera metadata definitions in
- * /system/media/camera/docs/metadata_definitions.xml
- * *** DO NOT EDIT BY HAND ***
- */
-
-package android.hardware.camera.metadata@3.8;
-
-import android.hardware.camera.metadata@3.2;
-import android.hardware.camera.metadata@3.3;
-import android.hardware.camera.metadata@3.4;
-import android.hardware.camera.metadata@3.5;
-import android.hardware.camera.metadata@3.6;
-import android.hardware.camera.metadata@3.7;
-
-/**
- * Top level hierarchy definitions for camera metadata. *_INFO sections are for
- * the static metadata that can be retrieved without opening the camera device.
- */
-enum CameraMetadataSection : @3.4::CameraMetadataSection {
- ANDROID_AUTOMOTIVE =
- android.hardware.camera.metadata@3.4::CameraMetadataSection:ANDROID_SECTION_COUNT,
-
- ANDROID_AUTOMOTIVE_LENS,
-
- ANDROID_SECTION_COUNT_3_8,
-
- VENDOR_SECTION_3_8 = 0x8000,
-
-};
-
-/**
- * Hierarchy positions in enum space. All vendor extension sections must be
- * defined with tag >= VENDOR_SECTION_START
- */
-enum CameraMetadataSectionStart : android.hardware.camera.metadata@3.4::CameraMetadataSectionStart {
- ANDROID_AUTOMOTIVE_START = CameraMetadataSection:ANDROID_AUTOMOTIVE << 16,
-
- ANDROID_AUTOMOTIVE_LENS_START = CameraMetadataSection:ANDROID_AUTOMOTIVE_LENS << 16,
-
- VENDOR_SECTION_START_3_8 = CameraMetadataSection:VENDOR_SECTION_3_8 << 16,
-
-};
-
-/**
- * Main enumeration for defining camera metadata tags added in this revision
- *
- * <p>Partial documentation is included for each tag; for complete documentation, reference
- * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.</p>
- */
-enum CameraMetadataTag : @3.7::CameraMetadataTag {
- /** android.flash.info.strengthMaximumLevel [static, int32, public]
- *
- * <p>Maximum flashlight brightness level.</p>
- */
- ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL = android.hardware.camera.metadata@3.2::CameraMetadataTag:ANDROID_FLASH_INFO_END,
-
- /** android.flash.info.strengthDefaultLevel [static, int32, public]
- *
- * <p>Default flashlight brightness level to be set via
- * {android.hardware.camera2.CameraManager#turnOnTorchWithStrengthLevel}.</p>
- */
- ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL,
-
- ANDROID_FLASH_INFO_END_3_8,
-
- /** android.request.availableDynamicRangeProfilesMap [static, enum[], ndk_public]
- *
- * <p>A map of all available 10-bit dynamic range profiles along with their
- * capture request constraints.</p>
- */
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = android.hardware.camera.metadata@3.4::CameraMetadataTag:ANDROID_REQUEST_END_3_4,
-
- /** android.request.recommendedTenBitDynamicRangeProfile [static, int64, java_public]
- *
- * <p>Recommended 10-bit dynamic range profile.</p>
- */
- ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE,
-
- ANDROID_REQUEST_END_3_8,
-
- /** android.scaler.availableStreamUseCases [static, enum[], public]
- *
- * <p>The stream use cases supported by this camera device.</p>
- */
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = android.hardware.camera.metadata@3.6::CameraMetadataTag:ANDROID_SCALER_END_3_6,
-
- ANDROID_SCALER_END_3_8,
-
- /** android.automotive.location [static, enum, public]
- *
- * <p>Location of the cameras on the automotive devices.</p>
- */
- ANDROID_AUTOMOTIVE_LOCATION = CameraMetadataSectionStart:ANDROID_AUTOMOTIVE_START,
-
- ANDROID_AUTOMOTIVE_END_3_8,
-
- /** android.automotive.lens.facing [static, enum[], public]
- *
- * <p>The direction of the camera faces relative to the vehicle body frame and the
- * passenger seats.</p>
- */
- ANDROID_AUTOMOTIVE_LENS_FACING = CameraMetadataSectionStart:ANDROID_AUTOMOTIVE_LENS_START,
-
- ANDROID_AUTOMOTIVE_LENS_END_3_8,
-
-};
-
-/*
- * Enumeration definitions for the various entries that need them
- */
-
-/** android.control.videoStabilizationMode enumeration values added since v3.2
- * @see ANDROID_CONTROL_VIDEO_STABILIZATION_MODE
- */
-enum CameraMetadataEnumAndroidControlVideoStabilizationMode :
- @3.2::CameraMetadataEnumAndroidControlVideoStabilizationMode {
- ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION,
-};
-
-/** android.lens.poseReference enumeration values added since v3.5
- * @see ANDROID_LENS_POSE_REFERENCE
- */
-enum CameraMetadataEnumAndroidLensPoseReference :
- @3.5::CameraMetadataEnumAndroidLensPoseReference {
- ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE,
-};
-
-/** android.request.availableCapabilities enumeration values added since v3.6
- * @see ANDROID_REQUEST_AVAILABLE_CAPABILITIES
- */
-enum CameraMetadataEnumAndroidRequestAvailableCapabilities :
- @3.6::CameraMetadataEnumAndroidRequestAvailableCapabilities {
- ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT,
- ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE,
-};
-
-/** android.request.availableDynamicRangeProfilesMap enumeration values
- * @see ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP
- */
-enum CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap : int64_t {
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD
- = 0x1,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 0x2,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 0x4,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS
- = 0x8,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF
- = 0x10,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO
- = 0x20,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM
- = 0x40,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO
- = 0x80,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF
- = 0x100,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO
- = 0x200,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM
- = 0x400,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO
- = 0x800,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 0x1000,
-};
-
-/** android.scaler.availableRecommendedStreamConfigurations enumeration values added since v3.4
- * @see ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS
- */
-enum CameraMetadataEnumAndroidScalerAvailableRecommendedStreamConfigurations :
- @3.4::CameraMetadataEnumAndroidScalerAvailableRecommendedStreamConfigurations {
- ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT
- = 0x8,
- ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8
- = 0x9,
-};
-
-/** android.scaler.availableStreamUseCases enumeration values
- * @see ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES
- */
-enum CameraMetadataEnumAndroidScalerAvailableStreamUseCases : int64_t {
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0x0,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 0x1,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 0x2,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 0x3,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL
- = 0x4,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 0x5,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 0x10000,
-};
-
-/** android.automotive.location enumeration values
- * @see ANDROID_AUTOMOTIVE_LOCATION
- */
-enum CameraMetadataEnumAndroidAutomotiveLocation : uint32_t {
- ANDROID_AUTOMOTIVE_LOCATION_INTERIOR,
- ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER,
- ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT,
- ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR,
- ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT,
- ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT,
- ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER,
- ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT,
- ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR,
- ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT,
- ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT,
-};
-
-/** android.automotive.lens.facing enumeration values
- * @see ANDROID_AUTOMOTIVE_LENS_FACING
- */
-enum CameraMetadataEnumAndroidAutomotiveLensFacing : uint32_t {
- ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER,
- ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT,
- ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR,
- ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT,
- ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER,
- ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT,
-};
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 2f24dfd..85e69eb 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -50,9 +50,7 @@
"android.hardware.camera.device@3.5",
"android.hardware.camera.device@3.6",
"android.hardware.camera.device@3.7",
- "android.hardware.camera.device@3.8",
"android.hardware.camera.metadata@3.4",
- "android.hardware.camera.metadata@3.8",
"android.hardware.camera.provider@2.4",
"android.hardware.camera.provider@2.5",
"android.hardware.camera.provider@2.6",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index f89c71d..6866776 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -42,14 +42,9 @@
#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.8/ICameraDevice.h>
#include <android/hardware/camera/device/3.7/ICameraDeviceSession.h>
-#include <android/hardware/camera/device/3.8/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.7/ICameraInjectionSession.h>
-#include <android/hardware/camera/device/3.8/ICameraDeviceCallback.h>
-#include <android/hardware/camera/device/3.8/ICameraDeviceSession.h>
#include <android/hardware/camera/metadata/3.4/types.h>
-#include <android/hardware/camera/metadata/3.8/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>
@@ -134,10 +129,6 @@
CameraMetadataEnumAndroidSensorInfoColorFilterArrangement;
using ::android::hardware::camera::metadata::V3_4::CameraMetadataTag;
using ::android::hardware::camera::metadata::V3_6::CameraMetadataEnumAndroidSensorPixelMode;
-using ::android::hardware::camera::metadata::V3_8::
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap;
-using ::android::hardware::camera::metadata::V3_8::
- CameraMetadataEnumAndroidScalerAvailableStreamUseCases;
using ::android::hardware::camera::provider::V2_4::ICameraProvider;
using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
using ::android::hardware::camera::provider::V2_6::CameraIdAndStreamCombination;
@@ -233,8 +224,7 @@
namespace {
// "device@<version>/legacy/<id>"
- const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)";
- const int CAMERA_DEVICE_API_VERSION_3_8 = 0x308;
+ 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;
@@ -242,19 +232,16 @@
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_8 = "3.8";
- const char *kHAL3_7 = "3.7";
- const char *kHAL3_6 = "3.6";
- const char *kHAL3_5 = "3.5";
- const char *kHAL3_4 = "3.4";
- const char *kHAL3_3 = "3.3";
- const char *kHAL3_2 = "3.2";
- const char *kHAL1_0 = "1.0";
+ const char* kHAL3_7 = "3.7";
+ const char* kHAL3_6 = "3.6";
+ const char* kHAL3_5 = "3.5";
+ const char* kHAL3_4 = "3.4";
+ const char* kHAL3_3 = "3.3";
+ const char* kHAL3_2 = "3.2";
+ const char* kHAL1_0 = "1.0";
- bool matchDeviceName(const hidl_string& deviceName,
- const hidl_string &providerType,
- std::string* deviceVersion,
- std::string* cameraId) {
+ bool matchDeviceName(const hidl_string& deviceName, const hidl_string& providerType,
+ std::string* deviceVersion, std::string* cameraId) {
::android::String8 pattern;
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
std::regex e(pattern.string());
@@ -280,9 +267,7 @@
return -1;
}
- if (version.compare(kHAL3_8) == 0) {
- return CAMERA_DEVICE_API_VERSION_3_8;
- } else if (version.compare(kHAL3_7) == 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;
@@ -652,7 +637,8 @@
}
virtual Return<void> processCaptureResult_3_4(
- const hidl_vec<V3_4::CaptureResult>& /*results*/) override {
+
+ const hidl_vec<V3_4::CaptureResult>& /*results*/) override {
ALOGI("processCaptureResult_3_4 callback");
ADD_FAILURE(); // Empty callback should not reach here
return Void();
@@ -682,44 +668,41 @@
}
};
- struct DeviceCb : public V3_8::ICameraDeviceCallback {
- DeviceCb(CameraHidlTest *parent, int deviceVersion, const camera_metadata_t *staticMeta) :
- mParent(parent), mDeviceVersion(deviceVersion) {
+ struct DeviceCb : public V3_5::ICameraDeviceCallback {
+ DeviceCb(CameraHidlTest* parent, int deviceVersion, const camera_metadata_t* staticMeta)
+ : mParent(parent), mDeviceVersion(deviceVersion) {
mStaticMetadata = staticMeta;
}
- Return<void> processCaptureResult_3_4(
- const hidl_vec<V3_4::CaptureResult>& results) override;
+ Return<void> processCaptureResult_3_4(const hidl_vec<V3_4::CaptureResult>& results) override;
Return<void> processCaptureResult(const hidl_vec<CaptureResult>& results) override;
Return<void> notify(const hidl_vec<NotifyMsg>& msgs) override;
- Return<void> notify_3_8(const hidl_vec<V3_8::NotifyMsg>& msgs) override;
- Return<void> requestStreamBuffers(
- const hidl_vec<V3_5::BufferRequest>& bufReqs,
- requestStreamBuffers_cb _hidl_cb) override;
+ Return<void> requestStreamBuffers(const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) override;
Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>& buffers) override;
void setCurrentStreamConfig(const hidl_vec<V3_4::Stream>& streams,
- const hidl_vec<V3_2::HalStream>& halStreams);
+ const hidl_vec<V3_2::HalStream>& halStreams);
void waitForBuffersReturned();
private:
bool processCaptureResultLocked(const CaptureResult& results,
- hidl_vec<PhysicalCameraMetadata> physicalCameraMetadata);
+ hidl_vec<PhysicalCameraMetadata> physicalCameraMetadata);
Return<void> notifyHelper(const hidl_vec<NotifyMsg>& msgs,
- const std::vector<std::pair<bool, nsecs_t>>& readoutTimestamps);
+ const std::vector<std::pair<bool, nsecs_t>>& readoutTimestamps);
- CameraHidlTest *mParent; // Parent object
+ CameraHidlTest* mParent; // Parent object
int mDeviceVersion;
android::hardware::camera::common::V1_0::helper::CameraMetadata mStaticMetadata;
bool hasOutstandingBuffersLocked();
/* members for requestStreamBuffers() and returnStreamBuffers()*/
- std::mutex mLock; // protecting members below
- bool mUseHalBufManager = false;
- hidl_vec<V3_4::Stream> mStreams;
+ std::mutex mLock; // protecting members below
+ bool mUseHalBufManager = false;
+ hidl_vec<V3_4::Stream> mStreams;
hidl_vec<V3_2::HalStream> mHalStreams;
uint64_t mNextBufferId = 1;
using OutstandingBuffers = std::unordered_map<uint64_t, hidl_handle>;
@@ -814,20 +797,18 @@
sp<provider::V2_5::ICameraProvider>* provider2_5 /*out*/,
sp<provider::V2_6::ICameraProvider>* provider2_6 /*out*/,
sp<provider::V2_7::ICameraProvider>* provider2_7 /*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*/,
- sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
- sp<device::V3_6::ICameraDeviceSession> *session3_6 /*out*/,
- sp<device::V3_7::ICameraDeviceSession> *session3_7 /*out*/,
- sp<device::V3_8::ICameraDeviceSession> *session3_8 /*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*/,
+ sp<device::V3_5::ICameraDeviceSession>* session3_5 /*out*/,
+ sp<device::V3_6::ICameraDeviceSession>* session3_6 /*out*/,
+ sp<device::V3_7::ICameraDeviceSession>* session3_7 /*out*/);
void castInjectionSession(
const sp<ICameraDeviceSession>& session,
sp<device::V3_7::ICameraInjectionSession>* injectionSession3_7 /*out*/);
void castDevice(const sp<device::V3_2::ICameraDevice>& device, int32_t deviceVersion,
sp<device::V3_5::ICameraDevice>* device3_5 /*out*/,
- sp<device::V3_7::ICameraDevice>* device3_7 /*out*/,
- sp<device::V3_8::ICameraDevice>* device3_8 /*out*/);
+ sp<device::V3_7::ICameraDevice>* device3_7 /*out*/);
void createStreamConfiguration(
const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
@@ -857,16 +838,6 @@
uint32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/,
sp<DeviceCb>* outCb /*out*/, uint32_t streamConfigCounter,
bool maxResolution);
- void configureStreams3_8(const std::string& name, int32_t deviceVersion,
- sp<ICameraProvider> provider, PixelFormat format,
- sp<device::V3_8::ICameraDeviceSession>* session3_8 /*out*/,
- V3_2::Stream* previewStream /*out*/,
- device::V3_6::HalStreamConfiguration* halStreamConfig /*out*/,
- bool* supportsPartialResults /*out*/,
- uint32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/,
- sp<DeviceCb>* outCb /*out*/, uint32_t streamConfigCounter,
- bool maxResolution,
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap prof);
void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
@@ -947,9 +918,6 @@
static bool isDepthOnly(const camera_metadata_t* staticMeta);
static bool isUltraHighResolution(const camera_metadata_t* staticMeta);
- static void get10BitDynamicRangeProfiles(const camera_metadata_t* staticMeta,
- std::vector<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap> *profiles);
- static bool is10BitDynamicRangeCapable(const camera_metadata_t* staticMeta);
static Status getAvailableOutputStreams(const camera_metadata_t* staticMeta,
std::vector<AvailableStream>& outputStreams,
@@ -1130,10 +1098,6 @@
expectedPhysicalResults(extraPhysicalResult) {}
};
- static void verify10BitMetadata(HandleImporter& importer,
- const InFlightRequest& request,
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap profile);
-
// Map from frame number to the in-flight request state
typedef ::android::KeyedVector<uint32_t, InFlightRequest*> InFlightMap;
@@ -1564,32 +1528,6 @@
}
}
-Return<void> CameraHidlTest::DeviceCb::notify_3_8(
- const hidl_vec<V3_8::NotifyMsg>& msgs) {
- hidl_vec<NotifyMsg> msgs3_2;
- std::vector<std::pair<bool, nsecs_t>> readoutTimestamps;
-
- nsecs_t count = msgs.size();
- msgs3_2.resize(count);
- readoutTimestamps.resize(count);
-
- for (size_t i = 0; i < count; i++) {
- msgs3_2[i].type = msgs[i].type;
- switch (msgs[i].type) {
- case MsgType::ERROR:
- msgs3_2[i].msg.error = msgs[i].msg.error;
- readoutTimestamps[i] = {false, 0};
- break;
- case MsgType::SHUTTER:
- msgs3_2[i].msg.shutter = msgs[i].msg.shutter.v3_2;
- readoutTimestamps[i] = {true, msgs[i].msg.shutter.readoutTimestamp};
- break;
- }
- }
-
- return notifyHelper(msgs3_2, readoutTimestamps);
-}
-
Return<void> CameraHidlTest::DeviceCb::notify(
const hidl_vec<NotifyMsg>& messages) {
std::vector<std::pair<bool, nsecs_t>> readoutTimestamps;
@@ -2082,7 +2020,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -2127,7 +2064,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -2869,7 +2805,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -2957,7 +2892,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -3018,137 +2952,6 @@
}
}
-// Verify that the torch strength level can be set and retrieved successfully.
-TEST_P(CameraHidlTest, turnOnTorchWithStrengthLevel) {
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- bool torchControlSupported = false;
- bool torchStrengthControlSupported = false;
- Return<void> ret;
-
- ret = mProvider->isSetTorchModeSupported([&](auto status, bool support) {
- ALOGI("isSetTorchModeSupported returns status:%d supported:%d", (int)status, support);
- ASSERT_EQ(Status::OK, status);
- torchControlSupported = support;
- });
-
- sp<TorchProviderCb> cb = new TorchProviderCb(this);
- Return<Status> returnStatus = mProvider->setCallback(cb);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- for (const auto& name : cameraDeviceNames) {
- int deviceVersion = getCameraDeviceVersion(name, mProviderType);
- int32_t defaultLevel;
- switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8: {
- ::android::sp<::android::hardware::camera::device::V3_8::ICameraDevice> device3_8;
- ALOGI("%s: Testing camera device %s", __FUNCTION__, name.c_str());
- ret = mProvider->getCameraDeviceInterface_V3_x(
- name, [&](auto status, const auto& device) {
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- auto castResult = device::V3_8::ICameraDevice::castFrom(device);
- ASSERT_TRUE(castResult.isOk());
- device3_8 = castResult;
- });
- ASSERT_TRUE(ret.isOk());
-
- ret = device3_8->getCameraCharacteristics([&] (auto s, const auto& chars) {
- ASSERT_EQ(Status::OK, s);
- const camera_metadata_t* staticMeta =
- reinterpret_cast<const camera_metadata_t*>(chars.data());
- ASSERT_NE(nullptr, staticMeta);
- torchStrengthControlSupported = isTorchStrengthControlSupported(staticMeta);
- camera_metadata_ro_entry entry;
- int rc = find_camera_metadata_ro_entry(staticMeta,
- ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &entry);
- if (torchStrengthControlSupported) {
- ASSERT_EQ(rc, 0);
- ASSERT_GT(entry.count, 0);
- defaultLevel = *entry.data.i32;
- ALOGI("Default level is:%d", defaultLevel);
- }
- });
- ASSERT_TRUE(ret.isOk());
- // If torchStrengthControl is supported, torchControlSupported should be true.
- if (torchStrengthControlSupported) {
- ASSERT_TRUE(torchControlSupported);
- }
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- returnStatus = device3_8->turnOnTorchWithStrengthLevel(2);
- ASSERT_TRUE(returnStatus.isOk());
- // Method_not_supported check
- if (!torchStrengthControlSupported) {
- ALOGI("Torch strength control not supported.");
- ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
- } else {
- ASSERT_EQ(Status::OK, returnStatus);
- if (returnStatus == Status::OK) {
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l,
- timeout));
- }
- ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- }
- ALOGI("getTorchStrengthLevel: Testing");
- ret = device3_8->getTorchStrengthLevel([&]
- (auto status, const auto& strengthLevel) {
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::OK, status);
- ALOGI("Torch strength level is : %d", strengthLevel);
- ASSERT_EQ(strengthLevel, 2);
- });
- // Turn OFF the torch and verify torch strength level is reset to default level.
- ALOGI("Testing torch strength level reset after turning the torch OFF.");
- returnStatus = device3_8->setTorchMode(TorchMode::OFF);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l,
- timeout));
- }
- ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus);
- }
- ret = device3_8->getTorchStrengthLevel([&]
- (auto status, const auto& strengthLevel) {
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::OK, status);
- ALOGI("Torch strength level after turning OFF torch is : %d",
- strengthLevel);
- ASSERT_EQ(strengthLevel, defaultLevel);
- });
- }
- }
- }
- break;
- 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:
- case CAMERA_DEVICE_API_VERSION_3_3:
- case CAMERA_DEVICE_API_VERSION_3_2:
- case CAMERA_DEVICE_API_VERSION_1_0: {
- ALOGI("Torch strength control feature not supported.");
- }
- break;
- default: {
- ALOGI("Invalid device version.");
- ADD_FAILURE();
- }
- break;
- }
- }
-}
-
//In case it is supported verify that torch can be enabled.
//Check for corresponding toch callbacks as well.
TEST_P(CameraHidlTest, setTorchMode) {
@@ -3170,7 +2973,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -3299,7 +3101,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -3367,7 +3168,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -3401,13 +3201,10 @@
sp<device::V3_5::ICameraDeviceSession> sessionV3_5;
sp<device::V3_6::ICameraDeviceSession> sessionV3_6;
sp<device::V3_7::ICameraDeviceSession> sessionV3_7;
- sp<device::V3_8::ICameraDeviceSession> sessionV3_8;
- castSession(session, deviceVersion, &sessionV3_3,
- &sessionV3_4, &sessionV3_5, &sessionV3_6,
- &sessionV3_7, &sessionV3_8);
- if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_8) {
- ASSERT_TRUE(sessionV3_8.get() != nullptr);
- } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_7) {
+ castSession(session, deviceVersion, &sessionV3_3, &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);
@@ -3417,7 +3214,7 @@
ASSERT_TRUE(sessionV3_4.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_3) {
ASSERT_TRUE(sessionV3_3.get() != nullptr);
- } else { //V3_2
+ } else { // V3_2
ASSERT_TRUE(sessionV3_3.get() == nullptr);
ASSERT_TRUE(sessionV3_4.get() == nullptr);
ASSERT_TRUE(sessionV3_5.get() == nullptr);
@@ -3473,7 +3270,6 @@
for (const auto& name : cameraDeviceNames) {
int deviceVersion = getCameraDeviceVersion(name, mProviderType);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8:
case CAMERA_DEVICE_API_VERSION_3_7:
case CAMERA_DEVICE_API_VERSION_3_6:
case CAMERA_DEVICE_API_VERSION_3_5:
@@ -3575,17 +3371,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider,
&session /*out*/, &staticMeta /*out*/, &cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -3681,11 +3474,9 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
::android::hardware::camera::device::V3_7::StreamConfiguration config3_7;
::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
@@ -3722,9 +3513,8 @@
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_7, &cti.session3_8);
- castDevice(cti.cameraDevice, deviceVersion, &cti.cameraDevice3_5, &cti.cameraDevice3_7,
- &cti.cameraDevice3_8);
+ &cti.session3_5, &cti.session3_6, &cti.session3_7);
+ castDevice(cti.cameraDevice, deviceVersion, &cti.cameraDevice3_5, &cti.cameraDevice3_7);
outputStreams.clear();
ASSERT_EQ(Status::OK, getMandatoryConcurrentStreams(cti.staticMeta, &outputStreams));
@@ -3853,17 +3643,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -4069,17 +3856,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
Status rc = isZSLModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -4258,10 +4042,9 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
+ 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 {
@@ -4400,17 +4183,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
// Check if camera support depth only
if (isDepthOnly(staticMeta)) {
@@ -4537,17 +4317,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
Status rc = isConstrainedModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -4820,17 +4597,14 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
sp<device::V3_2::ICameraDevice> cameraDevice;
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
&cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
+ castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
// Check if camera support depth only
if (isDepthOnly(staticMeta)) {
@@ -5069,28 +4843,6 @@
ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
- // For camera device 3.8 or newer, shutterReadoutTimestamp must be
- // available, and it must be >= shutterTimestamp + exposureTime, and
- // < shutterTimestamp + exposureTime + rollingShutterSkew / 2.
- if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_8) {
- ASSERT_TRUE(inflightReq.shutterReadoutTimestampValid);
- ASSERT_FALSE(inflightReq.collectedResult.isEmpty());
- if (inflightReq.collectedResult.exists(ANDROID_SENSOR_EXPOSURE_TIME)) {
- camera_metadata_entry_t exposureTimeResult = inflightReq.collectedResult.find(
- ANDROID_SENSOR_EXPOSURE_TIME);
- nsecs_t exposureToReadout =
- inflightReq.shutterReadoutTimestamp - inflightReq.shutterTimestamp;
- ASSERT_GE(exposureToReadout, exposureTimeResult.data.i64[0]);
- if (inflightReq.collectedResult.exists(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW)) {
- camera_metadata_entry_t rollingShutterSkew =
- inflightReq.collectedResult.find(
- ANDROID_SENSOR_ROLLING_SHUTTER_SKEW);
- ASSERT_LT(exposureToReadout, exposureTimeResult.data.i64[0] +
- rollingShutterSkew.data.i64[0] / 2);
- }
- }
- }
-
request.frameNumber++;
// Empty settings should be supported after the first call
// for repeating requests.
@@ -5114,20 +4866,6 @@
ASSERT_EQ(Status::OK, status);
ASSERT_EQ(numRequestProcessed, 1u);
- if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_8) {
- sp<device::V3_3::ICameraDeviceSession> session3_3;
- 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_8::ICameraDeviceSession> session3_8;
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- ASSERT_TRUE(session3_8.get() != nullptr);
- hidl_vec<int32_t> streamIds = { halStreamConfig.streams[0].id };
- session3_8->repeatingRequestEnd(request.frameNumber, streamIds);
- }
-
{
std::unique_lock<std::mutex> l(mLock);
while (!inflightReq.errorCodeValid &&
@@ -5153,196 +4891,6 @@
}
}
-TEST_P(CameraHidlTest, processCaptureRequestPreviewStabilization) {
- std::unordered_map<std::string, nsecs_t> cameraDeviceToTimeLag;
- processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ false,
- cameraDeviceToTimeLag);
- processPreviewStabilizationCaptureRequestInternal(/*previewStabilizationOn*/ true,
- cameraDeviceToTimeLag);
-}
-
-void CameraHidlTest::processPreviewStabilizationCaptureRequestInternal(
- bool previewStabilizationOn,
- // Used as output when preview stabilization is off, as output when its
- // on.
- std::unordered_map<std::string, nsecs_t>& cameraDeviceToTimeLag) {
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- AvailableStream streamThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- uint64_t bufferId = 1;
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
-
- for (const auto& name : cameraDeviceNames) {
- int deviceVersion = getCameraDeviceVersion(name, mProviderType);
- if (deviceVersion == CAMERA_DEVICE_API_VERSION_1_0) {
- continue;
- } else if (deviceVersion <= 0) {
- ALOGE("%s: Unsupported device version %d", __func__, deviceVersion);
- ADD_FAILURE();
- return;
- }
-
- if (!supportsPreviewStabilization(name, mProvider)) {
- ALOGI(" %s Camera device %s doesn't support preview stabilization, skipping", __func__,
- name.c_str());
- continue;
- }
-
- if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_8) {
- ALOGE("%s: device version < 3.8 must not advertise preview stabilization,"
- " camera metadata validation will fail",
- __func__);
- ADD_FAILURE();
- }
-
- V3_2::Stream testStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- sp<DeviceCb> cb;
- bool supportsPartialResults = false;
- bool useHalBufManager = false;
- uint32_t partialResultCount = 0;
- configureSingleStream(name, deviceVersion, mProvider, &streamThreshold,
- GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, RequestTemplate::PREVIEW,
- &session /*out*/, &testStream /*out*/, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/,
- &useHalBufManager /*out*/, &cb /*out*/);
-
- std::shared_ptr<ResultMetadataQueue> resultQueue;
- auto resultQueueRet =
- session->getCaptureResultMetadataQueue([&resultQueue](const auto& descriptor) {
- resultQueue = std::make_shared<ResultMetadataQueue>(descriptor);
- if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) {
- ALOGE("%s: HAL returns empty result metadata fmq,"
- " not use it",
- __func__);
- resultQueue = nullptr;
- // Don't use the queue onwards.
- }
- });
- ASSERT_TRUE(resultQueueRet.isOk());
-
- InFlightRequest inflightReq = {1, false, supportsPartialResults, partialResultCount,
- resultQueue};
-
- Return<void> ret;
- android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings;
- ret = session->constructDefaultRequestSettings(
- RequestTemplate::PREVIEW, [&](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- const camera_metadata_t* metadata =
- reinterpret_cast<const camera_metadata_t*>(req.data());
- defaultSettings = metadata;
- settings = req;
- });
- ASSERT_TRUE(ret.isOk());
- android::status_t metadataRet = ::android::OK;
- uint8_t videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;
- if (previewStabilizationOn) {
- videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION;
- metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
- &videoStabilizationMode, 1);
- } else {
- metadataRet = defaultSettings.update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
- &videoStabilizationMode, 1);
- }
- ASSERT_EQ(metadataRet, ::android::OK);
- hidl_handle buffer_handle;
- StreamBuffer outputBuffer;
- if (useHalBufManager) {
- outputBuffer = {halStreamConfig.streams[0].id,
- /*bufferId*/ 0,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
- } else {
- allocateGraphicBuffer(
- testStream.width, testStream.height,
- /* We don't look at halStreamConfig.streams[0].consumerUsage
- * since that is 0 for output streams
- */
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- GRALLOC1_CONSUMER_USAGE_HWCOMPOSER),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
- outputBuffer = {halStreamConfig.streams[0].id,
- bufferId,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
- }
- ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
- StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings, emptyInputBuffer,
- outputBuffers};
-
- {
- std::unique_lock<std::mutex> l(mLock);
- mInflightMap.clear();
- mInflightMap.add(frameNumber, &inflightReq);
- }
-
- Status status = Status::INTERNAL_ERROR;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- Return<void> returnStatus = session->processCaptureRequest(
- {request}, cachesToRemove, [&status, &numRequestProcessed](auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
- });
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, status);
- ASSERT_EQ(numRequestProcessed, 1u);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- while (!inflightReq.errorCodeValid &&
- ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kStreamBufferTimeoutSec);
- ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
- }
-
- ASSERT_FALSE(inflightReq.errorCodeValid);
- ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- ASSERT_EQ(testStream.id, inflightReq.resultOutputBuffers[0].buffer.streamId);
- ASSERT_TRUE(inflightReq.shutterReadoutTimestampValid);
- nsecs_t readoutTimestamp = inflightReq.shutterReadoutTimestamp;
-
- if (previewStabilizationOn) {
- // Here we collect the time difference between the buffer ready
- // timestamp - notify readout timestamp.
- // timeLag = buffer ready timestamp - notify readout timestamp.
- // timeLag(previewStabilization) must be <=
- // timeLag(stabilization off) + 1 frame duration.
- auto it = cameraDeviceToTimeLag.find(name.c_str());
- camera_metadata_entry e;
- e = inflightReq.collectedResult.find(ANDROID_SENSOR_FRAME_DURATION);
- ASSERT_TRUE(e.count > 0);
- nsecs_t frameDuration = e.data.i64[0];
- ASSERT_TRUE(it != cameraDeviceToTimeLag.end());
-
- nsecs_t previewStabOnLagTime =
- inflightReq.resultOutputBuffers[0].timeStamp - readoutTimestamp;
- ASSERT_TRUE(previewStabOnLagTime <= (it->second + frameDuration));
- } else {
- // Fill in the buffer ready timestamp - notify timestamp;
- cameraDeviceToTimeLag[std::string(name.c_str())] =
- inflightReq.resultOutputBuffers[0].timeStamp - readoutTimestamp;
- }
- }
-
- if (useHalBufManager) {
- verifyBuffersReturned(session, deviceVersion, testStream.id, cb);
- }
-
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- }
-}
-
// Generate and verify a multi-camera capture request
TEST_P(CameraHidlTest, processMultiCaptureRequestPreview) {
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
@@ -5771,188 +5319,6 @@
}
}
-// Generate and verify 10-bit dynamic range request
-TEST_P(CameraHidlTest, process10BitDynamicRangeRequest) {
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- uint64_t bufferId = 1;
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
-
- for (const auto& name : cameraDeviceNames) {
- int deviceVersion = getCameraDeviceVersion(name, mProviderType);
- if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_8) {
- continue;
- }
- std::string version, deviceId;
- ASSERT_TRUE(::matchDeviceName(name, mProviderType, &version, &deviceId));
- camera_metadata_t* staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, mProvider, &session, &staticMeta);
- if (!is10BitDynamicRangeCapable(staticMeta)) {
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- continue;
- }
- std::vector<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap> profileList;
- get10BitDynamicRangeProfiles(staticMeta, &profileList);
- ASSERT_FALSE(profileList.empty());
-
- android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings;
- ret = session->constructDefaultRequestSettings(
- RequestTemplate::STILL_CAPTURE,
- [&defaultSettings](auto status, const auto& req) mutable {
- ASSERT_EQ(Status::OK, status);
-
- const camera_metadata_t* metadata =
- reinterpret_cast<const camera_metadata_t*>(req.data());
- size_t expectedSize = req.size();
- int result = validate_camera_metadata_structure(metadata, &expectedSize);
- ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED));
-
- size_t entryCount = get_camera_metadata_entry_count(metadata);
- ASSERT_GT(entryCount, 0u);
- defaultSettings = metadata;
- });
- ASSERT_TRUE(ret.isOk());
-
- const camera_metadata_t* settingsBuffer = defaultSettings.getAndLock();
- settings.setToExternal(
- reinterpret_cast<uint8_t*>(const_cast<camera_metadata_t*>(settingsBuffer)),
- get_camera_metadata_size(settingsBuffer));
- overrideRotateAndCrop(&settings);
-
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- V3_6::HalStreamConfiguration halStreamConfig;
- bool supportsPartialResults = false;
- bool useHalBufManager = false;
- uint32_t partialResultCount = 0;
- V3_2::Stream previewStream;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
- sp<DeviceCb> cb;
- for (const auto& profile : profileList) {
- configureStreams3_8(name, deviceVersion, mProvider, PixelFormat::IMPLEMENTATION_DEFINED,
- &session3_8, &previewStream, &halStreamConfig,
- &supportsPartialResults, &partialResultCount, &useHalBufManager,
- &cb, 0, /*maxResolution*/ false, profile);
- ASSERT_NE(session3_8, nullptr);
-
- std::shared_ptr<ResultMetadataQueue> resultQueue;
- auto resultQueueRet = session3_8->getCaptureResultMetadataQueue(
- [&resultQueue](const auto& descriptor) {
- resultQueue = std::make_shared<ResultMetadataQueue>(descriptor);
- if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) {
- ALOGE("%s: HAL returns empty result metadata fmq,"
- " not use it",
- __func__);
- resultQueue = nullptr;
- // Don't use the queue onwards.
- }
- });
- ASSERT_TRUE(resultQueueRet.isOk());
-
- std::vector<hidl_handle> graphicBuffers;
- graphicBuffers.reserve(halStreamConfig.streams.size());
- ::android::hardware::hidl_vec<StreamBuffer> outputBuffers;
- outputBuffers.resize(halStreamConfig.streams.size());
- InFlightRequest inflightReq = {static_cast<ssize_t>(halStreamConfig.streams.size()),
- false,
- supportsPartialResults,
- partialResultCount,
- std::unordered_set<std::string>(),
- resultQueue};
-
- size_t k = 0;
- for (const auto& halStream : halStreamConfig.streams) {
- hidl_handle buffer_handle;
- if (useHalBufManager) {
- outputBuffers[k] = {halStream.v3_4.v3_3.v3_2.id,
- 0,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
- } else {
- allocateGraphicBuffer(
- previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStream.v3_4.v3_3.v3_2.producerUsage,
- halStream.v3_4.v3_3.v3_2.consumerUsage),
- halStream.v3_4.v3_3.v3_2.overrideFormat, &buffer_handle);
-
- graphicBuffers.push_back(buffer_handle);
- outputBuffers[k] = {halStream.v3_4.v3_3.v3_2.id,
- bufferId,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
- bufferId++;
- }
- k++;
- }
-
- StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr};
- V3_4::CaptureRequest request3_4;
- request3_4.v3_2.frameNumber = frameNumber;
- request3_4.v3_2.fmqSettingsSize = 0;
- request3_4.v3_2.settings = settings;
- request3_4.v3_2.inputBuffer = emptyInputBuffer;
- request3_4.v3_2.outputBuffers = outputBuffers;
- V3_7::CaptureRequest request3_7;
- request3_7.v3_4 = request3_4;
- request3_7.inputWidth = 0;
- request3_7.inputHeight = 0;
-
- {
- std::unique_lock<std::mutex> l(mLock);
- mInflightMap.clear();
- mInflightMap.add(frameNumber, &inflightReq);
- }
-
- Status stat = Status::INTERNAL_ERROR;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- Return<void> returnStatus = session3_8->processCaptureRequest_3_7(
- {request3_7}, cachesToRemove,
- [&stat, &numRequestProcessed](auto s, uint32_t n) {
- stat = s;
- numRequestProcessed = n;
- });
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, stat);
- ASSERT_EQ(numRequestProcessed, 1u);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- while (!inflightReq.errorCodeValid &&
- ((0 < inflightReq.numBuffersLeft) || (!inflightReq.haveResultMetadata))) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kStreamBufferTimeoutSec);
- ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
- }
-
- ASSERT_FALSE(inflightReq.errorCodeValid);
- ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
- verify10BitMetadata(mHandleImporter, inflightReq, profile);
- }
- if (useHalBufManager) {
- hidl_vec<int32_t> streamIds(halStreamConfig.streams.size());
- for (size_t i = 0; i < streamIds.size(); i++) {
- streamIds[i] = halStreamConfig.streams[i].v3_4.v3_3.v3_2.id;
- }
- session3_8->signalStreamFlush(streamIds, /*streamConfigCounter*/ 0);
- cb->waitForBuffersReturned();
- }
-
- ret = session3_8->close();
- ASSERT_TRUE(ret.isOk());
- }
- }
-}
-
// Generate and verify a burst containing alternating sensor sensitivity values
TEST_P(CameraHidlTest, processCaptureRequestBurstISO) {
hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
@@ -5982,8 +5348,8 @@
camera_metadata_entry_t hwLevel = staticMeta.find(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL);
ASSERT_TRUE(0 < hwLevel.count);
if (ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED == hwLevel.data.u8[0] ||
- ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL == hwLevel.data.u8[0]) {
- //Limited/External devices can skip this test
+ ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL == hwLevel.data.u8[0]) {
+ // Limited/External devices can skip this test
ret = session->close();
ASSERT_TRUE(ret.isOk());
continue;
@@ -6946,134 +6312,6 @@
}
}
-// Verify that valid stream use cases can be configured successfully, and invalid use cases
-// fail stream configuration.
-TEST_P(CameraHidlTest, configureStreamsUseCases) {
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
-
- for (const auto& name : cameraDeviceNames) {
- int deviceVersion = getCameraDeviceVersion(name, mProviderType);
- if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_8) {
- continue;
- }
-
- camera_metadata_t* staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- sp<device::V3_3::ICameraDeviceSession> session3_3;
- 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_8::ICameraDeviceSession> session3_8;
- sp<device::V3_2::ICameraDevice> cameraDevice;
- sp<device::V3_5::ICameraDevice> cameraDevice3_5;
- sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
- openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/,
- &cameraDevice /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
- ASSERT_NE(nullptr, session3_8);
- castDevice(cameraDevice, deviceVersion, &cameraDevice3_5, &cameraDevice3_7,
- &cameraDevice3_8);
- ASSERT_NE(nullptr, cameraDevice3_8);
-
- // Check if camera support depth only
- if (isDepthOnly(staticMeta)) {
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- continue;
- }
-
- std::vector<AvailableStream> outputPreviewStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::YCBCR_420_888)};
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputPreviewStreams,
- &previewThreshold));
- ASSERT_NE(0u, outputPreviewStreams.size());
-
- // Combine valid and invalid stream use cases
- std::vector<int64_t> useCases(kMandatoryUseCases);
- useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL + 1);
-
- std::vector<int64_t> supportedUseCases;
- camera_metadata_ro_entry entry;
- auto retcode = find_camera_metadata_ro_entry(staticMeta,
- ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, &entry);
- if ((0 == retcode) && (entry.count > 0)) {
- supportedUseCases.insert(supportedUseCases.end(), entry.data.i64,
- entry.data.i64 + entry.count);
- } else {
- supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT);
- }
- free_camera_metadata(staticMeta);
-
- ::android::hardware::hidl_vec<V3_8::Stream> streams3_8(1);
- streams3_8[0].v3_7.groupId = -1;
- streams3_8[0].v3_7.sensorPixelModesUsed = {
- CameraMetadataEnumAndroidSensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT};
- streams3_8[0].v3_7.v3_4.bufferSize = 0;
- streams3_8[0].v3_7.v3_4.v3_2.id = 0;
- streams3_8[0].v3_7.v3_4.v3_2.streamType = StreamType::OUTPUT;
- streams3_8[0].v3_7.v3_4.v3_2.width = static_cast<uint32_t>(outputPreviewStreams[0].width);
- streams3_8[0].v3_7.v3_4.v3_2.height = static_cast<uint32_t>(outputPreviewStreams[0].height);
- streams3_8[0].v3_7.v3_4.v3_2.format =
- static_cast<PixelFormat>(outputPreviewStreams[0].format);
- streams3_8[0].v3_7.v3_4.v3_2.usage = GRALLOC1_CONSUMER_USAGE_CPU_READ;
- streams3_8[0].v3_7.v3_4.v3_2.dataSpace = 0;
- streams3_8[0].v3_7.v3_4.v3_2.rotation = StreamRotation::ROTATION_0;
- streams3_8[0].dynamicRangeProfile =
- static_cast<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap>(
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD);
-
- uint32_t streamConfigCounter = 0;
- ::android::hardware::camera::device::V3_8::StreamConfiguration config3_8;
- RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE;
- ret = session3_8->constructDefaultRequestSettings(reqTemplate,
- [&config3_8](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- config3_8.sessionParams = req;
- });
- ASSERT_TRUE(ret.isOk());
-
- for (int64_t useCase : useCases) {
- bool useCaseSupported = std::find(supportedUseCases.begin(),
- supportedUseCases.end(), useCase) != supportedUseCases.end();
-
- streams3_8[0].useCase =
- static_cast<CameraMetadataEnumAndroidScalerAvailableStreamUseCases>(useCase);
- config3_8.streams = streams3_8;
- config3_8.operationMode = StreamConfigurationMode::NORMAL_MODE;
- config3_8.streamConfigCounter = streamConfigCounter;
- config3_8.multiResolutionInputImage = false;
- ret = cameraDevice3_8->isStreamCombinationSupported_3_8(
- config3_8, [&useCaseSupported](Status s, bool combStatus) {
- ASSERT_TRUE((Status::OK == s) || (Status::METHOD_NOT_SUPPORTED == s));
- if (Status::OK == s) {
- ASSERT_EQ(combStatus, useCaseSupported);
- }
- });
- ASSERT_TRUE(ret.isOk());
-
- ret = session3_8->configureStreams_3_8(
- config3_8,
- [&](Status s, device::V3_6::HalStreamConfiguration halConfig) {
- if (useCaseSupported) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- } else {
- ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
- }
- });
- ASSERT_TRUE(ret.isOk());
- }
- ret = session3_8->close();
- ASSERT_TRUE(ret.isOk());
- }
-}
-
// Retrieve all valid output stream resolutions from the camera
// static characteristics.
Status CameraHidlTest::getAvailableOutputStreams(const camera_metadata_t* staticMeta,
@@ -7736,9 +6974,8 @@
sp<device::V3_4::ICameraDeviceSession> session3_4;
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
- session3_7, &session3_8);
+ session3_7);
ASSERT_NE(nullptr, (*session3_7).get());
*useHalBufManager = false;
@@ -7786,8 +7023,7 @@
ASSERT_TRUE(deviceVersion >= CAMERA_DEVICE_API_VERSION_3_7);
sp<device::V3_5::ICameraDevice> cameraDevice3_5 = nullptr;
sp<device::V3_7::ICameraDevice> cameraDevice3_7 = nullptr;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8 = nullptr;
- castDevice(device3_x, deviceVersion, &cameraDevice3_5, &cameraDevice3_7, &cameraDevice3_8);
+ castDevice(device3_x, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
ASSERT_NE(cameraDevice3_7, nullptr);
bool supported = false;
ret = cameraDevice3_7->isStreamCombinationSupported_3_7(
@@ -7820,153 +7056,6 @@
ASSERT_TRUE(ret.isOk());
}
-// Configure streams
-void CameraHidlTest::configureStreams3_8(
- const std::string& name, int32_t deviceVersion, sp<ICameraProvider> provider,
- PixelFormat format, sp<device::V3_8::ICameraDeviceSession>* session3_8 /*out*/,
- V3_2::Stream* previewStream /*out*/,
- device::V3_6::HalStreamConfiguration* halStreamConfig /*out*/,
- bool* supportsPartialResults /*out*/, uint32_t* partialResultCount /*out*/,
- bool* useHalBufManager /*out*/, sp<DeviceCb>* outCb /*out*/, uint32_t streamConfigCounter,
- bool maxResolution,
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap prof) {
- ASSERT_NE(nullptr, session3_8);
- ASSERT_NE(nullptr, halStreamConfig);
- ASSERT_NE(nullptr, previewStream);
- ASSERT_NE(nullptr, supportsPartialResults);
- ASSERT_NE(nullptr, partialResultCount);
- ASSERT_NE(nullptr, useHalBufManager);
- ASSERT_NE(nullptr, outCb);
- ASSERT_TRUE(deviceVersion >= CAMERA_DEVICE_API_VERSION_3_8);
-
- std::vector<AvailableStream> outputStreams;
- ::android::sp<ICameraDevice> device3_x;
- ALOGI("configureStreams: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = provider->getCameraDeviceInterface_V3_x(name, [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_x = device;
- });
- ASSERT_TRUE(ret.isOk());
-
- camera_metadata_t* staticMeta;
- ret = device3_x->getCameraCharacteristics([&](Status s, CameraMetadata metadata) {
- ASSERT_EQ(Status::OK, s);
- staticMeta =
- clone_camera_metadata(reinterpret_cast<const camera_metadata_t*>(metadata.data()));
- ASSERT_NE(nullptr, staticMeta);
- });
- ASSERT_TRUE(ret.isOk());
-
- camera_metadata_ro_entry entry;
- auto status =
- find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry);
- if ((0 == status) && (entry.count > 0)) {
- *partialResultCount = entry.data.i32[0];
- *supportsPartialResults = (*partialResultCount > 1);
- }
-
- sp<DeviceCb> cb = new DeviceCb(this, deviceVersion, staticMeta);
- sp<ICameraDeviceSession> session;
- ret = device3_x->open(cb, [&session](auto status, const auto& newSession) {
- ALOGI("device::open returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(newSession, nullptr);
- session = newSession;
- });
- ASSERT_TRUE(ret.isOk());
- *outCb = cb;
-
- sp<device::V3_3::ICameraDeviceSession> session3_3;
- 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;
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
- &session3_7, session3_8);
- ASSERT_NE(nullptr, (*session3_8).get());
-
- *useHalBufManager = false;
- status = find_camera_metadata_ro_entry(
- staticMeta, ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
- if ((0 == status) && (entry.count == 1)) {
- *useHalBufManager = (entry.data.u8[0] ==
- ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
- }
-
- outputStreams.clear();
- Size maxSize;
- auto rc = getMaxOutputSizeForFormat(staticMeta, format, &maxSize, maxResolution);
- ASSERT_EQ(Status::OK, rc);
- free_camera_metadata(staticMeta);
-
- ::android::hardware::hidl_vec<V3_8::Stream> streams3_8(1);
- streams3_8[0].v3_7.groupId = -1;
- streams3_8[0].v3_7.sensorPixelModesUsed = {
- CameraMetadataEnumAndroidSensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT};
- streams3_8[0].v3_7.v3_4.bufferSize = 0;
- streams3_8[0].v3_7.v3_4.v3_2.id = 0;
- streams3_8[0].v3_7.v3_4.v3_2.streamType = StreamType::OUTPUT;
- streams3_8[0].v3_7.v3_4.v3_2.width = static_cast<uint32_t>(maxSize.width);
- streams3_8[0].v3_7.v3_4.v3_2.height = static_cast<uint32_t>(maxSize.height);
- streams3_8[0].v3_7.v3_4.v3_2.format = static_cast<PixelFormat>(format);
- streams3_8[0].v3_7.v3_4.v3_2.usage = GRALLOC1_CONSUMER_USAGE_CPU_READ;
- streams3_8[0].v3_7.v3_4.v3_2.dataSpace = 0;
- streams3_8[0].v3_7.v3_4.v3_2.rotation = StreamRotation::ROTATION_0;
- streams3_8[0].dynamicRangeProfile = prof;
-
- ::android::hardware::camera::device::V3_8::StreamConfiguration config3_8;
- config3_8.streams = streams3_8;
- config3_8.operationMode = StreamConfigurationMode::NORMAL_MODE;
- config3_8.streamConfigCounter = streamConfigCounter;
- config3_8.multiResolutionInputImage = false;
- RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE;
- ret = (*session3_8)
- ->constructDefaultRequestSettings(reqTemplate,
- [&config3_8](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- config3_8.sessionParams = req;
- });
- ASSERT_TRUE(ret.isOk());
-
- sp<device::V3_5::ICameraDevice> cameraDevice3_5 = nullptr;
- sp<device::V3_7::ICameraDevice> cameraDevice3_7 = nullptr;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8 = nullptr;
- castDevice(device3_x, deviceVersion, &cameraDevice3_5, &cameraDevice3_7, &cameraDevice3_8);
- ASSERT_NE(cameraDevice3_8, nullptr);
- bool supported = false;
- ret = cameraDevice3_8->isStreamCombinationSupported_3_8(
- config3_8, [&supported](Status s, bool combStatus) {
- ASSERT_TRUE((Status::OK == s) || (Status::METHOD_NOT_SUPPORTED == s));
- if (Status::OK == s) {
- supported = combStatus;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(supported, true);
-
- if (*session3_8 != nullptr) {
- ret = (*session3_8)
- ->configureStreams_3_8(
- config3_8,
- [&](Status s, device::V3_6::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- *halStreamConfig = halConfig;
- if (*useHalBufManager) {
- hidl_vec<V3_4::Stream> streams(1);
- hidl_vec<V3_2::HalStream> halStreams(1);
- streams[0] = streams3_8[0].v3_7.v3_4;
- halStreams[0] = halConfig.streams[0].v3_4.v3_3.v3_2;
- cb->setCurrentStreamConfig(streams, halStreams);
- }
- });
- }
- *previewStream = streams3_8[0].v3_7.v3_4.v3_2;
- ASSERT_TRUE(ret.isOk());
-}
-
// Configure multiple preview streams using different physical ids.
void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
@@ -8041,9 +7130,8 @@
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
- castSession(session, deviceVersion, &session3_3, session3_4, session3_5,
- &session3_6, &session3_7, &session3_8);
+ castSession(session, deviceVersion, &session3_3, session3_4, session3_5, &session3_6,
+ &session3_7);
ASSERT_NE(nullptr, (*session3_4).get());
*useHalBufManager = false;
@@ -8088,8 +7176,7 @@
if (allowUnsupport) {
sp<device::V3_5::ICameraDevice> cameraDevice3_5;
sp<device::V3_7::ICameraDevice> cameraDevice3_7;
- sp<device::V3_8::ICameraDevice> cameraDevice3_8;
- castDevice(device3_x, deviceVersion, &cameraDevice3_5, &cameraDevice3_7, &cameraDevice3_8);
+ castDevice(device3_x, deviceVersion, &cameraDevice3_5, &cameraDevice3_7);
bool supported = false;
ret = cameraDevice3_5->isStreamCombinationSupported(config3_4,
@@ -8282,95 +7369,6 @@
return false;
}
-void CameraHidlTest::get10BitDynamicRangeProfiles(const camera_metadata_t* staticMeta,
- std::vector<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap> *profiles) {
- ASSERT_NE(nullptr, staticMeta);
- ASSERT_NE(nullptr, profiles);
- camera_metadata_ro_entry entry;
- std::unordered_set<int64_t> entries;
- int rc = find_camera_metadata_ro_entry(staticMeta,
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, &entry);
- ASSERT_EQ(rc, 0);
- ASSERT_TRUE(entry.count > 0);
- ASSERT_EQ(entry.count % 3, 0);
-
- for (uint32_t i = 0; i < entry.count; i += 3) {
- ASSERT_NE(entry.data.i64[i],
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD);
- ASSERT_EQ(entries.find(entry.data.i64[i]), entries.end());
- entries.insert(entry.data.i64[i]);
- profiles->emplace_back(
- static_cast<CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap>
- (entry.data.i64[i]));
- }
-
- if (!entries.empty()) {
- ASSERT_NE(entries.find(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10),
- entries.end());
- }
-}
-
-bool CameraHidlTest::is10BitDynamicRangeCapable(const camera_metadata_t* staticMeta) {
- camera_metadata_ro_entry scalarEntry;
- int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
- &scalarEntry);
- if (rc == 0) {
- for (uint32_t i = 0; i < scalarEntry.count; i++) {
- if (scalarEntry.data.u8[i] ==
- ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT) {
- return true;
- }
- }
- }
- return false;
-}
-
-void CameraHidlTest::verify10BitMetadata(HandleImporter& importer,
- const InFlightRequest& request,
- CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap profile) {
- for (const auto& b : request.resultOutputBuffers) {
- bool smpte2086Present = importer.isSmpte2086Present(b.buffer.buffer.getNativeHandle());
- bool smpte2094_10Present = importer.isSmpte2094_10Present(
- b.buffer.buffer.getNativeHandle());
- bool smpte2094_40Present = importer.isSmpte2094_40Present(
- b.buffer.buffer.getNativeHandle());
-
- switch (static_cast<int64_t>(profile)) {
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10:
- ASSERT_FALSE(smpte2086Present);
- ASSERT_FALSE(smpte2094_10Present);
- ASSERT_FALSE(smpte2094_40Present);
- break;
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10:
- ASSERT_TRUE(smpte2086Present);
- ASSERT_FALSE(smpte2094_10Present);
- ASSERT_FALSE(smpte2094_40Present);
- break;
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS:
- ASSERT_FALSE(smpte2086Present);
- ASSERT_FALSE(smpte2094_10Present);
- ASSERT_TRUE(smpte2094_40Present);
- break;
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM:
- case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO:
- ASSERT_FALSE(smpte2086Present);
- ASSERT_TRUE(smpte2094_10Present);
- ASSERT_FALSE(smpte2094_40Present);
- break;
- default:
- ALOGE("%s: Unexpected 10-bit dynamic range profile: %" PRId64,
- __FUNCTION__, profile);
- ADD_FAILURE();
- }
- }
-}
-
bool CameraHidlTest::isDepthOnly(const camera_metadata_t* staticMeta) {
camera_metadata_ro_entry scalarEntry;
camera_metadata_ro_entry depthEntry;
@@ -8534,9 +7532,8 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
- castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
+ castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5, &session3_6,
+ &session3_7);
*useHalBufManager = false;
status = find_camera_metadata_ro_entry(staticMeta,
@@ -8667,19 +7664,11 @@
void CameraHidlTest::castDevice(const sp<device::V3_2::ICameraDevice>& device,
int32_t deviceVersion,
sp<device::V3_5::ICameraDevice>* device3_5 /*out*/,
- sp<device::V3_7::ICameraDevice>* device3_7 /*out*/,
- sp<device::V3_8::ICameraDevice>* device3_8 /*out*/) {
+ sp<device::V3_7::ICameraDevice>* device3_7 /*out*/) {
ASSERT_NE(nullptr, device3_5);
ASSERT_NE(nullptr, device3_7);
- ASSERT_NE(nullptr, device3_8);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8: {
- auto castResult = device::V3_8::ICameraDevice::castFrom(device);
- ASSERT_TRUE(castResult.isOk());
- *device3_8 = castResult;
- }
- [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_7: {
auto castResult = device::V3_7::ICameraDevice::castFrom(device);
ASSERT_TRUE(castResult.isOk());
@@ -8723,27 +7712,19 @@
}
//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*/,
- 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_7::ICameraDeviceSession> *session3_7 /*out*/,
- sp<device::V3_8::ICameraDeviceSession> *session3_8 /*out*/) {
+void CameraHidlTest::castSession(const sp<ICameraDeviceSession>& session, int32_t deviceVersion,
+ 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_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);
- ASSERT_NE(nullptr, session3_8);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_8: {
- auto castResult = device::V3_8::ICameraDeviceSession::castFrom(session);
- ASSERT_TRUE(castResult.isOk());
- *session3_8 = castResult;
- }
- [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_7: {
auto castResult = device::V3_7::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
@@ -9661,9 +8642,8 @@
sp<device::V3_5::ICameraDeviceSession> session3_5;
sp<device::V3_6::ICameraDeviceSession> session3_6;
sp<device::V3_7::ICameraDeviceSession> session3_7;
- sp<device::V3_8::ICameraDeviceSession> session3_8;
- castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5,
- &session3_6, &session3_7, &session3_8);
+ 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);
@@ -9905,7 +8885,7 @@
size_t CONFIG_ENTRY_TYPE_OFFSET = 3;
size_t CONFIG_ENTRY_BITFIELD_OFFSET = 4;
uint32_t maxPublicUsecase =
- ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END_3_8;
+ ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END;
uint32_t vendorUsecaseStart =
ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START;
uint32_t usecaseMask = (1 << vendorUsecaseStart) - 1;
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 462698c..fe03732 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -39,7 +39,7 @@
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination;
-using ::aidl::android::hardware::camera::provider::ICameraProviderCallbackDefault;
+using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback;
using ::ndk::ScopedAStatus;
@@ -86,7 +86,7 @@
// Test if ICameraProvider::setCallback returns Status::OK
TEST_P(CameraAidlTest, setCallback) {
- struct ProviderCb : public ICameraProviderCallbackDefault {
+ struct ProviderCb : public BnCameraProviderCallback {
ScopedAStatus cameraDeviceStatusChange(const std::string& cameraDeviceName,
CameraDeviceStatus newStatus) override {
ALOGI("camera device status callback name %s, status %d", cameraDeviceName.c_str(),
@@ -109,11 +109,11 @@
}
};
- std::shared_ptr<ProviderCb> cb = ProviderCb::make<ProviderCb>();
+ std::shared_ptr<ProviderCb> cb = ndk::SharedRefBase::make<ProviderCb>();
ScopedAStatus ret = mProvider->setCallback(cb);
ASSERT_TRUE(ret.isOk());
ret = mProvider->setCallback(nullptr);
- ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(static_cast<int32_t>(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError());
}
// Test if ICameraProvider::getCameraDeviceInterface returns Status::OK and non-null device
@@ -399,9 +399,6 @@
}
}
}
-
- ret = mProvider->setCallback(nullptr);
- ASSERT_TRUE(ret.isOk());
}
// Check dump functionality.
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index fd83e37..c11fc0c 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -55,26 +55,6 @@
using ::ndk::SpAIBinder;
namespace {
-bool matchDeviceName(const std::string& deviceName, const std::string& providerType,
- std::string* deviceVersion, std::string* cameraId) {
- // expected format: device@<major>.<minor>/<type>/<id>
- std::stringstream pattern;
- pattern << "device@[0-9]+\\.[0-9]+/" << providerType << "/(.+)";
- std::regex e(pattern.str());
-
- std::smatch sm;
- if (std::regex_match(deviceName, sm, e)) {
- if (deviceVersion != nullptr) {
- *deviceVersion = sm[1];
- }
- if (cameraId != nullptr) {
- *cameraId = sm[2];
- }
- return true;
- }
- return false;
-}
-
bool parseProviderName(const std::string& serviceDescriptor, std::string* type /*out*/,
uint32_t* id /*out*/) {
if (!type || !id) {
@@ -498,13 +478,11 @@
bool CameraAidlTest::matchDeviceName(const std::string& deviceName, const std::string& providerType,
std::string* deviceVersion, std::string* cameraId) {
- // "device@<version>/legacy/<id>"
- std::string pattern;
- pattern.append("device@([0-9]+\\.[0-9]+)/");
- pattern.append(providerType);
- pattern.append("/(.+)");
+ // expected format: device@<major>.<minor>/<type>/<id>
+ std::stringstream pattern;
+ pattern << "device@([0-9]+\\.[0-9]+)/" << providerType << "/(.+)";
+ std::regex e(pattern.str());
- std::regex e(pattern);
std::smatch sm;
if (std::regex_match(deviceName, sm, e)) {
if (deviceVersion != nullptr) {
@@ -1160,7 +1138,7 @@
}
std::string version, cameraId;
- ASSERT_TRUE(::matchDeviceName(cameraName, mProviderType, &version, &cameraId));
+ ASSERT_TRUE(matchDeviceName(cameraName, mProviderType, &version, &cameraId));
std::unordered_set<std::string> physicalIds;
rc = getPhysicalCameraIds(metadata, &physicalIds);
ASSERT_TRUE(isUltraHighResCamera || Status::OK == rc);
@@ -1192,7 +1170,7 @@
SystemCameraKind physSystemCameraKind = SystemCameraKind::PUBLIC;
for (auto& deviceName : deviceNames) {
std::string publicVersion, publicId;
- ASSERT_TRUE(::matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId));
+ ASSERT_TRUE(matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId));
if (physicalId == publicId) {
isPublicId = true;
fullPublicId = deviceName;
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index 7855b51..cf2c90d 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -19,6 +19,7 @@
#include "Gnss.h"
#include <inttypes.h>
#include <log/log.h>
+#include <utils/Timers.h>
#include "AGnss.h"
#include "AGnssRil.h"
#include "DeviceFileReader.h"
@@ -28,7 +29,6 @@
#include "GnssConfiguration.h"
#include "GnssDebug.h"
#include "GnssGeofence.h"
-#include "GnssMeasurementInterface.h"
#include "GnssNavigationMessageInterface.h"
#include "GnssPsds.h"
#include "GnssVisibilityControl.h"
@@ -95,6 +95,9 @@
}
mIsActive = true;
+ mThreadBlocker.reset();
+ // notify measurement engine to update measurement interval
+ mGnssMeasurementInterface->setLocationEnabled(true);
this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_BEGIN);
mThread = std::thread([this]() {
this->reportSvStatus();
@@ -102,8 +105,12 @@
std::this_thread::sleep_for(std::chrono::milliseconds(TTFF_MILLIS));
mFirstFixReceived = true;
}
- while (mIsActive == true) {
+ do {
+ if (!mIsActive) {
+ break;
+ }
this->reportSvStatus();
+ this->reportNmea();
auto currentLocation = getLocationFromHW();
mGnssPowerIndication->notePowerConsumption();
@@ -113,12 +120,29 @@
const auto location = Utils::getMockLocation();
this->reportLocation(location);
}
- std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMs));
- }
+ } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(mMinIntervalMs)));
});
return ScopedAStatus::ok();
}
+ScopedAStatus Gnss::stop() {
+ ALOGD("stop");
+ mIsActive = false;
+ mGnssMeasurementInterface->setLocationEnabled(false);
+ this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_END);
+ mThreadBlocker.notify();
+ if (mThread.joinable()) {
+ mThread.join();
+ }
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus Gnss::close() {
+ ALOGD("close");
+ sGnssCallback = nullptr;
+ return ScopedAStatus::ok();
+}
+
void Gnss::reportLocation(const GnssLocation& location) const {
std::unique_lock<std::mutex> lock(mMutex);
if (sGnssCallback == nullptr) {
@@ -153,7 +177,6 @@
std::vector<GnssSvInfo> Gnss::filterBlocklistedSatellites(
std::vector<GnssSvInfo> gnssSvInfoList) const {
- ALOGD("filterBlocklistedSatellites");
for (uint32_t i = 0; i < gnssSvInfoList.size(); i++) {
if (mGnssConfiguration->isBlocklisted(gnssSvInfoList[i])) {
gnssSvInfoList[i].svFlag &= ~(uint32_t)IGnssCallback::GnssSvFlags::USED_IN_FIX;
@@ -174,14 +197,19 @@
}
}
-ScopedAStatus Gnss::stop() {
- ALOGD("stop");
- mIsActive = false;
- this->reportGnssStatusValue(IGnssCallback::GnssStatusValue::SESSION_END);
- if (mThread.joinable()) {
- mThread.join();
+void Gnss::reportNmea() const {
+ if (mIsNmeaActive) {
+ std::unique_lock<std::mutex> lock(mMutex);
+ if (sGnssCallback == nullptr) {
+ ALOGE("%s: sGnssCallback is null.", __func__);
+ return;
+ }
+ nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+ auto status = sGnssCallback->gnssNmeaCb(now, "$TEST,0,1,2,3,4,5");
+ if (!status.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
- return ScopedAStatus::ok();
}
ScopedAStatus Gnss::startSvStatus() {
@@ -197,16 +225,12 @@
}
ScopedAStatus Gnss::startNmea() {
ALOGD("startNmea");
+ mIsNmeaActive = true;
return ScopedAStatus::ok();
}
ScopedAStatus Gnss::stopNmea() {
ALOGD("stopNmea");
- return ScopedAStatus::ok();
-}
-
-ScopedAStatus Gnss::close() {
- ALOGD("close");
- sGnssCallback = nullptr;
+ mIsNmeaActive = false;
return ScopedAStatus::ok();
}
@@ -249,7 +273,8 @@
ScopedAStatus Gnss::setPositionMode(const PositionModeOptions& options) {
ALOGD("setPositionMode. minIntervalMs:%d, lowPowerMode:%d", options.minIntervalMs,
(int)options.lowPowerMode);
- mMinIntervalMs = options.minIntervalMs;
+ mMinIntervalMs = std::max(1000, options.minIntervalMs);
+ mGnssMeasurementInterface->setLocationInterval(mMinIntervalMs);
return ScopedAStatus::ok();
}
@@ -283,8 +308,10 @@
ScopedAStatus Gnss::getExtensionGnssMeasurement(
std::shared_ptr<IGnssMeasurementInterface>* iGnssMeasurement) {
ALOGD("getExtensionGnssMeasurement");
-
- *iGnssMeasurement = SharedRefBase::make<GnssMeasurementInterface>();
+ if (mGnssMeasurementInterface == nullptr) {
+ mGnssMeasurementInterface = SharedRefBase::make<GnssMeasurementInterface>();
+ }
+ *iGnssMeasurement = mGnssMeasurementInterface;
return ScopedAStatus::ok();
}
diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h
index 1489b4b..df10fc8 100644
--- a/gnss/aidl/default/Gnss.h
+++ b/gnss/aidl/default/Gnss.h
@@ -32,7 +32,9 @@
#include <mutex>
#include <thread>
#include "GnssConfiguration.h"
+#include "GnssMeasurementInterface.h"
#include "GnssPowerIndication.h"
+#include "Utils.h"
namespace aidl::android::hardware::gnss {
@@ -84,6 +86,7 @@
std::shared_ptr<GnssConfiguration> mGnssConfiguration;
std::shared_ptr<GnssPowerIndication> mGnssPowerIndication;
+ std::shared_ptr<GnssMeasurementInterface> mGnssMeasurementInterface;
private:
void reportLocation(const GnssLocation&) const;
@@ -93,14 +96,17 @@
std::vector<IGnssCallback::GnssSvInfo> gnssSvInfoList) const;
void reportGnssStatusValue(const IGnssCallback::GnssStatusValue gnssStatusValue) const;
std::unique_ptr<GnssLocation> getLocationFromHW();
+ void reportNmea() const;
static std::shared_ptr<IGnssCallback> sGnssCallback;
std::atomic<long> mMinIntervalMs;
std::atomic<bool> mIsActive;
std::atomic<bool> mIsSvStatusActive;
+ std::atomic<bool> mIsNmeaActive;
std::atomic<bool> mFirstFixReceived;
std::thread mThread;
+ ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker;
mutable std::mutex mMutex;
};
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp
index 2c7241b..606de07 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.cpp
+++ b/gnss/aidl/default/GnssMeasurementInterface.cpp
@@ -33,10 +33,11 @@
std::shared_ptr<IGnssMeasurementCallback> GnssMeasurementInterface::sCallback = nullptr;
-GnssMeasurementInterface::GnssMeasurementInterface() : mMinIntervalMillis(1000) {}
+GnssMeasurementInterface::GnssMeasurementInterface()
+ : mIntervalMs(1000), mLocationIntervalMs(1000), mFutures(std::vector<std::future<void>>()) {}
GnssMeasurementInterface::~GnssMeasurementInterface() {
- stop();
+ waitForStoppingThreads();
}
ndk::ScopedAStatus GnssMeasurementInterface::setCallback(
@@ -44,8 +45,10 @@
const bool enableCorrVecOutputs) {
ALOGD("setCallback: enableFullTracking: %d enableCorrVecOutputs: %d", (int)enableFullTracking,
(int)enableCorrVecOutputs);
- std::unique_lock<std::mutex> lock(mMutex);
- sCallback = callback;
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+ }
if (mIsActive) {
ALOGW("GnssMeasurement callback already set. Resetting the callback...");
@@ -60,14 +63,16 @@
const std::shared_ptr<IGnssMeasurementCallback>& callback, const Options& options) {
ALOGD("setCallbackWithOptions: fullTracking:%d, corrVec:%d, intervalMs:%d",
(int)options.enableFullTracking, (int)options.enableCorrVecOutputs, options.intervalMs);
- std::unique_lock<std::mutex> lock(mMutex);
- sCallback = callback;
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = callback;
+ }
if (mIsActive) {
ALOGW("GnssMeasurement callback already set. Resetting the callback...");
stop();
}
- mMinIntervalMillis = options.intervalMs;
+ mIntervalMs = std::max(options.intervalMs, 1000);
start(options.enableCorrVecOutputs);
return ndk::ScopedAStatus::ok();
@@ -75,18 +80,35 @@
ndk::ScopedAStatus GnssMeasurementInterface::close() {
ALOGD("close");
- stop();
- std::unique_lock<std::mutex> lock(mMutex);
- sCallback = nullptr;
- mMinIntervalMillis = 1000;
+ if (mIsActive) {
+ stop();
+ }
+ {
+ std::unique_lock<std::mutex> lock(mMutex);
+ sCallback = nullptr;
+ }
+ mIntervalMs = 1000;
return ndk::ScopedAStatus::ok();
}
void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) {
ALOGD("start");
+
+ if (mIsActive) {
+ ALOGD("restarting since measurement has started");
+ stop();
+ }
+ // Wait for stopping previous thread.
+ waitForStoppingThreads();
+
mIsActive = true;
+ mThreadBlocker.reset();
mThread = std::thread([this, enableCorrVecOutputs]() {
- while (mIsActive == true) {
+ int intervalMs;
+ do {
+ if (!mIsActive) {
+ break;
+ }
std::string rawMeasurementStr = "";
if (ReplayUtils::hasGnssDeviceFile() &&
ReplayUtils::isGnssRawMeasurement(
@@ -103,15 +125,19 @@
auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs);
this->reportMeasurement(measurement);
}
- std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis));
- }
+ intervalMs =
+ (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs;
+ } while (mIsActive && mThreadBlocker.wait_for(std::chrono::milliseconds(intervalMs)));
});
- mThread.detach();
}
void GnssMeasurementInterface::stop() {
ALOGD("stop");
mIsActive = false;
+ mThreadBlocker.notify();
+ if (mThread.joinable()) {
+ mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); }));
+ }
}
void GnssMeasurementInterface::reportMeasurement(const GnssData& data) {
@@ -128,4 +154,21 @@
callbackCopy->gnssMeasurementCb(data);
}
+void GnssMeasurementInterface::setLocationInterval(const int intervalMs) {
+ mLocationIntervalMs = intervalMs;
+}
+
+void GnssMeasurementInterface::setLocationEnabled(const bool enabled) {
+ mLocationEnabled = enabled;
+}
+
+void GnssMeasurementInterface::waitForStoppingThreads() {
+ for (auto& future : mFutures) {
+ ALOGD("Stopping previous thread.");
+ future.wait();
+ ALOGD("Done stopping thread.");
+ }
+ mFutures.clear();
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h
index bf77806..bb08027 100644
--- a/gnss/aidl/default/GnssMeasurementInterface.h
+++ b/gnss/aidl/default/GnssMeasurementInterface.h
@@ -19,8 +19,10 @@
#include <aidl/android/hardware/gnss/BnGnssMeasurementCallback.h>
#include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
#include <atomic>
+#include <future>
#include <mutex>
#include <thread>
+#include "Utils.h"
namespace aidl::android::hardware::gnss {
@@ -35,15 +37,22 @@
ndk::ScopedAStatus setCallbackWithOptions(
const std::shared_ptr<IGnssMeasurementCallback>& callback,
const Options& options) override;
+ void setLocationInterval(const int intervalMs);
+ void setLocationEnabled(const bool enabled);
private:
void start(const bool enableCorrVecOutputs);
void stop();
void reportMeasurement(const GnssData&);
+ void waitForStoppingThreads();
- std::atomic<long> mMinIntervalMillis;
+ std::atomic<long> mIntervalMs;
+ std::atomic<long> mLocationIntervalMs;
std::atomic<bool> mIsActive;
+ std::atomic<bool> mLocationEnabled;
std::thread mThread;
+ std::vector<std::future<void>> mFutures;
+ ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker;
// Guarded by mMutex
static std::shared_ptr<IGnssMeasurementCallback> sCallback;
diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.cpp b/gnss/aidl/default/GnssNavigationMessageInterface.cpp
index 4bc859d..75b9624 100644
--- a/gnss/aidl/default/GnssNavigationMessageInterface.cpp
+++ b/gnss/aidl/default/GnssNavigationMessageInterface.cpp
@@ -32,7 +32,7 @@
GnssNavigationMessageInterface::GnssNavigationMessageInterface() : mMinIntervalMillis(1000) {}
GnssNavigationMessageInterface::~GnssNavigationMessageInterface() {
- stop();
+ waitForStoppingThreads();
}
ndk::ScopedAStatus GnssNavigationMessageInterface::setCallback(
@@ -46,7 +46,9 @@
ndk::ScopedAStatus GnssNavigationMessageInterface::close() {
ALOGD("close");
- stop();
+ if (mIsActive) {
+ stop();
+ }
std::unique_lock<std::mutex> lock(mMutex);
sCallback = nullptr;
return ndk::ScopedAStatus::ok();
@@ -54,9 +56,20 @@
void GnssNavigationMessageInterface::start() {
ALOGD("start");
+
+ if (mIsActive) {
+ ALOGD("restarting since nav msg has started");
+ stop();
+ }
+ // Wait for stopping previous thread.
+ waitForStoppingThreads();
+
mIsActive = true;
mThread = std::thread([this]() {
- while (mIsActive == true) {
+ do {
+ if (!mIsActive) {
+ break;
+ }
GnssNavigationMessage message = {
.svid = 19,
.type = GnssNavigationMessageType::GPS_L1CA,
@@ -66,15 +79,18 @@
.data = std::vector<uint8_t>(40, 0xF9),
};
this->reportMessage(message);
- std::this_thread::sleep_for(std::chrono::milliseconds(mMinIntervalMillis));
- }
+ } while (mIsActive &&
+ mThreadBlocker.wait_for(std::chrono::milliseconds(mMinIntervalMillis)));
});
- mThread.detach();
}
void GnssNavigationMessageInterface::stop() {
ALOGD("stop");
mIsActive = false;
+ mThreadBlocker.notify();
+ if (mThread.joinable()) {
+ mFutures.push_back(std::async(std::launch::async, [this] { mThread.join(); }));
+ }
}
void GnssNavigationMessageInterface::reportMessage(const GnssNavigationMessage& message) {
@@ -91,4 +107,13 @@
callbackCopy->gnssNavigationMessageCb(message);
}
+void GnssNavigationMessageInterface::waitForStoppingThreads() {
+ for (auto& future : mFutures) {
+ ALOGD("Stopping previous thread.");
+ future.wait();
+ ALOGD("Done stopping thread.");
+ }
+ mFutures.clear();
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/GnssNavigationMessageInterface.h b/gnss/aidl/default/GnssNavigationMessageInterface.h
index 600b23a..b335348 100644
--- a/gnss/aidl/default/GnssNavigationMessageInterface.h
+++ b/gnss/aidl/default/GnssNavigationMessageInterface.h
@@ -18,7 +18,9 @@
#include <aidl/android/hardware/gnss/BnGnssNavigationMessageInterface.h>
#include <atomic>
+#include <future>
#include <thread>
+#include "Utils.h"
namespace aidl::android::hardware::gnss {
@@ -34,10 +36,13 @@
void start();
void stop();
void reportMessage(const IGnssNavigationMessageCallback::GnssNavigationMessage& message);
+ void waitForStoppingThreads();
std::atomic<long> mMinIntervalMillis;
std::atomic<bool> mIsActive;
std::thread mThread;
+ std::vector<std::future<void>> mFutures;
+ ::android::hardware::gnss::common::ThreadBlocker mThreadBlocker;
// Guarded by mMutex
static std::shared_ptr<IGnssNavigationMessageCallback> sCallback;
diff --git a/gnss/aidl/vts/GnssCallbackAidl.cpp b/gnss/aidl/vts/GnssCallbackAidl.cpp
index 77a2506..2f6128b 100644
--- a/gnss/aidl/vts/GnssCallbackAidl.cpp
+++ b/gnss/aidl/vts/GnssCallbackAidl.cpp
@@ -31,7 +31,7 @@
}
Status GnssCallbackAidl::gnssStatusCb(const GnssStatusValue /* status */) {
- ALOGI("gnssSvStatusCb");
+ ALOGI("gnssStatusCb");
return Status::ok();
}
@@ -47,7 +47,8 @@
return Status::ok();
}
-Status GnssCallbackAidl::gnssNmeaCb(const int64_t /* timestamp */, const std::string& /* nmea */) {
+Status GnssCallbackAidl::gnssNmeaCb(const int64_t timestamp, const std::string& nmea) {
+ nmea_cbq_.store(std::make_pair(timestamp, nmea));
return Status::ok();
}
diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h
index 209728d..a9495ba 100644
--- a/gnss/aidl/vts/GnssCallbackAidl.h
+++ b/gnss/aidl/vts/GnssCallbackAidl.h
@@ -17,6 +17,7 @@
#pragma once
#include <android/hardware/gnss/BnGnssCallback.h>
+#include <utility>
#include "GnssCallbackEventQueue.h"
/* Callback class for data & Event. */
@@ -26,7 +27,8 @@
: capabilities_cbq_("capabilities"),
info_cbq_("system_info"),
location_cbq_("location"),
- sv_info_list_cbq_("sv_info"){};
+ sv_info_list_cbq_("sv_info"),
+ nmea_cbq_("nmea"){};
~GnssCallbackAidl(){};
android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
@@ -55,4 +57,6 @@
android::hardware::gnss::common::GnssCallbackEventQueue<
std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>>
sv_info_list_cbq_;
+ android::hardware::gnss::common::GnssCallbackEventQueue<std::pair<int64_t, std::string>>
+ nmea_cbq_;
};
\ No newline at end of file
diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
index c4fad7f..a553954 100644
--- a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
+++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp
@@ -24,12 +24,10 @@
android::binder::Status GnssMeasurementCallbackAidl::gnssMeasurementCb(const GnssData& gnssData) {
ALOGI("gnssMeasurementCb");
- ALOGI("elapsedRealtime: flags = %d, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf",
+ ALOGV("elapsedRealtime: flags = 0x%X, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf",
gnssData.elapsedRealtime.flags, gnssData.elapsedRealtime.timestampNs,
gnssData.elapsedRealtime.timeUncertaintyNs);
- for (const auto& measurement : gnssData.measurements) {
- ALOGI("measurement.receivedSvTimeInNs=%" PRId64, measurement.receivedSvTimeInNs);
- }
+
gnss_data_cbq_.store(gnssData);
return android::binder::Status::ok();
}
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index f184f81..407ac0c 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -18,15 +18,50 @@
#include "gnss_hal_test.h"
#include <hidl/ServiceManagement.h>
+#include <algorithm>
+#include <cmath>
#include "Utils.h"
+using android::hardware::gnss::GnssClock;
using android::hardware::gnss::GnssConstellationType;
+using android::hardware::gnss::GnssData;
using android::hardware::gnss::GnssLocation;
+using android::hardware::gnss::GnssMeasurement;
using android::hardware::gnss::IGnss;
using android::hardware::gnss::IGnssCallback;
+using android::hardware::gnss::IGnssMeasurementInterface;
using android::hardware::gnss::common::Utils;
using GnssConstellationTypeV2_0 = android::hardware::gnss::V2_0::GnssConstellationType;
+namespace {
+// The difference between the mean of the received intervals and the requested interval should not
+// be larger mInterval * ALLOWED_MEAN_ERROR_RATIO
+constexpr double ALLOWED_MEAN_ERROR_RATIO = 0.25;
+
+// The standard deviation computed for the deltas should not be bigger
+// than mInterval * ALLOWED_STDEV_ERROR_RATIO or MIN_STDEV_MS, whichever is higher.
+constexpr double ALLOWED_STDEV_ERROR_RATIO = 0.50;
+constexpr double MIN_STDEV_MS = 1000;
+
+double computeMean(std::vector<int>& deltas) {
+ long accumulator = 0;
+ for (auto& d : deltas) {
+ accumulator += d;
+ }
+ return accumulator / deltas.size();
+}
+
+double computeStdev(double mean, std::vector<int>& deltas) {
+ double accumulator = 0;
+ for (auto& d : deltas) {
+ double diff = d - mean;
+ accumulator += diff * diff;
+ }
+ return std::sqrt(accumulator / (deltas.size() - 1));
+}
+
+} // anonymous namespace
+
void GnssHalTest::SetUp() {
// Get AIDL handle
aidl_gnss_hal_ = android::waitForDeclaredService<IGnssAidl>(String16(GetParam().c_str()));
@@ -97,20 +132,26 @@
ASSERT_TRUE(status.isOk());
}
-bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec,
- const bool low_power_mode) {
+bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode,
+ const bool start_sv_status, const bool start_nmea) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckFirstLocation(min_interval_msec,
low_power_mode);
}
-
SetPositionMode(min_interval_msec, low_power_mode);
+
auto status = aidl_gnss_hal_->start();
EXPECT_TRUE(status.isOk());
- status = aidl_gnss_hal_->startSvStatus();
- EXPECT_TRUE(status.isOk());
+ if (start_sv_status) {
+ status = aidl_gnss_hal_->startSvStatus();
+ EXPECT_TRUE(status.isOk());
+ }
+ if (start_nmea) {
+ status = aidl_gnss_hal_->startNmea();
+ EXPECT_TRUE(status.isOk());
+ }
/*
* GnssLocationProvider support of AGPS SUPL & XtraDownloader is not available in VTS,
@@ -131,6 +172,12 @@
return false;
}
+bool GnssHalTest::StartAndCheckFirstLocation(const int min_interval_msec,
+ const bool low_power_mode) {
+ return StartAndCheckFirstLocation(min_interval_msec, low_power_mode,
+ /* start_sv_status= */ true, /* start_nmea= */ true);
+}
+
void GnssHalTest::StopAndClearLocations() {
ALOGD("StopAndClearLocations");
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -139,6 +186,8 @@
}
auto status = aidl_gnss_hal_->stopSvStatus();
EXPECT_TRUE(status.isOk());
+ status = aidl_gnss_hal_->stopNmea();
+ EXPECT_TRUE(status.isOk());
status = aidl_gnss_hal_->stop();
EXPECT_TRUE(status.isOk());
@@ -153,7 +202,8 @@
aidl_gnss_cb_->location_cbq_.reset();
}
-void GnssHalTest::StartAndCheckLocations(int count) {
+void GnssHalTest::StartAndCheckLocations(const int count, const bool start_sv_status,
+ const bool start_nmea) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
// Invoke the super method.
return GnssHalTestTemplate<IGnss_V2_1>::StartAndCheckLocations(count);
@@ -162,7 +212,8 @@
const int kLocationTimeoutSubsequentSec = 2;
const bool kLowPowerMode = false;
- EXPECT_TRUE(StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode));
+ EXPECT_TRUE(StartAndCheckFirstLocation(kMinIntervalMsec, kLowPowerMode, start_sv_status,
+ start_nmea));
for (int i = 1; i < count; i++) {
EXPECT_TRUE(aidl_gnss_cb_->location_cbq_.retrieve(aidl_gnss_cb_->last_location_,
@@ -177,6 +228,10 @@
}
}
+void GnssHalTest::StartAndCheckLocations(const int count) {
+ StartAndCheckLocations(count, /* start_sv_status= */ true, /* start_nmea= */ true);
+}
+
std::list<std::vector<IGnssCallback::GnssSvInfo>> GnssHalTest::convertToAidl(
const std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>>& sv_info_list) {
std::list<std::vector<IGnssCallback::GnssSvInfo>> aidl_sv_info_list;
@@ -313,3 +368,109 @@
return constellation_to_blocklist;
}
+
+void GnssHalTest::checkGnssMeasurementClockFields(const GnssData& measurement) {
+ Utils::checkElapsedRealtime(measurement.elapsedRealtime);
+ ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 &&
+ measurement.clock.gnssClockFlags <=
+ (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
+ GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
+ GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
+ GnssClock::HAS_DRIFT_UNCERTAINTY));
+}
+
+void GnssHalTest::checkGnssMeasurementFlags(const GnssMeasurement& measurement) {
+ ASSERT_TRUE(measurement.flags >= 0 &&
+ measurement.flags <=
+ (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY |
+ GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE |
+ GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY |
+ GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
+ GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
+ GnssMeasurement::HAS_SATELLITE_ISB |
+ GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY |
+ GnssMeasurement::HAS_SATELLITE_PVT |
+ GnssMeasurement::HAS_CORRELATION_VECTOR));
+}
+
+void GnssHalTest::checkGnssMeasurementFields(const GnssMeasurement& measurement,
+ const GnssData& data) {
+ checkGnssMeasurementFlags(measurement);
+ // Verify CodeType is valid.
+ ASSERT_NE(measurement.signalType.codeType, "");
+ // Verify basebandCn0DbHz is valid.
+ ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0);
+
+ if (((measurement.flags & GnssMeasurement::HAS_FULL_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB) > 0) &&
+ ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY) > 0)) {
+ GnssConstellationType referenceConstellation =
+ data.clock.referenceSignalTypeForIsb.constellation;
+ double carrierFrequencyHz = data.clock.referenceSignalTypeForIsb.carrierFrequencyHz;
+ std::string codeType = data.clock.referenceSignalTypeForIsb.codeType;
+
+ ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN &&
+ referenceConstellation <= GnssConstellationType::IRNSS);
+ ASSERT_TRUE(carrierFrequencyHz > 0);
+ ASSERT_NE(codeType, "");
+
+ ASSERT_TRUE(std::abs(measurement.fullInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.fullInterSignalBiasUncertaintyNs >= 0);
+ ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6);
+ ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0);
+ }
+}
+
+void GnssHalTest::startMeasurementWithInterval(
+ int intervalMs, const sp<IGnssMeasurementInterface>& iGnssMeasurement,
+ sp<GnssMeasurementCallbackAidl>& callback) {
+ ALOGD("Start requesting measurement at interval of %d millis.", intervalMs);
+ IGnssMeasurementInterface::Options options;
+ options.intervalMs = intervalMs;
+ auto status = iGnssMeasurement->setCallbackWithOptions(callback, options);
+ ASSERT_TRUE(status.isOk());
+}
+
+void GnssHalTest::collectMeasurementIntervals(const sp<GnssMeasurementCallbackAidl>& callback,
+ const int numMeasurementEvents,
+ const int timeoutSeconds,
+ std::vector<int>& deltasMs) {
+ int64_t lastElapsedRealtimeMillis = 0;
+ for (int i = 0; i < numMeasurementEvents; i++) {
+ GnssData lastGnssData;
+ ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, timeoutSeconds));
+ EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ ASSERT_TRUE(lastGnssData.measurements.size() > 0);
+
+ // Validity check GnssData fields
+ checkGnssMeasurementClockFields(lastGnssData);
+ for (const auto& measurement : lastGnssData.measurements) {
+ checkGnssMeasurementFields(measurement, lastGnssData);
+ }
+
+ long currentElapsedRealtimeMillis = lastGnssData.elapsedRealtime.timestampNs * 1e-6;
+ if (lastElapsedRealtimeMillis != 0) {
+ deltasMs.push_back(currentElapsedRealtimeMillis - lastElapsedRealtimeMillis);
+ }
+ lastElapsedRealtimeMillis = currentElapsedRealtimeMillis;
+ }
+}
+
+void GnssHalTest::assertMeanAndStdev(int intervalMs, std::vector<int>& deltasMs) {
+ double mean = computeMean(deltasMs);
+ double stdev = computeStdev(mean, deltasMs);
+ EXPECT_TRUE(std::abs(mean - intervalMs) <= intervalMs * ALLOWED_MEAN_ERROR_RATIO)
+ << "Test failed, because the mean of intervals is " << mean
+ << " millis. The test requires that abs(" << mean << " - " << intervalMs
+ << ") <= " << intervalMs * ALLOWED_MEAN_ERROR_RATIO
+ << " millis, when the requested interval is " << intervalMs << " millis.";
+
+ double maxStdev = std::max(MIN_STDEV_MS, intervalMs * ALLOWED_STDEV_ERROR_RATIO);
+ EXPECT_TRUE(stdev <= maxStdev)
+ << "Test failed, because the stdev of intervals is " << stdev
+ << " millis, which must be <= " << maxStdev
+ << " millis, when the requested interval is " << intervalMs << " millis.";
+ ALOGD("Mean of interval deltas in millis: %.1lf", mean);
+ ALOGD("Stdev of interval deltas in millis: %.1lf", stdev);
+}
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
index d479af3..645fc82 100644
--- a/gnss/aidl/vts/gnss_hal_test.h
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -25,6 +25,7 @@
#include <android/hardware/gnss/2.1/IGnss.h>
#include "GnssBatchingCallback.h"
#include "GnssCallbackAidl.h"
+#include "GnssMeasurementCallbackAidl.h"
#include "v2_1/gnss_hal_test_template.h"
using IGnss_V2_1 = android::hardware::gnss::V2_1::IGnss;
@@ -68,8 +69,11 @@
const bool check_speed);
void SetPositionMode(const int min_interval_msec, const bool low_power_mode);
bool StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode);
+ bool StartAndCheckFirstLocation(const int min_interval_msec, const bool low_power_mode,
+ const bool start_sv_status, const bool start_nmea);
void StopAndClearLocations();
- void StartAndCheckLocations(int count);
+ void StartAndCheckLocations(const int count);
+ void StartAndCheckLocations(const int count, const bool start_sv_status, const bool start_nmea);
android::hardware::gnss::GnssConstellationType startLocationAndGetNonGpsConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout);
@@ -85,6 +89,19 @@
sv_info_list,
const int min_observations);
+ void checkGnssMeasurementClockFields(const android::hardware::gnss::GnssData& measurement);
+ void checkGnssMeasurementFlags(const android::hardware::gnss::GnssMeasurement& measurement);
+ void checkGnssMeasurementFields(const android::hardware::gnss::GnssMeasurement& measurement,
+ const android::hardware::gnss::GnssData& data);
+ void startMeasurementWithInterval(
+ int intervalMillis,
+ const sp<android::hardware::gnss::IGnssMeasurementInterface>& iMeasurement,
+ sp<GnssMeasurementCallbackAidl>& callback);
+ void collectMeasurementIntervals(const sp<GnssMeasurementCallbackAidl>& callback,
+ const int numMeasurementEvents, const int timeoutSeconds,
+ std::vector<int>& deltaMs);
+ void assertMeanAndStdev(int intervalMillis, std::vector<int>& deltasMillis);
+
sp<IGnssAidl> aidl_gnss_hal_;
sp<GnssCallbackAidl> aidl_gnss_cb_; // Primary callback interface
};
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 54946fb..f926c40 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -28,7 +28,9 @@
#include <android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.h>
#include <android/hardware/gnss/visibility_control/IGnssVisibilityControl.h>
#include <cutils/properties.h>
+#include <utils/SystemClock.h>
#include <cmath>
+#include <utility>
#include "AGnssCallbackAidl.h"
#include "AGnssRilCallbackAidl.h"
#include "GnssAntennaInfoCallbackAidl.h"
@@ -376,58 +378,6 @@
}
}
-void CheckGnssMeasurementClockFields(const GnssData& measurement) {
- Utils::checkElapsedRealtime(measurement.elapsedRealtime);
- ASSERT_TRUE(measurement.clock.gnssClockFlags >= 0 &&
- measurement.clock.gnssClockFlags <=
- (GnssClock::HAS_LEAP_SECOND | GnssClock::HAS_TIME_UNCERTAINTY |
- GnssClock::HAS_FULL_BIAS | GnssClock::HAS_BIAS |
- GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
- GnssClock::HAS_DRIFT_UNCERTAINTY));
-}
-
-void CheckGnssMeasurementFlags(const GnssMeasurement& measurement) {
- ASSERT_TRUE(measurement.flags >= 0 &&
- measurement.flags <=
- (GnssMeasurement::HAS_SNR | GnssMeasurement::HAS_CARRIER_FREQUENCY |
- GnssMeasurement::HAS_CARRIER_CYCLES | GnssMeasurement::HAS_CARRIER_PHASE |
- GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY |
- GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
- GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
- GnssMeasurement::HAS_SATELLITE_ISB |
- GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY |
- GnssMeasurement::HAS_SATELLITE_PVT |
- GnssMeasurement::HAS_CORRELATION_VECTOR));
-}
-
-void CheckGnssMeasurementFields(const GnssMeasurement& measurement, const GnssData& data) {
- CheckGnssMeasurementFlags(measurement);
- // Verify CodeType is valid.
- ASSERT_NE(measurement.signalType.codeType, "");
- // Verify basebandCn0DbHz is valid.
- ASSERT_TRUE(measurement.basebandCN0DbHz > 0.0 && measurement.basebandCN0DbHz <= 65.0);
-
- if (((measurement.flags & GnssMeasurement::HAS_FULL_ISB) > 0) &&
- ((measurement.flags & GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY) > 0) &&
- ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB) > 0) &&
- ((measurement.flags & GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY) > 0)) {
- GnssConstellationType referenceConstellation =
- data.clock.referenceSignalTypeForIsb.constellation;
- double carrierFrequencyHz = data.clock.referenceSignalTypeForIsb.carrierFrequencyHz;
- std::string codeType = data.clock.referenceSignalTypeForIsb.codeType;
-
- ASSERT_TRUE(referenceConstellation >= GnssConstellationType::UNKNOWN &&
- referenceConstellation <= GnssConstellationType::IRNSS);
- ASSERT_TRUE(carrierFrequencyHz > 0);
- ASSERT_NE(codeType, "");
-
- ASSERT_TRUE(std::abs(measurement.fullInterSignalBiasNs) < 1.0e6);
- ASSERT_TRUE(measurement.fullInterSignalBiasUncertaintyNs >= 0);
- ASSERT_TRUE(std::abs(measurement.satelliteInterSignalBiasNs) < 1.0e6);
- ASSERT_TRUE(measurement.satelliteInterSignalBiasUncertaintyNs >= 0);
- }
-}
-
/*
* TestGnssMeasurementExtensionAndSatellitePvt:
* 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
@@ -465,10 +415,10 @@
ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
// Validity check GnssData fields
- CheckGnssMeasurementClockFields(lastMeasurement);
+ checkGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFields(measurement, lastMeasurement);
+ checkGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT &&
kIsSatellitePvtSupported == true) {
ALOGD("Found a measurement with SatellitePvt");
@@ -525,10 +475,10 @@
ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
// Validity check GnssData fields
- CheckGnssMeasurementClockFields(lastMeasurement);
+ checkGnssMeasurementClockFields(lastMeasurement);
for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFields(measurement, lastMeasurement);
+ checkGnssMeasurementFields(measurement, lastMeasurement);
if (measurement.flags & GnssMeasurement::HAS_CORRELATION_VECTOR) {
correlationVectorFound = true;
ASSERT_TRUE(measurement.correlationVectors.size() > 0);
@@ -1242,48 +1192,6 @@
}
/*
- * TestGnssMeasurementSetCallbackWithOptions:
- * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
- * 2. Sets a GnssMeasurementCallback with intervalMillis option, waits for measurements reported,
- * and verifies mandatory fields are valid.
- */
-TEST_P(GnssHalTest, TestGnssMeasurementSetCallbackWithOptions) {
- if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
- return;
- }
- const int kFirstGnssMeasurementTimeoutSeconds = 10;
- const int kNumMeasurementEvents = 5;
-
- sp<IGnssMeasurementInterface> iGnssMeasurement;
- auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
- ASSERT_TRUE(status.isOk());
- ASSERT_TRUE(iGnssMeasurement != nullptr);
-
- auto callback = sp<GnssMeasurementCallbackAidl>::make();
- IGnssMeasurementInterface::Options options;
- options.intervalMs = 2000;
- status = iGnssMeasurement->setCallbackWithOptions(callback, options);
- ASSERT_TRUE(status.isOk());
-
- for (int i = 0; i < kNumMeasurementEvents; i++) {
- GnssData lastMeasurement;
- ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
- kFirstGnssMeasurementTimeoutSeconds));
- EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
- ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
-
- // Validity check GnssData fields
- CheckGnssMeasurementClockFields(lastMeasurement);
- for (const auto& measurement : lastMeasurement.measurements) {
- CheckGnssMeasurementFields(measurement, lastMeasurement);
- }
- }
-
- status = iGnssMeasurement->close();
- ASSERT_TRUE(status.isOk());
-}
-
-/*
* TestGnssAgcInGnssMeasurement:
* 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension.
* 2. Sets a GnssMeasurementCallback, waits for a measurement.
@@ -1293,7 +1201,7 @@
return;
}
const int kFirstGnssMeasurementTimeoutSeconds = 10;
- const int kNumMeasurementEvents = 15;
+ const int kNumMeasurementEvents = 5;
sp<IGnssMeasurementInterface> iGnssMeasurement;
auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
@@ -1313,7 +1221,7 @@
ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
// Validity check GnssData fields
- CheckGnssMeasurementClockFields(lastMeasurement);
+ checkGnssMeasurementClockFields(lastMeasurement);
ASSERT_TRUE(lastMeasurement.gnssAgcs.size() > 0);
for (const auto& gnssAgc : lastMeasurement.gnssAgcs) {
@@ -1444,3 +1352,143 @@
Utils::getMockMeasurementCorrections_aidl());
ASSERT_TRUE(status.isOk());
}
+
+/*
+ * TestStopSvStatusAndNmea:
+ * 1. Call stopSvStatus and stopNmea.
+ * 2. Start location and verify that
+ * - no SvStatus is received.
+ * - no Nmea is received.
+ */
+TEST_P(GnssHalTest, TestStopSvStatusAndNmea) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+ auto status = aidl_gnss_hal_->stopSvStatus();
+ EXPECT_TRUE(status.isOk());
+ status = aidl_gnss_hal_->stopNmea();
+ EXPECT_TRUE(status.isOk());
+
+ int kLocationsToAwait = 5;
+ aidl_gnss_cb_->location_cbq_.reset();
+ aidl_gnss_cb_->sv_info_list_cbq_.reset();
+ aidl_gnss_cb_->nmea_cbq_.reset();
+ StartAndCheckLocations(/* count= */ kLocationsToAwait,
+ /* start_sv_status= */ false, /* start_nmea= */ false);
+ int location_called_count = aidl_gnss_cb_->location_cbq_.calledCount();
+ ALOGD("Observed %d GnssSvStatus, and %d Nmea while awaiting %d locations (%d received)",
+ aidl_gnss_cb_->sv_info_list_cbq_.size(), aidl_gnss_cb_->nmea_cbq_.size(),
+ kLocationsToAwait, location_called_count);
+
+ // Ensure that no SvStatus & no Nmea is received.
+ EXPECT_EQ(aidl_gnss_cb_->sv_info_list_cbq_.size(), 0);
+ EXPECT_EQ(aidl_gnss_cb_->nmea_cbq_.size(), 0);
+
+ StopAndClearLocations();
+}
+
+/*
+ * TestGnssMeasurementIntervals_WithoutLocation:
+ * 1. start measurement with interval
+ * 2. verify that the received measurement intervals have expected mean and stdev
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+
+ std::vector<int> intervals({2000, 4000});
+ std::vector<int> numEvents({10, 5});
+
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ ALOGD("TestGnssMeasurementIntervals_WithoutLocation");
+ for (int i = 0; i < intervals.size(); i++) {
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ startMeasurementWithInterval(intervals[i], iGnssMeasurement, callback);
+
+ std::vector<int> deltas;
+ collectMeasurementIntervals(callback, numEvents[i], /* timeoutSeconds= */ 10, deltas);
+
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+
+ assertMeanAndStdev(intervals[i], deltas);
+ }
+}
+
+/*
+ * TestGnssMeasurementIntervals_LocationOnBeforeMeasurement:
+ * 1. start measurement with interval
+ * 2. verify that the received measurement intervals have expected mean and stdev
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+
+ std::vector<int> intervals({2000});
+
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ int locationIntervalMs = 1000;
+
+ // Start location first and then start measurement
+ ALOGD("TestGnssMeasurementIntervals_LocationOnBeforeMeasurement");
+ StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false);
+ for (auto& intervalMs : intervals) {
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback);
+
+ std::vector<int> deltas;
+ collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas);
+
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+
+ assertMeanAndStdev(locationIntervalMs, deltas);
+ }
+ StopAndClearLocations();
+}
+
+/*
+ * TestGnssMeasurementIntervals:
+ * 1. start measurement with interval
+ * 2. verify that the received measurement intervals have expected mean and stdev
+ */
+TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
+ return;
+ }
+
+ std::vector<int> intervals({2000});
+
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ int locationIntervalMs = 1000;
+ // Start location first and then start measurement
+ ALOGD("TestGnssMeasurementIntervals_LocationOnAfterMeasurement");
+ for (auto& intervalMs : intervals) {
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback);
+
+ StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false);
+ std::vector<int> deltas;
+ collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas);
+
+ StopAndClearLocations();
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+
+ assertMeanAndStdev(locationIntervalMs, deltas);
+ }
+}
diff --git a/gnss/common/utils/default/include/Utils.h b/gnss/common/utils/default/include/Utils.h
index 7065a6fb..ad8f539 100644
--- a/gnss/common/utils/default/include/Utils.h
+++ b/gnss/common/utils/default/include/Utils.h
@@ -56,6 +56,31 @@
static hidl_vec<V2_1::IGnssAntennaInfoCallback::GnssAntennaInfo> getMockAntennaInfos();
};
+struct ThreadBlocker {
+ // returns false if unblocked:
+ template <class R, class P>
+ bool wait_for(std::chrono::duration<R, P> const& time) {
+ std::unique_lock<std::mutex> lock(m);
+ return !cv.wait_for(lock, time, [&] { return terminate; });
+ }
+
+ void notify() {
+ std::unique_lock<std::mutex> lock(m);
+ terminate = true;
+ cv.notify_all();
+ }
+
+ void reset() {
+ std::unique_lock<std::mutex> lock(m);
+ terminate = false;
+ }
+
+ private:
+ std::condition_variable cv;
+ std::mutex m;
+ bool terminate = false;
+};
+
} // namespace common
} // namespace gnss
} // namespace hardware
diff --git a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
index c9d058d..59af5cf 100644
--- a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
+++ b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp
@@ -153,7 +153,6 @@
if (error == EX_SERVICE_SPECIFIC) {
error = status.getServiceSpecificError();
EXPECT_NE(OK, error) << "Failed to set error properly";
- EXPECT_EQ(OK, error) << "Failed to allocate";
} else {
EXPECT_EQ(OK, error) << "Allocation transport failure";
}
@@ -278,6 +277,7 @@
if (!supported) {
ASSERT_EQ(nullptr, buffer.get())
<< "Allocation succeeded, but IMapper::isSupported was false";
+ GTEST_SKIP();
} else {
ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true";
}
@@ -319,6 +319,7 @@
if (!supported) {
ASSERT_EQ(nullptr, buffer.get())
<< "Allocation succeeded, but IMapper::isSupported was false";
+ GTEST_SKIP();
} else {
ASSERT_NE(nullptr, buffer.get()) << "Allocation failed, but IMapper::isSupported was true";
}
@@ -375,4 +376,4 @@
[](auto info) -> std::string {
std::string name = std::to_string(info.index) + "/" + std::get<2>(info.param).name;
return Sanitize(name);
- });
\ No newline at end of file
+ });
diff --git a/wifi/1.6/default/ringbuffer.cpp b/wifi/1.6/default/ringbuffer.cpp
index 6d4ed84..981bf7b 100644
--- a/wifi/1.6/default/ringbuffer.cpp
+++ b/wifi/1.6/default/ringbuffer.cpp
@@ -26,20 +26,26 @@
Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {}
-void Ringbuffer::append(const std::vector<uint8_t>& input) {
+enum Ringbuffer::AppendStatus Ringbuffer::append(const std::vector<uint8_t>& input) {
if (input.size() == 0) {
- return;
+ return AppendStatus::FAIL_IP_BUFFER_ZERO;
}
if (input.size() > maxSize_) {
LOG(INFO) << "Oversized message of " << input.size() << " bytes is dropped";
- return;
+ return AppendStatus::FAIL_IP_BUFFER_EXCEEDED_MAXSIZE;
}
data_.push_back(input);
size_ += input.size() * sizeof(input[0]);
while (size_ > maxSize_) {
+ if (data_.front().size() <= 0 || data_.front().size() > maxSize_) {
+ LOG(ERROR) << "First buffer in the ring buffer is Invalid. Size: "
+ << data_.front().size();
+ return AppendStatus::FAIL_RING_BUFFER_CORRUPTED;
+ }
size_ -= data_.front().size() * sizeof(data_.front()[0]);
data_.pop_front();
}
+ return AppendStatus::SUCCESS;
}
const std::list<std::vector<uint8_t>>& Ringbuffer::getData() const {
diff --git a/wifi/1.6/default/ringbuffer.h b/wifi/1.6/default/ringbuffer.h
index 8571a9f..c6a1e4c 100644
--- a/wifi/1.6/default/ringbuffer.h
+++ b/wifi/1.6/default/ringbuffer.h
@@ -31,11 +31,19 @@
*/
class Ringbuffer {
public:
+ // Error codes for the append ring buffer operation
+ enum AppendStatus {
+ SUCCESS,
+ FAIL_GENERIC,
+ FAIL_IP_BUFFER_ZERO,
+ FAIL_IP_BUFFER_EXCEEDED_MAXSIZE,
+ FAIL_RING_BUFFER_CORRUPTED
+ };
explicit Ringbuffer(size_t maxSize);
// Appends the data buffer and deletes from the front until buffer is
// within |maxSize_|.
- void append(const std::vector<uint8_t>& input);
+ enum AppendStatus append(const std::vector<uint8_t>& input);
const std::list<std::vector<uint8_t>>& getData() const;
void clear();
diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp
index f062409..c7c00b1 100644
--- a/wifi/1.6/default/wifi_chip.cpp
+++ b/wifi/1.6/default/wifi_chip.cpp
@@ -1613,6 +1613,7 @@
return;
}
WifiDebugRingBufferStatus hidl_status;
+ Ringbuffer::AppendStatus appendstatus;
if (!hidl_struct_util::convertLegacyDebugRingBufferStatusToHidl(status,
&hidl_status)) {
LOG(ERROR) << "Error converting ring buffer status";
@@ -1623,13 +1624,19 @@
const auto& target = shared_ptr_this->ringbuffer_map_.find(name);
if (target != shared_ptr_this->ringbuffer_map_.end()) {
Ringbuffer& cur_buffer = target->second;
- cur_buffer.append(data);
+ appendstatus = cur_buffer.append(data);
} else {
LOG(ERROR) << "Ringname " << name << " not found";
return;
}
// unique_lock unlocked here
}
+ if (appendstatus == Ringbuffer::AppendStatus::FAIL_RING_BUFFER_CORRUPTED) {
+ LOG(ERROR) << "Ringname " << name << " is corrupted. Clear the ring buffer";
+ shared_ptr_this->writeRingbufferFilesInternal();
+ return;
+ }
+
};
legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->registerRingBufferCallbackHandler(
getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback);
@@ -1971,6 +1978,11 @@
}
unique_fd file_auto_closer(dump_fd);
for (const auto& cur_block : cur_buffer.getData()) {
+ if (cur_block.size() <= 0 || cur_block.size() > kMaxBufferSizeBytes) {
+ PLOG(ERROR) << "Ring buffer: " << item.first
+ << " is corrupted. Invalid block size: " << cur_block.size();
+ break;
+ }
if (write(dump_fd, cur_block.data(), sizeof(cur_block[0]) * cur_block.size()) ==
-1) {
PLOG(ERROR) << "Error writing to file";