From 406da449098d5afb6812d600ba76ea2bb1c16ff9 Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Mon, 16 May 2022 21:10:06 +0000 Subject: [PATCH 01/53] Delete HIDL 3.8 - HIDL camera device@3.8, metadata@3.8 were temporary interfaces Bug: 221108824 Test: GCA Test: Camera CTS Change-Id: I44cd1ac0e2f6647e3e9d5c60a535faf716d5ed93 Signed-off-by: Jayant Chowdhary --- camera/device/3.8/Android.bp | 39 - camera/device/3.8/ICameraDevice.hal | 122 -- camera/device/3.8/ICameraDeviceCallback.hal | 34 - camera/device/3.8/ICameraDeviceSession.hal | 98 -- camera/device/3.8/types.hal | 157 --- camera/metadata/3.8/Android.bp | 27 - camera/metadata/3.8/types.hal | 244 ---- camera/provider/2.4/vts/functional/Android.bp | 2 - .../VtsHalCameraProviderV2_4TargetTest.cpp | 1178 ++--------------- 9 files changed, 79 insertions(+), 1822 deletions(-) delete mode 100644 camera/device/3.8/Android.bp delete mode 100644 camera/device/3.8/ICameraDevice.hal delete mode 100644 camera/device/3.8/ICameraDeviceCallback.hal delete mode 100644 camera/device/3.8/ICameraDeviceSession.hal delete mode 100644 camera/device/3.8/types.hal delete mode 100644 camera/metadata/3.8/Android.bp delete mode 100644 camera/metadata/3.8/types.hal diff --git a/camera/device/3.8/Android.bp b/camera/device/3.8/Android.bp deleted file mode 100644 index c3c29416a9..0000000000 --- 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 09edb8ba20..0000000000 --- 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 de0775d59f..0000000000 --- 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 msgs); -}; diff --git a/camera/device/3.8/ICameraDeviceSession.hal b/camera/device/3.8/ICameraDeviceSession.hal deleted file mode 100644 index c3aa836ec1..0000000000 --- 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 streamIds); -}; diff --git a/camera/device/3.8/types.hal b/camera/device/3.8/types.hal deleted file mode 100644 index 04a245085b..0000000000 --- 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 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 ead9543812..0000000000 --- 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 8cc6646799..0000000000 --- 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 - * - *

Partial documentation is included for each tag; for complete documentation, reference - * '/system/media/camera/docs/docs.html' in the corresponding Android source tree.

- */ -enum CameraMetadataTag : @3.7::CameraMetadataTag { - /** android.flash.info.strengthMaximumLevel [static, int32, public] - * - *

Maximum flashlight brightness level.

- */ - ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL = android.hardware.camera.metadata@3.2::CameraMetadataTag:ANDROID_FLASH_INFO_END, - - /** android.flash.info.strengthDefaultLevel [static, int32, public] - * - *

Default flashlight brightness level to be set via - * {android.hardware.camera2.CameraManager#turnOnTorchWithStrengthLevel}.

- */ - ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, - - ANDROID_FLASH_INFO_END_3_8, - - /** android.request.availableDynamicRangeProfilesMap [static, enum[], ndk_public] - * - *

A map of all available 10-bit dynamic range profiles along with their - * capture request constraints.

- */ - 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] - * - *

Recommended 10-bit dynamic range profile.

- */ - ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE, - - ANDROID_REQUEST_END_3_8, - - /** android.scaler.availableStreamUseCases [static, enum[], public] - * - *

The stream use cases supported by this camera device.

- */ - 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] - * - *

Location of the cameras on the automotive devices.

- */ - ANDROID_AUTOMOTIVE_LOCATION = CameraMetadataSectionStart:ANDROID_AUTOMOTIVE_START, - - ANDROID_AUTOMOTIVE_END_3_8, - - /** android.automotive.lens.facing [static, enum[], public] - * - *

The direction of the camera faces relative to the vehicle body frame and the - * passenger seats.

- */ - 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 2f24dfd503..85e69eb866 100644 --- a/camera/provider/2.4/vts/functional/Android.bp +++ b/camera/provider/2.4/vts/functional/Android.bp @@ -50,9 +50,7 @@ cc_test { "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 f89c71d241..6866776ba5 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 #include #include -#include #include -#include #include -#include -#include #include -#include #include #include #include @@ -134,10 +129,6 @@ using ::android::hardware::camera::metadata::V3_4:: 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 @@ const static std::vector kMandatoryUseCases = { namespace { // "device@/legacy/" - 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 @@ namespace { 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 @@ namespace { 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 @@ public: } virtual Return processCaptureResult_3_4( - const hidl_vec& /*results*/) override { + + const hidl_vec& /*results*/) override { ALOGI("processCaptureResult_3_4 callback"); ADD_FAILURE(); // Empty callback should not reach here return Void(); @@ -682,44 +668,41 @@ public: } }; - 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 processCaptureResult_3_4( - const hidl_vec& results) override; + Return processCaptureResult_3_4(const hidl_vec& results) override; Return processCaptureResult(const hidl_vec& results) override; Return notify(const hidl_vec& msgs) override; - Return notify_3_8(const hidl_vec& msgs) override; - Return requestStreamBuffers( - const hidl_vec& bufReqs, - requestStreamBuffers_cb _hidl_cb) override; + Return requestStreamBuffers(const hidl_vec& bufReqs, + requestStreamBuffers_cb _hidl_cb) override; Return returnStreamBuffers(const hidl_vec& buffers) override; void setCurrentStreamConfig(const hidl_vec& streams, - const hidl_vec& halStreams); + const hidl_vec& halStreams); void waitForBuffersReturned(); private: bool processCaptureResultLocked(const CaptureResult& results, - hidl_vec physicalCameraMetadata); + hidl_vec physicalCameraMetadata); Return notifyHelper(const hidl_vec& msgs, - const std::vector>& readoutTimestamps); + const std::vector>& 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 mStreams; + std::mutex mLock; // protecting members below + bool mUseHalBufManager = false; + hidl_vec mStreams; hidl_vec mHalStreams; uint64_t mNextBufferId = 1; using OutstandingBuffers = std::unordered_map; @@ -814,20 +797,18 @@ public: sp* provider2_5 /*out*/, sp* provider2_6 /*out*/, sp* provider2_7 /*out*/); - void castSession(const sp &session, int32_t deviceVersion, - sp *session3_3 /*out*/, - sp *session3_4 /*out*/, - sp *session3_5 /*out*/, - sp *session3_6 /*out*/, - sp *session3_7 /*out*/, - sp *session3_8 /*out*/); + void castSession(const sp& session, int32_t deviceVersion, + sp* session3_3 /*out*/, + sp* session3_4 /*out*/, + sp* session3_5 /*out*/, + sp* session3_6 /*out*/, + sp* session3_7 /*out*/); void castInjectionSession( const sp& session, sp* injectionSession3_7 /*out*/); void castDevice(const sp& device, int32_t deviceVersion, sp* device3_5 /*out*/, - sp* device3_7 /*out*/, - sp* device3_8 /*out*/); + sp* device3_7 /*out*/); void createStreamConfiguration( const ::android::hardware::hidl_vec& streams3_2, StreamConfigurationMode configMode, @@ -857,16 +838,6 @@ public: uint32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/, sp* outCb /*out*/, uint32_t streamConfigCounter, bool maxResolution); - void configureStreams3_8(const std::string& name, int32_t deviceVersion, - sp provider, PixelFormat format, - sp* 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* outCb /*out*/, uint32_t streamConfigCounter, - bool maxResolution, - CameraMetadataEnumAndroidRequestAvailableDynamicRangeProfilesMap prof); void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion, sp provider, @@ -947,9 +918,6 @@ public: 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 *profiles); - static bool is10BitDynamicRangeCapable(const camera_metadata_t* staticMeta); static Status getAvailableOutputStreams(const camera_metadata_t* staticMeta, std::vector& outputStreams, @@ -1130,10 +1098,6 @@ protected: 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 InFlightMap; @@ -1564,32 +1528,6 @@ void CameraHidlTest::DeviceCb::waitForBuffersReturned() { } } -Return CameraHidlTest::DeviceCb::notify_3_8( - const hidl_vec& msgs) { - hidl_vec msgs3_2; - std::vector> 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 CameraHidlTest::DeviceCb::notify( const hidl_vec& messages) { std::vector> readoutTimestamps; @@ -2082,7 +2020,6 @@ TEST_P(CameraHidlTest, getCameraDeviceInterface) { 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 @@ TEST_P(CameraHidlTest, getResourceCost) { 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 @@ TEST_P(CameraHidlTest, systemCameraTest) { 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 @@ TEST_P(CameraHidlTest, getCameraCharacteristics) { 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 @@ TEST_P(CameraHidlTest, getCameraCharacteristics) { } } -// Verify that the torch strength level can be set and retrieved successfully. -TEST_P(CameraHidlTest, turnOnTorchWithStrengthLevel) { - hidl_vec cameraDeviceNames = getCameraDeviceNames(mProvider); - bool torchControlSupported = false; - bool torchStrengthControlSupported = false; - Return 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 cb = new TorchProviderCb(this); - Return 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(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 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 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 @@ TEST_P(CameraHidlTest, setTorchMode) { 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 @@ TEST_P(CameraHidlTest, dumpState) { 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 @@ TEST_P(CameraHidlTest, openClose) { 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 @@ TEST_P(CameraHidlTest, openClose) { sp sessionV3_5; sp sessionV3_6; sp sessionV3_7; - sp 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 @@ TEST_P(CameraHidlTest, openClose) { 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 @@ TEST_P(CameraHidlTest, constructDefaultRequestSettings) { 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 @@ TEST_P(CameraHidlTest, configureStreamsAvailableOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureConcurrentStreamsAvailableOutputs) { openEmptyDeviceSession(name, mProvider2_6, &cti.session /*out*/, &cti.staticMeta /*out*/, &cti.cameraDevice /*out*/); castSession(cti.session, deviceVersion, &cti.session3_3, &cti.session3_4, - &cti.session3_5, &cti.session3_6, &cti.session3_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 @@ TEST_P(CameraHidlTest, configureStreamsInvalidOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureStreamsZSLInputOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureStreamsWithSessionParameters) { sp session3_5; sp session3_6; sp session3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureStreamsPreviewStillOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureStreamsConstrainedOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ TEST_P(CameraHidlTest, configureStreamsVideoStillOutputs) { sp session3_5; sp session3_6; sp session3_7; - sp session3_8; sp cameraDevice; sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, 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 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, ASSERT_EQ(Status::OK, status); ASSERT_EQ(numRequestProcessed, 1u); - if (deviceVersion >= CAMERA_DEVICE_API_VERSION_3_8) { - sp session3_3; - sp session3_4; - sp session3_5; - sp session3_6; - sp session3_7; - sp 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 streamIds = { halStreamConfig.streams[0].id }; - session3_8->repeatingRequestEnd(request.frameNumber, streamIds); - } - { std::unique_lock l(mLock); while (!inflightReq.errorCodeValid && @@ -5153,196 +4891,6 @@ void CameraHidlTest::processCaptureRequestInternal(uint64_t bufferUsage, } } -TEST_P(CameraHidlTest, processCaptureRequestPreviewStabilization) { - std::unordered_map 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& cameraDeviceToTimeLag) { - hidl_vec cameraDeviceNames = getCameraDeviceNames(mProvider); - AvailableStream streamThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, - static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; - uint64_t bufferId = 1; - uint32_t frameNumber = 1; - ::android::hardware::hidl_vec 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 session; - sp 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 resultQueue; - auto resultQueueRet = - session->getCaptureResultMetadataQueue([&resultQueue](const auto& descriptor) { - resultQueue = std::make_shared(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 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(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 outputBuffers = {outputBuffer}; - StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr, nullptr}; - CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings, emptyInputBuffer, - outputBuffers}; - - { - std::unique_lock l(mLock); - mInflightMap.clear(); - mInflightMap.add(frameNumber, &inflightReq); - } - - Status status = Status::INTERNAL_ERROR; - uint32_t numRequestProcessed = 0; - hidl_vec cachesToRemove; - Return 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 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 cameraDeviceNames = getCameraDeviceNames(mProvider); @@ -5771,188 +5319,6 @@ TEST_P(CameraHidlTest, processUltraHighResolutionRequest) { } } -// Generate and verify 10-bit dynamic range request -TEST_P(CameraHidlTest, process10BitDynamicRangeRequest) { - hidl_vec cameraDeviceNames = getCameraDeviceNames(mProvider); - uint64_t bufferId = 1; - uint32_t frameNumber = 1; - ::android::hardware::hidl_vec 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 ret; - sp session; - openEmptyDeviceSession(name, mProvider, &session, &staticMeta); - if (!is10BitDynamicRangeCapable(staticMeta)) { - free_camera_metadata(staticMeta); - ret = session->close(); - ASSERT_TRUE(ret.isOk()); - continue; - } - std::vector 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(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(const_cast(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 session3_8; - sp 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 resultQueue; - auto resultQueueRet = session3_8->getCaptureResultMetadataQueue( - [&resultQueue](const auto& descriptor) { - resultQueue = std::make_shared(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 graphicBuffers; - graphicBuffers.reserve(halStreamConfig.streams.size()); - ::android::hardware::hidl_vec outputBuffers; - outputBuffers.resize(halStreamConfig.streams.size()); - InFlightRequest inflightReq = {static_cast(halStreamConfig.streams.size()), - false, - supportsPartialResults, - partialResultCount, - std::unordered_set(), - 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 l(mLock); - mInflightMap.clear(); - mInflightMap.add(frameNumber, &inflightReq); - } - - Status stat = Status::INTERNAL_ERROR; - uint32_t numRequestProcessed = 0; - hidl_vec cachesToRemove; - Return 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 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 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 cameraDeviceNames = getCameraDeviceNames(mProvider); @@ -5982,8 +5348,8 @@ TEST_P(CameraHidlTest, processCaptureRequestBurstISO) { 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 @@ TEST_P(CameraHidlTest, configureInjectionStreamsWithSessionParameters) { } } -// Verify that valid stream use cases can be configured successfully, and invalid use cases -// fail stream configuration. -TEST_P(CameraHidlTest, configureStreamsUseCases) { - hidl_vec 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 ret; - sp session; - sp session3_3; - sp session3_4; - sp session3_5; - sp session3_6; - sp session3_7; - sp session3_8; - sp cameraDevice; - sp cameraDevice3_5; - sp cameraDevice3_7; - sp 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 outputPreviewStreams; - AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, - static_cast(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 useCases(kMandatoryUseCases); - useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL + 1); - - std::vector 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 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(outputPreviewStreams[0].width); - streams3_8[0].v3_7.v3_4.v3_2.height = static_cast(outputPreviewStreams[0].height); - streams3_8[0].v3_7.v3_4.v3_2.format = - static_cast(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( - 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(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 @@ void CameraHidlTest::configureStreams3_7( sp session3_4; sp session3_5; sp session3_6; - sp 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 @@ void CameraHidlTest::configureStreams3_7( ASSERT_TRUE(deviceVersion >= CAMERA_DEVICE_API_VERSION_3_7); sp cameraDevice3_5 = nullptr; sp cameraDevice3_7 = nullptr; - sp 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 @@ void CameraHidlTest::configureStreams3_7( ASSERT_TRUE(ret.isOk()); } -// Configure streams -void CameraHidlTest::configureStreams3_8( - const std::string& name, int32_t deviceVersion, sp provider, - PixelFormat format, sp* 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* 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 outputStreams; - ::android::sp device3_x; - ALOGI("configureStreams: Testing camera device %s", name.c_str()); - Return 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(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 cb = new DeviceCb(this, deviceVersion, staticMeta); - sp 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 session3_3; - sp session3_4; - sp session3_5; - sp session3_6; - sp 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 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(maxSize.width); - streams3_8[0].v3_7.v3_4.v3_2.height = static_cast(maxSize.height); - streams3_8[0].v3_7.v3_4.v3_2.format = static_cast(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 cameraDevice3_5 = nullptr; - sp cameraDevice3_7 = nullptr; - sp 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 streams(1); - hidl_vec 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 provider, @@ -8041,9 +7130,8 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t sp session3_3; sp session3_6; sp session3_7; - sp 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 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t if (allowUnsupport) { sp cameraDevice3_5; sp cameraDevice3_7; - sp 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 @@ bool CameraHidlTest::isUltraHighResolution(const camera_metadata_t* staticMeta) return false; } -void CameraHidlTest::get10BitDynamicRangeProfiles(const camera_metadata_t* staticMeta, - std::vector *profiles) { - ASSERT_NE(nullptr, staticMeta); - ASSERT_NE(nullptr, profiles); - camera_metadata_ro_entry entry; - std::unordered_set 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 - (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(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 @@ void CameraHidlTest::configureSingleStream( sp session3_5; sp session3_6; sp session3_7; - sp 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::configureSingleStream( void CameraHidlTest::castDevice(const sp& device, int32_t deviceVersion, sp* device3_5 /*out*/, - sp* device3_7 /*out*/, - sp* device3_8 /*out*/) { + sp* 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 @@ void CameraHidlTest::castProvider(const sp& provider, } //Cast camera device session to corresponding version -void CameraHidlTest::castSession(const sp &session, int32_t deviceVersion, - sp *session3_3 /*out*/, - sp *session3_4 /*out*/, - sp *session3_5 /*out*/, - sp *session3_6 /*out*/, - sp *session3_7 /*out*/, - sp *session3_8 /*out*/) { +void CameraHidlTest::castSession(const sp& session, int32_t deviceVersion, + sp* session3_3 /*out*/, + sp* session3_4 /*out*/, + sp* session3_5 /*out*/, + sp* session3_6 /*out*/, + sp* 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 @@ void CameraHidlTest::verifyBuffersReturned( sp session3_5; sp session3_6; sp session3_7; - sp 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 streamIds(1); @@ -9905,7 +8885,7 @@ void CameraHidlTest::verifyRecommendedConfigs(const CameraMetadata& chars) { 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; From 608655b45078e310fdc233b7dab325ac5abb9aae Mon Sep 17 00:00:00 2001 From: Simon Bowden Date: Wed, 1 Jun 2022 12:09:41 +0000 Subject: [PATCH 02/53] Use a shared ref for Vibrator when passed to a worker thread. To try to protect against this easy mistake, I removed the implicit capture from thread lambdas. Bug: 228523213 Test: atest Change-Id: I8fa37dacb4acf89848a8b17db8db317a988809d4 --- vibrator/aidl/default/Vibrator.cpp | 14 +++++++++----- vibrator/aidl/default/VibratorManager.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp index ddc6ee0d02..01602abffb 100644 --- a/vibrator/aidl/default/Vibrator.cpp +++ b/vibrator/aidl/default/Vibrator.cpp @@ -59,7 +59,10 @@ ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs, const std::shared_ptr& callback) { LOG(VERBOSE) << "Vibrator on for timeoutMs: " << timeoutMs; if (callback != nullptr) { - std::thread([=] { + // Note that thread lambdas aren't using implicit capture [=], to avoid capturing "this", + // which may be asynchronously destructed. + // If "this" is needed, use [sharedThis = this->ref()]. + std::thread([timeoutMs, callback] { LOG(VERBOSE) << "Starting on on another thread"; usleep(timeoutMs * 1000); LOG(VERBOSE) << "Notifying on complete"; @@ -87,7 +90,7 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength strength, constexpr size_t kEffectMillis = 100; if (callback != nullptr) { - std::thread([=] { + std::thread([callback] { LOG(VERBOSE) << "Starting perform on another thread"; usleep(kEffectMillis * 1000); LOG(VERBOSE) << "Notifying perform complete"; @@ -174,7 +177,8 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector& composi } } - std::thread([=] { + // The thread may theoretically outlive the vibrator, so take a proper reference to it. + std::thread([sharedThis = this->ref(), composite, callback] { LOG(VERBOSE) << "Starting compose on another thread"; for (auto& e : composite) { @@ -185,7 +189,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector& composi << e.scale; int32_t durationMs; - getPrimitiveDuration(e.primitive, &durationMs); + sharedThis->getPrimitiveDuration(e.primitive, &durationMs); usleep(durationMs * 1000); } @@ -396,7 +400,7 @@ ndk::ScopedAStatus Vibrator::composePwle(const std::vector &compo } } - std::thread([=] { + std::thread([totalDuration, callback] { LOG(VERBOSE) << "Starting composePwle on another thread"; usleep(totalDuration * 1000); if (callback != nullptr) { diff --git a/vibrator/aidl/default/VibratorManager.cpp b/vibrator/aidl/default/VibratorManager.cpp index 7cf9e6a5d8..26edf5a805 100644 --- a/vibrator/aidl/default/VibratorManager.cpp +++ b/vibrator/aidl/default/VibratorManager.cpp @@ -66,7 +66,7 @@ ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector& vi ndk::ScopedAStatus VibratorManager::triggerSynced( const std::shared_ptr& callback) { LOG(INFO) << "Vibrator Manager trigger synced"; - std::thread([=] { + std::thread([callback] { if (callback != nullptr) { LOG(INFO) << "Notifying perform complete"; callback->onComplete(); From 7d55d4269d5ec7247c00f9f1a84c33a6d6f53a00 Mon Sep 17 00:00:00 2001 From: Midas Chien Date: Tue, 7 Jun 2022 02:32:28 +0800 Subject: [PATCH 03/53] composer: vts: configure layer for DisplayDecoration Some HW may not support crop function for decoration and current API can't query this capability. Configure decoration layer to full screen to avoid this limitation. Bug: 225765061 Test: VtsHalGraphicsComposer3_TargetTest --gtest_filter=*DisplayDecoration* Change-Id: If47154adf9d48f9c1b8390b4bee090d8bf40ff3b --- .../composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 759bfecca3..047109e35f 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1719,10 +1719,10 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { } } + configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(), + display.getCrop()); mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, /*acquireFence*/ -1); - mWriter.setLayerCompositionType(display.getDisplayId(), layer, - Composition::DISPLAY_DECORATION); mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (support) { From 551bc88864bb4cefb3b79f8fbce7eeed05c5c01f Mon Sep 17 00:00:00 2001 From: seanhong Date: Thu, 9 Jun 2022 00:10:15 +0000 Subject: [PATCH 04/53] Add ENGINE_COOLANT_TEMP property for the emulator Test: atest CarPropertyManagerTest Bug: 231209215 Change-Id: Ic80ced50e9a59041d60da1968564a59ce5a2115f --- .../aidl/impl/default_config/include/DefaultConfig.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index e00f775a04..ff480e9bc2 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -713,6 +713,16 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}}, + {.config = + { + .prop = toInt(VehicleProperty::ENGINE_COOLANT_TEMP), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {75.0f}}}, + {.config = { .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), From 308f4ac90690febbac077c297302890772ada495 Mon Sep 17 00:00:00 2001 From: Midas Chien Date: Tue, 7 Jun 2022 02:32:28 +0800 Subject: [PATCH 05/53] composer: vts: configure layer for DisplayDecoration Some HW may not support crop function for decoration and current API can't query this capability. Configure decoration layer to full screen to avoid this limitation. Bug: 225765061 Test: VtsHalGraphicsComposer3_TargetTest --gtest_filter=*DisplayDecoration* Change-Id: If47154adf9d48f9c1b8390b4bee090d8bf40ff3b (cherry picked from commit 7d55d4269d5ec7247c00f9f1a84c33a6d6f53a00) Merged-In: If47154adf9d48f9c1b8390b4bee090d8bf40ff3b --- .../composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 759bfecca3..047109e35f 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1719,10 +1719,10 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { } } + configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(), + display.getCrop()); mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, /*acquireFence*/ -1); - mWriter.setLayerCompositionType(display.getDisplayId(), layer, - Composition::DISPLAY_DECORATION); mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (support) { From 6a553afeecd2625d09ef401005c860f32ae367a1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 15 Jun 2022 20:54:17 +0000 Subject: [PATCH 06/53] Add support for GSR property in HIDL ref VHAL. Test: Presubmit Bug: 236135569 Merged-In: I3788b66aa409304927e8f5af371c049cb1bcd58e (cherry-picked from I3788b66aa409304927e8f5af371c049cb1bcd58e) Change-Id: I3788b66aa409304927e8f5af371c049cb1bcd58e --- .../2.0/default/impl/vhal_v2_0/DefaultConfig.h | 13 +++++++++++++ .../impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index cfbbbd3224..e276a39314 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1109,6 +1109,19 @@ const ConfigDeclaration kVehicleProperties[]{ }, .initialValue = {.stringValue = {"Test"}}, }, + // This property is later defined in the AIDL VHAL interface. However, HIDL VHAL might + // require support for this property to meet EU regulation. + { + .config = + { + // GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT + .prop = 0x11400F47, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + // GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1 + .initialValue = {.int32Values = {1}}, + }, #ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // Vendor propetry for E2E ClusterHomeService testing. { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index e3c8dd6c79..d35792d4b2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)121, configs.size()); + EXPECT_EQ((size_t)122, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { From 073e68f29ff3522d820dc1bc3c720324555410bd Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Wed, 15 Jun 2022 01:06:09 +0000 Subject: [PATCH 07/53] Implemented EV_BATTERY_DISPLAY_UNITS Test: atest CarPropertyManagerTest Bug: 232859264 Change-Id: I8a3663f345a08b88e0047cd1211eb99978e4ded9 --- .../aidl/impl/default_config/include/DefaultConfig.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index ff480e9bc2..3319f724d6 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -171,6 +171,17 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, + {.config = + { + .prop = toInt(VehicleProperty::EV_BATTERY_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::WATT_HOUR), + toInt(VehicleUnit::AMPERE_HOURS), + toInt(VehicleUnit::KILOWATT_HOUR)}, + }, + .initialValue = {.int32Values = {toInt(VehicleUnit::KILOWATT_HOUR)}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From f234fe48bf06c81eb1560568845b9c3f14ff9756 Mon Sep 17 00:00:00 2001 From: Nishtha Ahuja Date: Thu, 24 Mar 2022 02:42:47 +0000 Subject: [PATCH 08/53] Add value for FUEL_VOLUME_DISPLAY_UNITS in default config. Bug: 232859264 Fix: 221916124 Test: Tested manually in KitchenSink app Change-Id: I8c0bf768210037f655d76848d8b4aadf047838f3 (cherry picked from commit fccd300be6370ebcf07bb6457e8f97161cc56096) --- .../aidl/impl/default_config/include/DefaultConfig.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index ff480e9bc2..109626d4d8 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -458,6 +458,15 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {0}}}, + {.config = + { + .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, + }, + .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + {.config = { .prop = toInt(VehicleProperty::HW_KEY_INPUT), From 6973e79b917ff1b7b0febddee69dd245f4222b22 Mon Sep 17 00:00:00 2001 From: Arun Johnson Date: Fri, 24 Jun 2022 18:17:00 +0000 Subject: [PATCH 09/53] Allowing OMX.google* codecs for Devices launching with S S AOSP did not remove the OMX.google* codecs, so this cannot be enforced for devices launching with S bug: 230582620 Change-Id: I25e8f827645db8e83c8c3142f5e76a912fdf7b22 --- .../store/VtsHalMediaOmxV1_0TargetStoreTest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp index 2ae9c2b001..00e9837710 100755 --- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp +++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp @@ -400,9 +400,18 @@ TEST_P(StoreHidlTest, OmxCodecAllowedTest) { << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android T and above"; } else { - ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__) + std::string codecName = info.mName; + bool isAndroidCodec = (codecName.rfind("OMX.google", 0) != std::string::npos); + if (isAndroidCodec && (getFirstApiLevel() <= __ANDROID_API_S__)) { + // refer b/230582620 + // S AOSP build did not remove the OMX.google video codecs + // so it is infeasible to require no OMX.google.* video codecs + // on S launching devices + } else { + ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__) << " Component: " << info.mName.c_str() << " Role: " << role.c_str() << " not allowed for devices launching with Android S and above"; + } } } if (role.find("audio_decoder") != std::string::npos || From 14b6d3acf9556e6253d03e1e3edc858f636f474b Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 27 Jun 2022 21:58:28 +0000 Subject: [PATCH 10/53] Remove FOG_LIGHTS_STATE from the emulator for the CTS test FOG_LIGHTS_STATE should not be implemented when FRONT_FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE is implemented. Test: atest CarPropertyManagerTest Bug: 233789475 Change-Id: I396ad9410265df4003fddcc244605519f6f5e88a --- .../aidl/impl/default_config/include/DefaultConfig.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index ff480e9bc2..83d148ac0f 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -892,14 +892,6 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - {.config = - { - .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - {.config = { .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_STATE), From 4be58ff1de78c99dd01c036732b9eb4814c7d84a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 27 Jun 2022 21:59:48 +0000 Subject: [PATCH 11/53] Add EventMode to VehiclePropertyStore writeValue. Add an option to specify whether to trigger onpropertychange callback when VehiclePropertyStore.writeValue is called. Test: atest VehiclePropertyStoreTest Bug: 237318964 Change-Id: Iefd572c96f67dab2ecd5de56acf2e0d1c9b58939 --- .../hardware/src/FakeVehicleHardware.cpp | 23 ++++--- .../common/include/VehiclePropertyStore.h | 31 +++++++++- .../utils/common/src/VehiclePropertyStore.cpp | 10 ++- .../common/test/VehiclePropertyStoreTest.cpp | 61 +++++++++++++++++++ 4 files changed, 110 insertions(+), 15 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index b64c1a65cc..20c34aa12e 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -217,17 +217,16 @@ VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropVal [[fallthrough]]; case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL): // CPMS is in WAIT_FOR_VHAL state, simply move to ON and send back to HAL. - // Must erase existing state because in the case when Car Service crashes, the power - // state would already be ON when we receive WAIT_FOR_VHAL and thus new property change - // event would be generated. However, Car Service always expect a property change event - // even though there is not actual state change. - mServerSidePropStore->removeValuesForProperty( - toInt(VehicleProperty::AP_POWER_STATE_REQ)); prop = createApPowerStateReq(VehicleApPowerStateReq::ON); - // ALWAYS update status for generated property value + // ALWAYS update status for generated property value, and force a property update event + // because in the case when Car Service crashes, the power state would already be ON + // when we receive WAIT_FOR_VHAL and thus new property change event would be generated. + // However, Car Service always expect a property change event even though there is no + // actual state change. if (auto writeResult = - mServerSidePropStore->writeValue(std::move(prop), /*updateStatus=*/true); + mServerSidePropStore->writeValue(std::move(prop), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); !writeResult.ok()) { return StatusError(getErrorCode(writeResult)) << "failed to write AP_POWER_STATE_REQ into property store, error: " @@ -894,10 +893,10 @@ StatusCode FakeVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, return; } result.value()->timestamp = elapsedRealtimeNano(); - // Must remove the value before writing, otherwise, we would generate no update event since - // the value is the same. - mServerSidePropStore->removeValue(*result.value()); - mServerSidePropStore->writeValue(std::move(result.value())); + // For continuous properties, we must generate a new onPropertyChange event periodically + // according to the sample rate. + mServerSidePropStore->writeValue(std::move(result.value()), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); }); mRecurrentTimer->registerTimerCallback(interval, action); mRecurrentActions[propIdAreaId] = action; diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h index ddc4f684aa..3d25cd3a41 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehiclePropertyStore.h @@ -46,6 +46,33 @@ class VehiclePropertyStore final { using ValueResultType = VhalResult; using ValuesResultType = VhalResult>; + enum class EventMode : uint8_t { + /** + * Only invoke OnValueChangeCallback if the new property value (ignoring timestamp) is + * different than the existing value. + * + * This should be used for regular cases. + */ + ON_VALUE_CHANGE, + /** + * Always invoke OnValueChangeCallback. + * + * This should be used for the special properties that are used for delivering event, e.g. + * HW_KEY_INPUT. + */ + ALWAYS, + /** + * Never invoke OnValueChangeCallback. + * + * This should be used for continuous property subscription when the sample rate for the + * subscription is smaller than the refresh rate for the property. E.g., the vehicle speed + * is refreshed at 20hz, but we are only subscribing at 10hz. In this case, we want to + * generate the property change event at 10hz, not 20hz, but we still want to refresh the + * timestamp (via writeValue) at 20hz. + */ + NEVER, + }; + explicit VehiclePropertyStore(std::shared_ptr valuePool) : mValuePool(valuePool) {} @@ -72,8 +99,10 @@ class VehiclePropertyStore final { // 'status' would be initialized to {@code VehiclePropertyStatus::AVAILABLE}, if this is to // override an existing value, the status for the existing value would be used for the // overridden value. + // 'EventMode' controls whether the 'OnValueChangeCallback' will be called for this operation. VhalResult writeValue(VehiclePropValuePool::RecyclableType propValue, - bool updateStatus = false); + bool updateStatus = false, + EventMode mode = EventMode::ON_VALUE_CHANGE); // Remove a given property value from the property store. The 'propValue' would be used to // generate the key for the value to remove. diff --git a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp index c8fb994684..646dc0e618 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/VehiclePropertyStore.cpp @@ -106,7 +106,8 @@ void VehiclePropertyStore::registerProperty(const VehiclePropConfig& config, } VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::RecyclableType propValue, - bool updateStatus) { + bool updateStatus, + VehiclePropertyStore::EventMode eventMode) { std::scoped_lock g(mLock); int32_t propId = propValue->prop; @@ -145,7 +146,12 @@ VhalResult VehiclePropertyStore::writeValue(VehiclePropValuePool::Recyclab } record->values[recId] = std::move(propValue); - if (valueUpdated && mOnValueChangeCallback != nullptr) { + + if (eventMode == EventMode::NEVER) { + return {}; + } + + if ((eventMode == EventMode::ALWAYS || valueUpdated) && mOnValueChangeCallback != nullptr) { mOnValueChangeCallback(*(record->values[recId])); } return {}; diff --git a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp index 4d6f811795..fea5034db9 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/VehiclePropertyStoreTest.cpp @@ -448,6 +448,67 @@ TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackNoUpdate) { ASSERT_EQ(updatedValue.prop, INVALID_PROP_ID); } +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackNoUpdateForTimestampChange) { + VehiclePropValue updatedValue{ + .prop = INVALID_PROP_ID, + }; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + + // Write the same value with different timestamp should succeed but should not trigger callback. + fuelCapacity.timestamp = 1; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + ASSERT_EQ(updatedValue.prop, INVALID_PROP_ID); +} + +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackForceUpdate) { + VehiclePropValue updatedValue{ + .prop = INVALID_PROP_ID, + }; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + + fuelCapacity.timestamp = 1; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), /*updateStatus=*/false, + VehiclePropertyStore::EventMode::ALWAYS)); + + ASSERT_EQ(updatedValue, fuelCapacity); +} + +TEST_F(VehiclePropertyStoreTest, testPropertyChangeCallbackForceNoUpdate) { + VehiclePropValue updatedValue{ + .prop = INVALID_PROP_ID, + }; + VehiclePropValue fuelCapacity = { + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .value = {.floatValues = {1.0}}, + }; + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity))); + + mStore->setOnValueChangeCallback( + [&updatedValue](const VehiclePropValue& value) { updatedValue = value; }); + fuelCapacity.value.floatValues[0] = 2.0; + fuelCapacity.timestamp = 1; + + ASSERT_RESULT_OK(mStore->writeValue(mValuePool->obtain(fuelCapacity), /*updateStatus=*/false, + VehiclePropertyStore::EventMode::NEVER)); + + ASSERT_EQ(updatedValue.prop, INVALID_PROP_ID); +} + } // namespace vehicle } // namespace automotive } // namespace hardware From f16c6d3a5741768356159f099d04bfe2219c81fe Mon Sep 17 00:00:00 2001 From: jiabin Date: Thu, 7 Jul 2022 18:13:45 +0000 Subject: [PATCH 12/53] Fix array out of bound in audioTransportToHal. The number of audio profile and extra audio descriptor must not be greater than the maximum value. Bug: 237288416 Bug: 237717857 Test: repo step in bug Test: atest android.hardware.audio.common@7.0-util_tests Change-Id: I1fcfa29d7841a1cb73bafb1ea92f3b1630992ae9 Merged-In: I1fcfa29d7841a1cb73bafb1ea92f3b1630992ae9 (cherry picked from commit 0ee75ca925f6334741d3e34c5e1d1b0efae5943b) --- .../all-versions/default/7.0/HidlUtils.cpp | 5 ++- .../default/tests/hidlutils_tests.cpp | 42 +++++++++++++++---- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/audio/common/all-versions/default/7.0/HidlUtils.cpp b/audio/common/all-versions/default/7.0/HidlUtils.cpp index 5a5b5d276a..af29da61f3 100644 --- a/audio/common/all-versions/default/7.0/HidlUtils.cpp +++ b/audio/common/all-versions/default/7.0/HidlUtils.cpp @@ -894,7 +894,7 @@ status_t HidlUtils::audioTransportsToHal(const hidl_vec& transpo for (const auto& transport : transports) { switch (transport.audioCapability.getDiscriminator()) { case AudioTransport::AudioCapability::hidl_discriminator::profile: - if (halPort->num_audio_profiles > AUDIO_PORT_MAX_AUDIO_PROFILES) { + if (halPort->num_audio_profiles >= AUDIO_PORT_MAX_AUDIO_PROFILES) { ALOGE("%s, too many audio profiles", __func__); result = BAD_VALUE; break; @@ -910,7 +910,8 @@ status_t HidlUtils::audioTransportsToHal(const hidl_vec& transpo result); break; case AudioTransport::AudioCapability::hidl_discriminator::edid: - if (halPort->num_extra_audio_descriptors > AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS) { + if (halPort->num_extra_audio_descriptors >= + AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS) { ALOGE("%s, too many extra audio descriptors", __func__); result = BAD_VALUE; break; diff --git a/audio/common/all-versions/default/tests/hidlutils_tests.cpp b/audio/common/all-versions/default/tests/hidlutils_tests.cpp index c9e6fac7b2..33ed3b99bb 100644 --- a/audio/common/all-versions/default/tests/hidlutils_tests.cpp +++ b/audio/common/all-versions/default/tests/hidlutils_tests.cpp @@ -954,6 +954,18 @@ TEST(HidlUtils, ConvertAudioPortConfig) { EXPECT_TRUE(audio_port_configs_are_equal(&halConfig, &halConfigBack)); } +static AudioProfile generateValidAudioProfile() { + AudioProfile profile; + profile.format = toString(xsd::AudioFormat::AUDIO_FORMAT_PCM_16_BIT); + profile.sampleRates.resize(2); + profile.sampleRates[0] = 44100; + profile.sampleRates[1] = 48000; + profile.channelMasks.resize(2); + profile.channelMasks[0] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_MONO); + profile.channelMasks[1] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO); + return profile; +} + TEST(HidlUtils, ConvertInvalidAudioTransports) { hidl_vec invalid; struct audio_port_v7 halInvalid = {}; @@ -973,20 +985,32 @@ TEST(HidlUtils, ConvertInvalidAudioTransports) { invalid[0].audioCapability.edid(hidl_vec(EXTRA_AUDIO_DESCRIPTOR_SIZE + 1)); invalid[1].encapsulationType = "random string"; EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); + + // The size of audio profile must not be greater than the maximum value. + invalid.resize(0); + invalid.resize(AUDIO_PORT_MAX_AUDIO_PROFILES + 1); + for (size_t i = 0; i < invalid.size(); ++i) { + invalid[i].audioCapability.profile(generateValidAudioProfile()); + invalid[i].encapsulationType = + toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_NONE); + } + EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); + + // The size of extra audio descriptors must not be greater than the maximum value. + invalid.resize(0); + invalid.resize(AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS + 1); + for (size_t i = 0; i < invalid.size(); ++i) { + invalid[i].audioCapability.edid({0x11, 0x06, 0x01}); + invalid[i].encapsulationType = + toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_IEC61937); + } + EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); } TEST(HidlUtils, ConvertAudioTransports) { hidl_vec transports; transports.resize(2); - AudioProfile profile; - profile.format = toString(xsd::AudioFormat::AUDIO_FORMAT_PCM_16_BIT); - profile.sampleRates.resize(2); - profile.sampleRates[0] = 44100; - profile.sampleRates[1] = 48000; - profile.channelMasks.resize(2); - profile.channelMasks[0] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_MONO); - profile.channelMasks[1] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO); - transports[0].audioCapability.profile(profile); + transports[0].audioCapability.profile(generateValidAudioProfile()); hidl_vec shortAudioDescriptor({0x11, 0x06, 0x01}); transports[0].encapsulationType = toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_NONE); From a2bdec821d7d5c86471cd4801892467cc284ca39 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Thu, 7 Jul 2022 23:43:05 +0000 Subject: [PATCH 13/53] Added FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME Test: atest CarPropertyManagerTest Bug: 238367528 Change-Id: If9f4fab38ce47d6e2d463cca3e5eeb909866bf89 --- .../aidl/impl/default_config/include/DefaultConfig.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index fc9ed47be3..4e284e8bd0 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -478,6 +478,15 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + {.config = + { + .prop = toInt( + VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {1}}}, + {.config = { .prop = toInt(VehicleProperty::HW_KEY_INPUT), From 4f110343d667159f85df5c2b787a9e9a5349bcbe Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 7 Jul 2022 20:37:42 +0000 Subject: [PATCH 14/53] audio: Add checks to HIDL -> effect_param_t conversion By convention, the size of the resulting effect_param_t can not exceed EFFECT_PARAM_SIZE_MAX. This checks needs to be enforced when converting from HIDL arguments into legacy C API structures. Bug: 237291425 Test: atest VtsHalAudioEffectV7_0TargetTest Change-Id: Ie92f62b002dc622fa8246139c3d956909670fdb6 --- audio/effect/all-versions/default/Effect.cpp | 43 ++++++++++++++----- audio/effect/all-versions/default/Effect.h | 4 +- .../VtsHalAudioEffectTargetTest.cpp | 17 ++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index 3baafc9343..def3a3f3fb 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -238,12 +238,27 @@ void Effect::effectOffloadParamToHal(const EffectOffloadParameter& offload, } // static -std::vector Effect::parameterToHal(uint32_t paramSize, const void* paramData, - uint32_t valueSize, const void** valueData) { +bool Effect::parameterToHal(uint32_t paramSize, const void* paramData, uint32_t valueSize, + const void** valueData, std::vector* halParamBuffer) { + constexpr size_t kMaxSize = EFFECT_PARAM_SIZE_MAX - sizeof(effect_param_t); + if (paramSize > kMaxSize) { + ALOGE("%s: Parameter size is too big: %" PRIu32, __func__, paramSize); + return false; + } size_t valueOffsetFromData = alignedSizeIn(paramSize) * sizeof(uint32_t); + if (valueOffsetFromData > kMaxSize) { + ALOGE("%s: Aligned parameter size is too big: %zu", __func__, valueOffsetFromData); + return false; + } + if (valueSize > kMaxSize - valueOffsetFromData) { + ALOGE("%s: Value size is too big: %" PRIu32 ", max size is %zu", __func__, valueSize, + kMaxSize - valueOffsetFromData); + android_errorWriteLog(0x534e4554, "237291425"); + return false; + } size_t halParamBufferSize = sizeof(effect_param_t) + valueOffsetFromData + valueSize; - std::vector halParamBuffer(halParamBufferSize, 0); - effect_param_t* halParam = reinterpret_cast(&halParamBuffer[0]); + halParamBuffer->resize(halParamBufferSize, 0); + effect_param_t* halParam = reinterpret_cast(halParamBuffer->data()); halParam->psize = paramSize; halParam->vsize = valueSize; memcpy(halParam->data, paramData, paramSize); @@ -256,7 +271,7 @@ std::vector Effect::parameterToHal(uint32_t paramSize, const void* para *valueData = halParam->data + valueOffsetFromData; } } - return halParamBuffer; + return true; } Result Effect::analyzeCommandStatus(const char* commandName, const char* context, status_t status) { @@ -314,11 +329,15 @@ Result Effect::getParameterImpl(uint32_t paramSize, const void* paramData, GetParameterSuccessCallback onSuccess) { // As it is unknown what method HAL uses for copying the provided parameter data, // it is safer to make sure that input and output buffers do not overlap. - std::vector halCmdBuffer = - parameterToHal(paramSize, paramData, requestValueSize, nullptr); + std::vector halCmdBuffer; + if (!parameterToHal(paramSize, paramData, requestValueSize, nullptr, &halCmdBuffer)) { + return Result::INVALID_ARGUMENTS; + } const void* valueData = nullptr; - std::vector halParamBuffer = - parameterToHal(paramSize, paramData, replyValueSize, &valueData); + std::vector halParamBuffer; + if (!parameterToHal(paramSize, paramData, replyValueSize, &valueData, &halParamBuffer)) { + return Result::INVALID_ARGUMENTS; + } uint32_t halParamBufferSize = halParamBuffer.size(); return sendCommandReturningStatusAndData( @@ -472,8 +491,10 @@ Result Effect::setConfigImpl(int commandCode, const char* commandName, const Eff Result Effect::setParameterImpl(uint32_t paramSize, const void* paramData, uint32_t valueSize, const void* valueData) { - std::vector halParamBuffer = - parameterToHal(paramSize, paramData, valueSize, &valueData); + std::vector halParamBuffer; + if (!parameterToHal(paramSize, paramData, valueSize, &valueData, &halParamBuffer)) { + return Result::INVALID_ARGUMENTS; + } return sendCommandReturningStatus(EFFECT_CMD_SET_PARAM, "SET_PARAM", halParamBuffer.size(), &halParamBuffer[0]); } diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index 011544d760..f0b65df0b9 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -211,8 +211,8 @@ struct Effect : public IEffect { channel_config_t* halConfig); static void effectOffloadParamToHal(const EffectOffloadParameter& offload, effect_offload_param_t* halOffload); - static std::vector parameterToHal(uint32_t paramSize, const void* paramData, - uint32_t valueSize, const void** valueData); + static bool parameterToHal(uint32_t paramSize, const void* paramData, uint32_t valueSize, + const void** valueData, std::vector* halParamBuffer); Result analyzeCommandStatus(const char* commandName, const char* context, status_t status); void getConfigImpl(int commandCode, const char* commandName, GetConfigCallback cb); diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index e59423fa98..ffa4c56e7a 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -623,6 +623,23 @@ TEST_P(AudioEffectHidlTest, GetParameter) { EXPECT_TRUE(ret.isOk()); } +TEST_P(AudioEffectHidlTest, GetParameterInvalidMaxReplySize) { + description("Verify that GetParameter caps the maximum reply size"); + // Use a non-empty parameter to avoid being rejected by any earlier checks. + hidl_vec parameter; + parameter.resize(16); + // Use very large size to ensure that the service does not crash. Since parameters + // are specific to each effect, and some effects may not have parameters at all, + // simply checking the return value would not reveal an issue of using an uncapped value. + const uint32_t veryLargeReplySize = std::numeric_limits::max() - 100; + Result retval = Result::OK; + Return ret = + effect->getParameter(parameter, veryLargeReplySize, + [&](Result r, const hidl_vec&) { retval = r; }); + EXPECT_TRUE(ret.isOk()); + EXPECT_EQ(Result::INVALID_ARGUMENTS, retval); +} + TEST_P(AudioEffectHidlTest, GetSupportedConfigsForFeature) { description("Verify that GetSupportedConfigsForFeature does not crash"); Return ret = effect->getSupportedConfigsForFeature( From cdc036a685bc467562ad8b2472d5336e4714c23b Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Mon, 11 Jul 2022 23:57:51 +0000 Subject: [PATCH 15/53] Fixed VEHICLE_CURB_WEIGHT property Test: atest CarPropertyManagerTest Bug: 238677365 Change-Id: Iccea9313ec4654652be65e115ecebdcf7f68652f --- .../vehicle/aidl/impl/default_config/include/DefaultConfig.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index fc9ed47be3..d29813df03 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -363,8 +363,9 @@ const std::vector kVehicleProperties = { .prop = toInt(VehicleProperty::VEHICLE_CURB_WEIGHT), .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::STATIC, + .configArray = {/*gross weight kg=*/2948}, }, - .initialValue = {.int32Values = {30}}}, + .initialValue = {.int32Values = {2211 /*kg*/}}}, {.config = { From bd915c129c110de3b015059f51222315cea101cc Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Sun, 10 Jul 2022 23:59:18 +0800 Subject: [PATCH 16/53] Bluetooth audio hal check broadcast configuraiton for the broadcast offload The patch contains the following changes 1. Check the broadcast audio configuration as starting broadcast offload session 2. Update audio configuration checker for broadcast offload 3. Remove the IsOffloadLeAudioConfigurationValid function that the audio configuraiton is invalid as session started, so we don't need to check it at that time Bug: 210987580 Test: start the offload broadcast stream, and check the session status Change-Id: I60b1b506051873f6d942f2febace6562634fc12a Merged-In: I60b1b506051873f6d942f2febace6562634fc12a (cherry picked from commit ee398a93f564e515051932dfd3801081426b1ae8) --- .../default/LeAudioOffloadAudioProvider.cpp | 19 +++++++++---------- .../aidl_session/BluetoothAudioCodecs.cpp | 13 ------------- .../utils/aidl_session/BluetoothAudioCodecs.h | 3 --- .../aidl_session/BluetoothAudioSession.cpp | 15 +++++++++++---- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp index 0e22e44490..7f610ef3d0 100644 --- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp +++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp @@ -55,21 +55,20 @@ ndk::ScopedAStatus LeAudioOffloadAudioProvider::startSession( const std::shared_ptr& host_if, const AudioConfiguration& audio_config, const std::vector& latency_modes, DataMQDesc* _aidl_return) { - if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { + if (session_type_ == + SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { + if (audio_config.getTag() != AudioConfiguration::leAudioBroadcastConfig) { + LOG(WARNING) << __func__ << " - Invalid Audio Configuration=" + << audio_config.toString(); + *_aidl_return = DataMQDesc(); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + } else if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { LOG(WARNING) << __func__ << " - Invalid Audio Configuration=" << audio_config.toString(); *_aidl_return = DataMQDesc(); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - const auto& le_audio_config = - audio_config.get(); - if (!BluetoothAudioCodecs::IsOffloadLeAudioConfigurationValid( - session_type_, le_audio_config)) { - LOG(WARNING) << __func__ << " - Unsupported LC3 Offloaded Configuration=" - << le_audio_config.toString(); - *_aidl_return = DataMQDesc(); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } return BluetoothAudioProvider::startSession( host_if, audio_config, latency_modes, _aidl_return); diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp index b858f504ed..d5e85b8e93 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp @@ -321,19 +321,6 @@ bool BluetoothAudioCodecs::IsOffloadOpusConfigurationValid( return false; } -bool BluetoothAudioCodecs::IsOffloadLeAudioConfigurationValid( - const SessionType& session_type, const LeAudioConfiguration&) { - if (session_type != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH && - session_type != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH && - session_type != - SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { - return false; - } - return true; -} - std::vector BluetoothAudioCodecs::GetSoftwarePcmCapabilities() { return {kDefaultSoftwarePcmCapabilities}; diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h index ed0598b975..e3d657b497 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.h @@ -44,9 +44,6 @@ class BluetoothAudioCodecs { static bool IsOffloadCodecConfigurationValid( const SessionType& session_type, const CodecConfiguration& codec_config); - static bool IsOffloadLeAudioConfigurationValid( - const SessionType& session_type, const LeAudioConfiguration&); - static std::vector GetLeAudioOffloadCodecCapabilities(const SessionType& session_type); diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 3214bf2228..1dd7887a0a 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -274,11 +274,14 @@ bool BluetoothAudioSession::UpdateAudioConfig( bool is_offload_a2dp_session = (session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH || session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH); - bool is_offload_le_audio_session = + bool is_offload_le_audio_unicast_session = (session_type_ == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || session_type_ == SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH); + bool is_offload_le_audio_broadcast_session = + (session_type_ == + SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH); auto audio_config_tag = audio_config.getTag(); bool is_software_audio_config = (is_software_session && @@ -286,11 +289,15 @@ bool BluetoothAudioSession::UpdateAudioConfig( bool is_a2dp_offload_audio_config = (is_offload_a2dp_session && audio_config_tag == AudioConfiguration::a2dpConfig); - bool is_le_audio_offload_audio_config = - (is_offload_le_audio_session && + bool is_le_audio_offload_unicast_audio_config = + (is_offload_le_audio_unicast_session && audio_config_tag == AudioConfiguration::leAudioConfig); + bool is_le_audio_offload_broadcast_audio_config = + (is_offload_le_audio_broadcast_session && + audio_config_tag == AudioConfiguration::leAudioBroadcastConfig); if (!is_software_audio_config && !is_a2dp_offload_audio_config && - !is_le_audio_offload_audio_config) { + !is_le_audio_offload_unicast_audio_config && + !is_le_audio_offload_broadcast_audio_config) { return false; } audio_config_ = std::make_unique(audio_config); From 6fefa59d939e37215febbd6877551923c84daa4c Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 11 Jul 2022 21:16:22 +0000 Subject: [PATCH 17/53] Remove FOG_LIGHTS_SWITCH from the emulator for the CTS test FOG_LIGHTS_SWITCH should not be implemented when FRONT_FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH is implemented. Test: atest CarPropertyManagerTest Bug: 237691268 Change-Id: I5d1fc669a038c50e3262b5b057c45300e48848b6 --- .../aidl/impl/default_config/include/DefaultConfig.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index fc9ed47be3..46f6df5fc3 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -952,14 +952,7 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - {.config = - { - .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - + // FOG_LIGHTS_SWITCH must not be implemented when FRONT_FOG_LIGHTS_SWITCH is implemented {.config = { .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_SWITCH), @@ -968,6 +961,7 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + // FOG_LIGHTS_SWITCH must not be implemented when REAR_FOG_LIGHTS_SWITCH is implemented {.config = { .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_SWITCH), From 53c6e83534dbb9618dc79ba9eb1ad3752383f90d Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Fri, 8 Jul 2022 00:32:04 +0800 Subject: [PATCH 18/53] Supoort audio configuration update to audio HAL for broadcast offload Bug: 210987580 Test: start the broadcast offload, check log Change-Id: Iadae625d10ad179089b952ac94ff66ae90a6236e Merged-In: Iadae625d10ad179089b952ac94ff66ae90a6236e (cherry picked from commit 36a879796bb046a5261d9862a69776f2bba94466) --- bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 1dd7887a0a..292d352b9c 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -111,7 +111,9 @@ void BluetoothAudioSession::ReportAudioConfigChanged( if (session_type_ != SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH && session_type_ != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH && + session_type_ != + SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { return; } std::lock_guard guard(mutex_); From 3b8e60afa3d2d6b64c25b0c171fac115ac6c107b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 15 Jul 2022 22:54:22 +0000 Subject: [PATCH 19/53] VehicleManager: use with RefBase RefBase with sp<> Bug: 232557259 Test: build Change-Id: Id6b3b7e222980fd0e82b2d94ff2518e92d42a4d9 --- automotive/vehicle/2.0/default/VehicleService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp index 12e15f9db3..2968232ed4 100644 --- a/automotive/vehicle/2.0/default/VehicleService.cpp +++ b/automotive/vehicle/2.0/default/VehicleService.cpp @@ -33,7 +33,7 @@ int main(int /* argc */, char* /* argv */ []) { auto store = std::make_unique(); auto connector = std::make_unique(); auto hal = std::make_unique(store.get(), connector.get()); - auto service = std::make_unique(hal.get()); + auto service = android::sp::make(hal.get()); connector->setValuePool(hal->getValuePool()); android::hardware::configureRpcThreadpool(4, true /* callerWillJoin */); From 87a2e092aecb6f3be92034a457b9a07714bedc40 Mon Sep 17 00:00:00 2001 From: Rucha Katakwar Date: Tue, 19 Jul 2022 15:42:35 -0700 Subject: [PATCH 20/53] Update the HAL side about torch max level safety. Bug: 239492786 Change-Id: I59dc2acc89c617be4551a4d92494a47b782d5e13 --- .../aidl/android/hardware/camera/device/ICameraDevice.aidl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl index 57705bc621..f9400006c8 100644 --- a/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl +++ b/camera/device/aidl/android/hardware/camera/device/ICameraDevice.aidl @@ -279,8 +279,10 @@ interface ICameraDevice { * 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. + * <= FLASH_INFO_STRENGTH_MAXIMUM_LEVEL. The FLASH_INFO_STRENGTH_MAXIMUM_LEVEL must + * be set to a level which will not cause any burn out issues. 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 From 3c7a832aca00f21b7f687b31044043253daf0edd Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 25 Jul 2022 22:43:48 +0000 Subject: [PATCH 21/53] Add seat belt properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I5137d64ab3025040f23efe58dbab01dc797923fe --- .../default_config/include/DefaultConfig.h | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 96d6ab895f..2eb9e6b3c0 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -182,6 +182,68 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {toInt(VehicleUnit::KILOWATT_HOUR)}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_BUCKLED), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = 0, + .maxInt32Value = 10}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {10}}}, + {SEAT_1_RIGHT, {.int32Values = {10}}}, + {SEAT_2_LEFT, {.int32Values = {10}}}, + {SEAT_2_RIGHT, {.int32Values = {10}}}, + {SEAT_2_CENTER, {.int32Values = {10}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From e37a6dda22f6063013df26c8c0545bf2985ebe17 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Mon, 25 Jul 2022 20:43:55 +0000 Subject: [PATCH 22/53] Added missing mirror area type HVAC properties Test: atest CarPropertyManagerTest Bug: 237610879 Change-Id: Ibff9b429110ee72f28b109ac193df21ad395de51 --- .../impl/default_config/include/DefaultConfig.h | 17 +++++++++++++++++ .../impl/utils/common/include/VehicleHalTypes.h | 1 + 2 files changed, 18 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 2eb9e6b3c0..7da7a93966 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -40,6 +40,7 @@ using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; using ::aidl::android::hardware::automotive::vehicle::VehicleGear; using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; @@ -715,6 +716,22 @@ const std::vector kVehicleProperties = { }}}, .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling + {.config = {.prop = toInt(VehicleProperty::HVAC_SIDE_MIRROR_HEAT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ + .areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), + .minInt32Value = 0, + .maxInt32Value = 2, + }, + VehicleAreaConfig{ + .areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = 0, + .maxInt32Value = 2, + }}}, + .initialAreaValues = {{toInt(VehicleAreaMirror::DRIVER_LEFT), {.int32Values = {2}}}, + {toInt(VehicleAreaMirror::DRIVER_RIGHT), {.int32Values = {1}}}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index a7fcdcf99d..8bc3c20ad8 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include From 7073d3faf7654837ff782f8df8617f7be03a2c63 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Wed, 27 Jul 2022 01:04:57 +0000 Subject: [PATCH 23/53] Updated HVAC_SIDE_MIRROR_HEAT with a more realistic config Test: atest CarPropertyManagerTest Bug: 237610879 Change-Id: If5ca59df192f2329c48757ec7fe0cf8530a1164b --- .../impl/default_config/include/DefaultConfig.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 7da7a93966..538a1660e9 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -720,17 +720,12 @@ const std::vector kVehicleProperties = { .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = {VehicleAreaConfig{ - .areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), - .minInt32Value = 0, - .maxInt32Value = 2, - }, - VehicleAreaConfig{ - .areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), - .minInt32Value = 0, - .maxInt32Value = 2, - }}}, - .initialAreaValues = {{toInt(VehicleAreaMirror::DRIVER_LEFT), {.int32Values = {2}}}, - {toInt(VehicleAreaMirror::DRIVER_RIGHT), {.int32Values = {1}}}}}, + .areaId = toInt(VehicleAreaMirror::DRIVER_LEFT) | + toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = 0, + .maxInt32Value = 2, + }}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), .access = VehiclePropertyAccess::READ_WRITE, From 3c514af345eb99fb66bb835798956e6e9c409843 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 26 Jul 2022 20:28:31 +0000 Subject: [PATCH 24/53] Add seat fore aft properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: Ia9b24f5e2a14e261b13c49015662c15e443ecc4d --- .../default_config/include/DefaultConfig.h | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 7da7a93966..70f4cb5eff 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -245,6 +245,54 @@ const std::vector kVehicleProperties = { {SEAT_2_RIGHT, {.int32Values = {0}}}, {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From c5cb3af14b7339c50d13eed5ee161f344f75b02a Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 26 Jul 2022 22:23:26 +0000 Subject: [PATCH 25/53] Add seat backrest properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: Ic4aeefb0751398559b7e9c878be861972c7b0f24 --- .../default_config/include/DefaultConfig.h | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 70f4cb5eff..b6a59e95b4 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -293,6 +293,102 @@ const std::vector kVehicleProperties = { {SEAT_2_RIGHT, {.int32Values = {0}}}, {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, + {SEAT_1_RIGHT, {.int32Values = {0}}}, + {SEAT_2_LEFT, {.int32Values = {0}}}, + {SEAT_2_RIGHT, {.int32Values = {0}}}, + {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 978a0f9ea0733227ca9a2ed3b66270424a19f5a8 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 5 Aug 2022 00:24:27 +0000 Subject: [PATCH 26/53] audio: Restrict the new VTS test for effects to T+ The VTS test AudioEffectHidlTest#GetParameterInvalidMaxReplySize should only run for new devices launching on T+ because older vendor images do not have updated HAL default wrapper code and thus will fail. Bug: 237291425 Bug: 240932876 Test: atest VtsHalAudioEffectV7_0TargetTest:Equalizer_IEffect/AudioEffectHidlTest#GetParameterInvalidMaxReplySize/0_default Change-Id: I1697155fe7781cbc96c1913e674699e299aa26b3 --- .../vts/functional/VtsHalAudioEffectTargetTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index ffa4c56e7a..c808ff6cc2 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -35,6 +35,7 @@ #include +#include #include #include #include @@ -625,6 +626,10 @@ TEST_P(AudioEffectHidlTest, GetParameter) { TEST_P(AudioEffectHidlTest, GetParameterInvalidMaxReplySize) { description("Verify that GetParameter caps the maximum reply size"); + const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33; + if (!isNewDeviceLaunchingOnTPlus) { + GTEST_SKIP() << "The test only applies to devices launching on T or later"; + } // Use a non-empty parameter to avoid being rejected by any earlier checks. hidl_vec parameter; parameter.resize(16); From d90c46cc07e118a525e49d461b5ede5ac3b3a592 Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Wed, 6 Jul 2022 15:29:13 +0000 Subject: [PATCH 27/53] Modify onHostEndpointDisconnected to always return OK Update the default HAL to reflect the API definition, which says that the HAL should silently ignore incorrect values. Bug: 233853737 Bug: 241339296 Test: Compile only Change-Id: Iae541e29706dddc6c9acb0563a2b484b75b549b5 (cherry picked from commit bb1d8bfc93cab1973d017012d06556321662d710) --- contexthub/aidl/default/ContextHub.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 4c23cbc8bf..35e4650ef2 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -107,10 +107,9 @@ ScopedAStatus ContextHub::onHostEndpointConnected(const HostEndpointInfo& in_inf ScopedAStatus ContextHub::onHostEndpointDisconnected(char16_t in_hostEndpointId) { if (mConnectedHostEndpoints.count(in_hostEndpointId) > 0) { mConnectedHostEndpoints.erase(in_hostEndpointId); - return ndk::ScopedAStatus::ok(); - } else { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); } + + return ndk::ScopedAStatus::ok(); } } // namespace contexthub From 3ed6a4042ce69f4f5ef52c092458c81222d60dc8 Mon Sep 17 00:00:00 2001 From: seanhong Date: Wed, 27 Jul 2022 23:22:33 +0000 Subject: [PATCH 28/53] Add seat height properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I48cd904dec83878570736cb8e99f0e169be753d7 Merged-In: I48cd904dec83878570736cb8e99f0e169be753d7 --- .../default_config/include/DefaultConfig.h | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 25f4b2153c..28f41fe66f 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -389,6 +389,46 @@ const std::vector kVehicleProperties = { {SEAT_2_RIGHT, {.int32Values = {0}}}, {SEAT_2_CENTER, {.int32Values = {0}}}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 039e85a385270d57fbdb85c189a445ac84f40713 Mon Sep 17 00:00:00 2001 From: Patty Date: Fri, 8 Apr 2022 11:53:04 +0800 Subject: [PATCH 29/53] le_audio_offload: Support two sources for conversational Tag: #feature Bug: 241775706 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I1bc59d09ec2ad3a8e65712c2fa099e806cce3c2d Merged-In: I1bc59d09ec2ad3a8e65712c2fa099e806cce3c2d (cherry picked from commit 51f165b314fb40b6a58007a81e707734a211f11f) --- .../audio/utils/aidl_session/BluetoothAudioCodecs.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp index d5e85b8e93..036d6cd60e 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp @@ -491,11 +491,18 @@ BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities( .broadcastCapability = kInvalidBroadcastCapability}); // Adds the capability for the case that encode and decode exist at the - // same time + // same time(force one active device for decode) kDefaultOffloadLeAudioCapabilities.push_back( {.unicastEncodeCapability = lc3Capability, .unicastDecodeCapability = lc3MonoDecodeCapability, .broadcastCapability = kInvalidBroadcastCapability}); + + // Adds the capability for the case that encode and decode exist at the + // same time + kDefaultOffloadLeAudioCapabilities.push_back( + {.unicastEncodeCapability = lc3Capability, + .unicastDecodeCapability = lc3Capability, + .broadcastCapability = kInvalidBroadcastCapability}); } } } From 16bf94da56afe59356dd6ec10dfab1f620d605aa Mon Sep 17 00:00:00 2001 From: Shivani Ghanta Date: Tue, 9 Aug 2022 23:57:13 +0000 Subject: [PATCH 30/53] DO NOT MERGE Add missing CAR_MIRROR properties to DefaultConfig.h Test: Built. Bug: 241161716 Change-Id: I53a6686fec62df205139d8e994237c56f0da8428 --- .../default_config/include/DefaultConfig.h | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 28f41fe66f..629455ebdb 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -1072,6 +1072,76 @@ const std::vector kVehicleProperties = { .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::MIRROR_Z_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), + .minInt32Value = -3, + .maxInt32Value = 3}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = -3, + .maxInt32Value = 3}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER), + .minInt32Value = -3, + .maxInt32Value = 3}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::MIRROR_Z_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER), + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::MIRROR_Y_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), + .minInt32Value = -3, + .maxInt32Value = 3}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = -3, + .maxInt32Value = 3}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER), + .minInt32Value = -3, + .maxInt32Value = 3}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::MIRROR_Y_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = + {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT), + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT), + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER), + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::MIRROR_LOCK), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {1}}}, + + {.config = {.prop = toInt(VehicleProperty::MIRROR_FOLD), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {1}}}, + {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, From 8e532e6d8213378115896037659a2b5793b64d27 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 10 Aug 2022 21:20:08 +0000 Subject: [PATCH 31/53] Use a different timesource in recurrent timer. Previously we used elapsedRealtimeNanos in recurrent timer which will still go even if the system is in deep sleep. This causes all the events "happened" during suspension to be replayed immediately after the wake up, which causes a spam of messages. uptimeNanos meanwhile, does not go if the system is in sleep, so we use that instead. Test: atest VehicleHalVehicleUtilsTest Bug: 235262127 Change-Id: Ib67c2e2251af3231cefd875416d5bcb15953ba5e Merged-In: Ib67c2e2251af3231cefd875416d5bcb15953ba5e (cherry picked from commit 5e508737934feb595c841430f41b5edb1d1925d5) --- .../vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index 8521c4db7c..2eca6b7a17 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -48,7 +48,7 @@ void RecurrentTimer::registerTimerCallback(int64_t intervalInNano, std::scoped_lock lockGuard(mLock); // Aligns the nextTime to multiply of interval. - int64_t nextTime = ceil(elapsedRealtimeNano() / intervalInNano) * intervalInNano; + int64_t nextTime = ceil(uptimeNanos() / intervalInNano) * intervalInNano; std::unique_ptr info = std::make_unique(); info->callback = callback; @@ -128,7 +128,7 @@ void RecurrentTimer::loop() { } // The first element is the nearest next event. int64_t nextTime = mCallbackQueue[0]->nextTime; - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); if (nextTime > now) { interval = nextTime - now; } else { @@ -146,7 +146,7 @@ void RecurrentTimer::loop() { { ScopedLockAssertion lockAssertion(mLock); - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); while (mCallbackQueue.size() > 0) { int64_t nextTime = mCallbackQueue[0]->nextTime; if (nextTime > now) { From dcf03f135ee0db2ff1f9849672a3cc65601f7c08 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Mon, 8 Aug 2022 21:15:56 +0000 Subject: [PATCH 32/53] DO NOT MERGE Added missing HVAC properties to DefaultConfig.h Test: Built. Bug: 237610879 Change-Id: I77f60bf6c3277527a556b924e7598778828bef4c --- .../impl/default_config/include/DefaultConfig.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 28f41fe66f..0cea0c2573 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -763,6 +763,12 @@ const std::vector kVehicleProperties = { .int32Values = {0, 0, 0}, }}, + {.config = {.prop = toInt(VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {50}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, @@ -911,6 +917,14 @@ const std::vector kVehicleProperties = { }}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_CURRENT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT}, + VehicleAreaConfig{.areaId = HVAC_RIGHT}}}, + .initialAreaValues = {{HVAC_LEFT, {.floatValues = {17.3f}}}, + {HVAC_RIGHT, {.floatValues = {19.1f}}}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), .access = VehiclePropertyAccess::READ_WRITE, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, From 30e6d473acc9f31731b434fc7587dab80c49ec99 Mon Sep 17 00:00:00 2001 From: seanhong Date: Fri, 29 Jul 2022 21:46:48 +0000 Subject: [PATCH 33/53] DO NOT MERGE Add seat depth properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I82ddae13db2c534c148a00e73c62dbbcc6d1b258 --- .../default_config/include/DefaultConfig.h | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 629455ebdb..6b71dadd00 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -429,6 +429,46 @@ const std::vector kVehicleProperties = { .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_DEPTH_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_DEPTH_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 97d5113c2613be73e0c3317b8ba54af659254519 Mon Sep 17 00:00:00 2001 From: seanhong Date: Fri, 29 Jul 2022 23:44:17 +0000 Subject: [PATCH 34/53] DO NOT MERGE Add seat tilt properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I2768b2769616c4e34c04becb751c8aa26fc2379e --- .../default_config/include/DefaultConfig.h | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 6b71dadd00..b2186cab2e 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -469,6 +469,46 @@ const std::vector kVehicleProperties = { .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_TILT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_TILT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 88ebf208972f5a9dde0abd3bea898d1279735090 Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 1 Aug 2022 21:49:53 +0000 Subject: [PATCH 35/53] DO NOT MERGE Add seat lumbar properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I177420199437a6e8057aeb0e6f6cc06b38a0a4ce --- .../default_config/include/DefaultConfig.h | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index b2186cab2e..33e0261a2e 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -509,6 +509,86 @@ const std::vector kVehicleProperties = { .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = 0, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 34e7cd05575eb3a2413f51d191cd5a9805e1c68d Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 15 Aug 2022 20:58:10 +0000 Subject: [PATCH 36/53] DO NOT MERGE Add SEAT_HEADREST_* properties to the emulator for CTS tests All the seat headrest properties have been added, but SEAT_HEADREST_HEIGHT_POS is excluded because of b/242587816. Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I07647daa241cf915476a1c696e1a467734f619d3 --- .../default_config/include/DefaultConfig.h | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 33e0261a2e..f5b107a0d5 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -589,6 +589,106 @@ const std::vector kVehicleProperties = { .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_ANGLE_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = 0, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_ANGLE_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_FORE_AFT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = 0, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 1548acc7851901ebbe94e76bd819815ce0a83c59 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 16 Aug 2022 19:03:04 +0000 Subject: [PATCH 37/53] DO NOT MERGE Add interior light state properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 242739801 Change-Id: Id2181fd33c2d821513d151f1fddc78de9b057627 --- .../default_config/include/DefaultConfig.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 629455ebdb..c5212a9285 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -1274,6 +1274,24 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + {.config = + { + .prop = toInt(VehicleProperty::CABIN_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = {.prop = toInt(VehicleProperty::READING_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER}}}, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + {.config = { .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH), From 63ef85b2dbce77687fdcce609a0ae0f77467905c Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Mon, 15 Aug 2022 18:03:25 -0700 Subject: [PATCH 38/53] Update EVS API descriptions This CL adds comments to clarify the behavior of IEvsCameraStrea.notify() when the service attempts to deliver an event, which is originated from AIDL EVS HAL implementation, to the HIDL recipients. Bug: 241722031 Test: treehugger Change-Id: If6648883f982a90ac30a1636258f896272326c3f --- .../aidl/android/hardware/automotive/evs/EvsEventDesc.aidl | 4 +++- .../android/hardware/automotive/evs/IEvsCameraStream.aidl | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl index ebff98f077..3abdb54e6c 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/EvsEventDesc.aidl @@ -33,7 +33,9 @@ parcelable EvsEventDesc { @utf8InCpp String deviceId; /** - * Possible additional vendor information that is opaque to the EvsManager + * Possible additional vendor information that is opaque to the EvsManager. + * The size of the payload must not exceed 16-byte if the HIDL recipients are + * expected to exist. */ int[] payload; } diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl index 2c2b44caf5..c599d58635 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsCameraStream.aidl @@ -47,7 +47,10 @@ oneway interface IEvsCameraStream { /** * Receives calls from the HAL each time an event happens. * - * @param in event EVS event with possible event information. + * @param in event EVS event with possible event information. If ths HIDL + * recipients are expected to exist, the size of the event + * payload must not exceed 16 bytes; otherwise, a notification + * will not reach them. */ void notify(in EvsEventDesc event); } From c621940ec7089e158560f2061d0f0a2e15f414a2 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 22 Jul 2022 17:39:41 +0900 Subject: [PATCH 39/53] android.hardware.wifi@1.0-service in soong As libwifi-hal is migrated to soong, the service is migrated to soong as well. Bug: 240099735 Test: CtsWifiTestCases Merged-In: Ie5a4ec6658d5f6aa3d4902c9c3c4b3bef9ff1cde Change-Id: Ie5a4ec6658d5f6aa3d4902c9c3c4b3bef9ff1cde (cherry picked from commit c4ac3355a6b65cdeb39f3630a23076c1a5369995) --- wifi/1.6/default/Android.bp | 197 ++++++++++++++++++++++++++++------- wifi/1.6/default/Android.mk | 202 ------------------------------------ 2 files changed, 158 insertions(+), 241 deletions(-) delete mode 100644 wifi/1.6/default/Android.mk diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp index d48d18332f..0ac6412544 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -16,42 +16,60 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -filegroup { - name: "android.hardware.wifi@1.0-service_srcs", - srcs: ["service.cpp"], +soong_config_module_type { + name: "wifi_hal_cc_defaults", + module_type: "cc_defaults", + config_namespace: "wifi", + bool_variables: [ + "hidl_feature_aware", // WIFI_HIDL_FEATURE_AWARE + "hidl_feature_dual_interface", // WIFI_HIDL_FEATURE_DUAL_INTERFACE + "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP + "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION + "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE + ], + value_variables: [ + "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS + ], + properties: [ + "cppflags", + ], } -cc_defaults { - name: "android.hardware.wifi@1.0-service_default", - srcs: [":android.hardware.wifi@1.0-service_srcs"], - relative_install_path: "hw", - soc_specific: true, - shared_libs: [ - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-system-iface", - "libxml2", - ], +wifi_hal_cc_defaults { + name: "android.hardware.wifi@1.0-service-cppflags-defaults", + soong_config_variables: { + hidl_feature_aware: { + cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], + }, + hidl_feature_dual_interface: { + cppflags: ["-DWIFI_HIDL_FEATURE_DUAL_INTERFACE"], + }, + hidl_feature_disable_ap: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP"], + }, + hidl_feature_disable_ap_mac_randomization: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION"], + }, + avoid_iface_reset_mac_change: { + cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], + }, + hal_interface_combinations: { + cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], + }, + }, +} + +cc_library_static { + name: "android.hardware.wifi@1.0-service-lib", + defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], + proprietary: true, cppflags: [ "-Wall", "-Werror", "-Wextra", ], -} - -filegroup { - name: "android.hardware.wifi@1.0-service-lib_srcs", + // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. + cflags: ["-Wno-error=implicit-fallthrough"], srcs: [ "hidl_struct_util.cpp", "hidl_sync_util.cpp", @@ -71,14 +89,17 @@ filegroup { "wifi_sta_iface.cpp", "wifi_status_util.cpp", ], -} -cc_defaults { - name: "android.hardware.wifi@1.0-service-lib_defaults", - srcs: [":android.hardware.wifi@1.0-service-lib_srcs"], - relative_install_path: "hw", - soc_specific: true, shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", "android.hardware.wifi@1.0", "android.hardware.wifi@1.1", "android.hardware.wifi@1.2", @@ -86,22 +107,120 @@ cc_defaults { "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", "android.hardware.wifi@1.6", + ], + + export_include_dirs: ["."], +} + +cc_binary { + name: "android.hardware.wifi@1.0-service", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + relative_install_path: "hw", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: ["service.cpp"], + shared_libs: [ "libbase", "libcutils", "libhidlbase", "liblog", "libnl", "libutils", + "libwifi-hal", "libwifi-system-iface", "libxml2", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", ], - // Generated by building android.hardware.wifi@1.0-service-lib and printing LOCAL_CPPFLAGS. + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service.rc"], +} + +cc_binary { + name: "android.hardware.wifi@1.0-service-lazy", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + overrides: ["android.hardware.wifi@1.0-service"], + cflags: ["-DLAZY_SERVICE"], + relative_install_path: "hw", + proprietary: true, cppflags: [ "-Wall", "-Werror", "-Wextra", - "-DWIFI_HIDL_FEATURE_DUAL_INTERFACE", ], - export_include_dirs: ["."], - include_dirs: ["external/libxml2/include"], + srcs: ["service.cpp"], + shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", + ], + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service-lazy.rc"], +} + +cc_test { + name: "android.hardware.wifi@1.0-service-tests", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: [ + "tests/hidl_struct_util_unit_tests.cpp", + "tests/main.cpp", + "tests/mock_interface_tool.cpp", + "tests/mock_wifi_feature_flags.cpp", + "tests/mock_wifi_iface_util.cpp", + "tests/mock_wifi_legacy_hal.cpp", + "tests/mock_wifi_mode_controller.cpp", + "tests/ringbuffer_unit_tests.cpp", + "tests/wifi_nan_iface_unit_tests.cpp", + "tests/wifi_chip_unit_tests.cpp", + "tests/wifi_iface_util_unit_tests.cpp", + ], + static_libs: [ + "libgmock", + "libgtest", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", + "android.hardware.wifi@1.0-service-lib", + ], + shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + ], } diff --git a/wifi/1.6/default/Android.mk b/wifi/1.6/default/Android.mk deleted file mode 100644 index ca1c022db1..0000000000 --- a/wifi/1.6/default/Android.mk +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (C) 2016 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. -LOCAL_PATH := $(call my-dir) - -### -### android.hardware.wifi static library -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-lib -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -ifdef WIFI_HAL_INTERFACE_COMBINATIONS -LOCAL_CPPFLAGS += -DWIFI_HAL_INTERFACE_COMBINATIONS="$(WIFI_HAL_INTERFACE_COMBINATIONS)" -endif -ifdef WIFI_HIDL_FEATURE_AWARE -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE -endif -ifdef WIFI_HIDL_FEATURE_DUAL_INTERFACE -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DUAL_INTERFACE -endif -ifdef WIFI_HIDL_FEATURE_DISABLE_AP -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP -endif -ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION -endif -ifdef WIFI_AVOID_IFACE_RESET_MAC_CHANGE -LOCAL_CPPFLAGS += -DWIFI_AVOID_IFACE_RESET_MAC_CHANGE -endif -# Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. -LOCAL_CFLAGS += -Wno-error=implicit-fallthrough -LOCAL_SRC_FILES := \ - hidl_struct_util.cpp \ - hidl_sync_util.cpp \ - ringbuffer.cpp \ - wifi.cpp \ - wifi_ap_iface.cpp \ - wifi_chip.cpp \ - wifi_feature_flags.cpp \ - wifi_iface_util.cpp \ - wifi_legacy_hal.cpp \ - wifi_legacy_hal_factory.cpp \ - wifi_legacy_hal_stubs.cpp \ - wifi_mode_controller.cpp \ - wifi_nan_iface.cpp \ - wifi_p2p_iface.cpp \ - wifi_rtt_controller.cpp \ - wifi_sta_iface.cpp \ - wifi_status_util.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_C_INCLUDES += $(TOP)/external/libxml2/include -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) -include $(BUILD_STATIC_LIBRARY) - -### -### android.hardware.wifi daemon -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - service.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_STATIC_LIBRARIES := \ - android.hardware.wifi@1.0-service-lib -LOCAL_INIT_RC := android.hardware.wifi@1.0-service.rc -include $(BUILD_EXECUTABLE) - -### -### android.hardware.wifi daemon -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-lazy -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml -LOCAL_OVERRIDES_MODULES := android.hardware.wifi@1.0-service -LOCAL_CFLAGS := -DLAZY_SERVICE -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - service.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_STATIC_LIBRARIES := \ - android.hardware.wifi@1.0-service-lib -LOCAL_INIT_RC := android.hardware.wifi@1.0-service-lazy.rc -include $(BUILD_EXECUTABLE) - -### -### android.hardware.wifi unit tests. -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-tests -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - tests/hidl_struct_util_unit_tests.cpp \ - tests/main.cpp \ - tests/mock_interface_tool.cpp \ - tests/mock_wifi_feature_flags.cpp \ - tests/mock_wifi_iface_util.cpp \ - tests/mock_wifi_legacy_hal.cpp \ - tests/mock_wifi_mode_controller.cpp \ - tests/ringbuffer_unit_tests.cpp \ - tests/wifi_nan_iface_unit_tests.cpp \ - tests/wifi_chip_unit_tests.cpp \ - tests/wifi_iface_util_unit_tests.cpp -LOCAL_STATIC_LIBRARIES := \ - libgmock \ - libgtest \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 \ - android.hardware.wifi@1.0-service-lib -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface -include $(BUILD_NATIVE_TEST) From eb6bd6a7dff4a6da24ba05605ab7d345d03dbe7e Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 12 Aug 2022 13:40:26 +0900 Subject: [PATCH 40/53] Build libwifi-hal-* modules only for the first arch Previously, the build rules assumed that the target supports both 64 and 32 bit architectures, which isn't true for 32-bit-only targets. That caused build breakage on such targets. Fixing that by building the modules only for the first architecture (64 on 64-only or 64/32 target, and 32 on 32-only target). Bug: 241916304 Test: build the 32-bit-only target Merged-In: I5353ab1561622eae12e2dff87eb0f17b47c3773d Change-Id: I5353ab1561622eae12e2dff87eb0f17b47c3773d (cherry picked from commit 3ab5c9010431c557c22eee5470b8e0580722d2b6) --- wifi/1.6/default/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp index 0ac6412544..a132deed59 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -63,6 +63,7 @@ cc_library_static { name: "android.hardware.wifi@1.0-service-lib", defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], proprietary: true, + compile_multilib: "first", cppflags: [ "-Wall", "-Werror", @@ -183,6 +184,7 @@ cc_binary { cc_test { name: "android.hardware.wifi@1.0-service-tests", proprietary: true, + compile_multilib: "first", cppflags: [ "-Wall", "-Werror", From 0c188ae232b3caf2e368cc2b65748920ba36e505 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 23 Aug 2022 22:44:29 +0000 Subject: [PATCH 41/53] DO NOT MERGE Add interior light switch properties to the emulator for CTS tests Test: atest CarPropertyManagerTest Bug: 242740101 Change-Id: I072bb95f327869ae48782023ae144cce7a0b2be6 --- .../default_config/include/DefaultConfig.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 384b87d4fc..57e12f1763 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -1608,6 +1608,24 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, + {.config = + { + .prop = toInt(VehicleProperty::CABIN_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + }, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + + {.config = {.prop = toInt(VehicleProperty::READING_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER}}}, + .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, + {.config = { .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST), From 76070519eb14aab8d247d37d4f708b86a8be91fe Mon Sep 17 00:00:00 2001 From: Arati Gerdes Date: Fri, 26 Aug 2022 20:50:23 +0000 Subject: [PATCH 42/53] DO NOT MERGE Add missing WINDOW_MOVE properties to DefaultConfig.h Test: Built. Bug: 239100623 Change-Id: I29e55f995a35bc3157f082be1b88a61495434b5c --- .../default_config/include/DefaultConfig.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 28f41fe66f..de3af64aba 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -1100,6 +1100,26 @@ const std::vector kVehicleProperties = { .maxInt32Value = 10}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::WINDOW_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = WINDOW_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = WHEEL_TICK, From 6562855190773b194aa1daa353e2b57a0bc73765 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 30 Aug 2022 19:21:38 +0000 Subject: [PATCH 43/53] DO NOT MERGE Add INFO_VIN to DefaultConfig.h for CTS tests Test: atest CarPropertyManagerTest Bug: 244335921 Change-Id: Iecc496e2a64a3270819cf90935ea6deec8a4c9f3 --- .../aidl/impl/default_config/include/DefaultConfig.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 384b87d4fc..d5cbda404f 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -123,6 +123,13 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}}, + {.config = + { + .prop = toInt(VehicleProperty::INFO_VIN), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.stringValue = "1GCARVIN123456789"}}, {.config = { .prop = toInt(VehicleProperty::INFO_MAKE), From 8e3480edfe9933306f82c1656deb8e6b7090273c Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 1 Sep 2022 00:31:43 +0000 Subject: [PATCH 44/53] audio: Add checks to effects feature configs retrieval The size of the feature config needs to be limited by the Binder transaction size. This check is enforced before calling into legacy C API. Also, fixed invalid calculation of buffer size in Effect::getSupportedConfigsImpl. Bug: 240266798 Test: atest VtsHalAudioEffectV7_0TargetTest Change-Id: I1a1f7931a07e28642967fa68d9a358429138db29 --- audio/effect/all-versions/default/Effect.cpp | 11 ++++++- audio/effect/all-versions/default/Effect.h | 3 ++ .../VtsHalAudioEffectTargetTest.cpp | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index def3a3f3fb..b57dc63368 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -316,6 +316,11 @@ void Effect::getConfigImpl(int commandCode, const char* commandName, GetConfigCa Result Effect::getCurrentConfigImpl(uint32_t featureId, uint32_t configSize, GetCurrentConfigSuccessCallback onSuccess) { + if (configSize > kMaxDataSize - sizeof(uint32_t)) { + ALOGE("%s: Config size is too big: %" PRIu32, __func__, configSize); + android_errorWriteLog(0x534e4554, "240266798"); + return Result::INVALID_ARGUMENTS; + } uint32_t halCmd = featureId; std::vector halResult(alignedSizeIn(sizeof(uint32_t) + configSize), 0); uint32_t halResultSize = 0; @@ -350,8 +355,12 @@ Result Effect::getParameterImpl(uint32_t paramSize, const void* paramData, Result Effect::getSupportedConfigsImpl(uint32_t featureId, uint32_t maxConfigs, uint32_t configSize, GetSupportedConfigsSuccessCallback onSuccess) { + if (maxConfigs != 0 && configSize > (kMaxDataSize - 2 * sizeof(uint32_t)) / maxConfigs) { + ALOGE("%s: Config size is too big: %" PRIu32, __func__, configSize); + return Result::INVALID_ARGUMENTS; + } uint32_t halCmd[2] = {featureId, maxConfigs}; - uint32_t halResultSize = 2 * sizeof(uint32_t) + maxConfigs * sizeof(configSize); + uint32_t halResultSize = 2 * sizeof(uint32_t) + maxConfigs * configSize; std::vector halResult(static_cast(halResultSize), 0); return sendCommandReturningStatusAndData( EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS, "GET_FEATURE_SUPPORTED_CONFIGS", sizeof(halCmd), diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index f0b65df0b9..5d8dcccba6 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -184,6 +184,9 @@ struct Effect : public IEffect { using GetSupportedConfigsSuccessCallback = std::function; + // Sets the limit on the maximum size of vendor-provided data structures. + static constexpr size_t kMaxDataSize = 1 << 20; + static const char* sContextResultOfCommand; static const char* sContextCallToCommand; static const char* sContextCallFunction; diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index c808ff6cc2..d95bb06c3a 100644 --- a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -665,6 +665,37 @@ TEST_P(AudioEffectHidlTest, SetCurrentConfigForFeature) { EXPECT_TRUE(ret.isOk()); } +TEST_P(AudioEffectHidlTest, GetSupportedConfigsForFeatureInvalidConfigSize) { + description("Verify that GetSupportedConfigsForFeature caps the maximum config size"); + const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33; + if (!isNewDeviceLaunchingOnTPlus) { + GTEST_SKIP() << "The test only applies to devices launching on T or later"; + } + // Use very large size to ensure that the service does not crash. + const uint32_t veryLargeConfigSize = std::numeric_limits::max() - 100; + Result retval = Result::OK; + Return ret = effect->getSupportedConfigsForFeature( + 0, 1, veryLargeConfigSize, + [&](Result r, uint32_t, const hidl_vec&) { retval = r; }); + EXPECT_TRUE(ret.isOk()); + EXPECT_EQ(Result::INVALID_ARGUMENTS, retval); +} + +TEST_P(AudioEffectHidlTest, GetCurrentConfigForFeatureInvalidConfigSize) { + description("Verify that GetCurrentConfigForFeature caps the maximum config size"); + const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33; + if (!isNewDeviceLaunchingOnTPlus) { + GTEST_SKIP() << "The test only applies to devices launching on T or later"; + } + // Use very large size to ensure that the service does not crash. + const uint32_t veryLargeConfigSize = std::numeric_limits::max() - 100; + Result retval = Result::OK; + Return ret = effect->getCurrentConfigForFeature( + 0, veryLargeConfigSize, [&](Result r, const hidl_vec&) { retval = r; }); + EXPECT_TRUE(ret.isOk()); + EXPECT_EQ(Result::INVALID_ARGUMENTS, retval); +} + // The main test class for Equalizer Audio Effect HIDL HAL. class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest { public: From dd2b7eb56435320a127352f484db5211dba07f2d Mon Sep 17 00:00:00 2001 From: Lorena Torres-Huerta Date: Fri, 12 Aug 2022 23:08:10 +0000 Subject: [PATCH 45/53] Add AudioAttributes and AudioFlag for use in HAL interface for engine configuration. This requires a version bump to android.media.audio.common.types. cc_defaults and java_defaults are used in order to avoid explicitly updating version references in several Android.bp files when we do future version bumps. Bug: 242678729 Test: m Merged-In: Id17820f210f625e370992db4f9f85e37887b088b Change-Id: Id17820f210f625e370992db4f9f85e37887b088b --- audio/aidl/Android.bp | 45 +++++++++++++++++-- audio/aidl/default/Android.bp | 14 ++++-- audio/aidl/vts/Android.bp | 6 +-- .../all-versions/vts/functional/Android.bp | 30 ++++++++----- soundtrigger/aidl/Android.bp | 18 +++++++- 5 files changed, 91 insertions(+), 22 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 820f7b4646..9c7a6a208a 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -33,7 +33,7 @@ aidl_interface { "android/hardware/audio/common/SourceMetadata.aidl", ], imports: [ - "android.media.audio.common.types-V1", + "android.media.audio.common.types", ], stability: "vintf", backend: { @@ -61,10 +61,25 @@ aidl_interface { version: "1", imports: ["android.media.audio.common.types-V1"], }, + // IMPORTANT: Update latest_android_hardware_audio_common every time you + // add the latest frozen version to versions_with_info ], } +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_audio_common = "android.hardware.audio.common-V2" + +// Modules that depend on android.hardware.audio.common directly can include +// the following cc_defaults to avoid explicitly managing dependency versions +// across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_common_ndk_static", + static_libs: [ + latest_android_hardware_audio_common + "-ndk", + ], +} + aidl_interface { name: "android.hardware.audio.core", vendor_available: true, @@ -80,10 +95,10 @@ aidl_interface { "android/hardware/audio/core/StreamDescriptor.aidl", ], imports: [ - "android.hardware.audio.common-V1", "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.media.audio.common.types-V1", + "android.hardware.audio.common", + "android.media.audio.common.types", ], stability: "vintf", backend: { @@ -95,6 +110,30 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + // IMPORTANT: Update latest_android_hardware_audio_core every time you + // add the latest frozen version to versions_with_info + ], +} + +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_audio_core = "android.hardware.audio.core-V1" + +// Modules that depend on android.hardware.audio.core directly can include +// the following cc_defaults to avoid explicitly managing dependency versions +// across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_core_ndk_shared", + shared_libs: [ + latest_android_hardware_audio_core + "-ndk", + ], +} + +cc_defaults { + name: "latest_android_hardware_audio_core_ndk_static", + static_libs: [ + latest_android_hardware_audio_core + "-ndk", + ], } aidl_interface { diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index f536776c98..6225fb3d66 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -18,8 +18,6 @@ cc_defaults { "libfmq", "libstagefright_foundation", "libutils", - "android.media.audio.common.types-V1-ndk", - "android.hardware.audio.core-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", ], @@ -27,7 +25,11 @@ cc_defaults { cc_library_static { name: "libaudioserviceexampleimpl", - defaults: ["aidlaudioservice_defaults"], + defaults: [ + "aidlaudioservice_defaults", + "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_core_ndk_shared", + ], export_include_dirs: ["include"], srcs: [ "Config.cpp", @@ -45,7 +47,11 @@ cc_binary { relative_install_path: "hw", init_rc: ["android.hardware.audio.service-aidl.example.rc"], vintf_fragments: ["android.hardware.audio.service-aidl.xml"], - defaults: ["aidlaudioservice_defaults"], + defaults: [ + "aidlaudioservice_defaults", + "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_core_ndk_shared", + ], static_libs: [ "libaudioserviceexampleimpl", ], diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 48aa273f74..2e12e7e334 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -12,6 +12,9 @@ cc_test { defaults: [ "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", + "latest_android_hardware_audio_common_ndk_static", + "latest_android_hardware_audio_core_ndk_static", + "latest_android_media_audio_common_types_ndk_static", ], shared_libs: [ "libbinder_ndk", @@ -19,11 +22,8 @@ cc_test { "libfmq", ], static_libs: [ - "android.hardware.audio.common-V1-ndk", - "android.hardware.audio.core-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", - "android.media.audio.common.types-V1-ndk", "libaudioaidlcommon", ], cflags: [ diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index daed7a8afd..f51a8d02af 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -49,7 +49,10 @@ cc_defaults { cc_test { name: "VtsHalAudioV2_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "2.0/AudioPrimaryHidlHalTest.cpp", ], @@ -62,7 +65,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@2.0", "android.hardware.audio.common@2.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=2", @@ -79,7 +81,10 @@ cc_test { cc_test { name: "VtsHalAudioV4_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "4.0/AudioPrimaryHidlHalTest.cpp", ], @@ -92,7 +97,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@4.0", "android.hardware.audio.common@4.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=4", @@ -109,7 +113,10 @@ cc_test { cc_test { name: "VtsHalAudioV5_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], srcs: [ "5.0/AudioPrimaryHidlHalTest.cpp", ], @@ -119,7 +126,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@5.0", "android.hardware.audio.common@5.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=5", @@ -136,7 +142,10 @@ cc_test { cc_test { name: "VtsHalAudioV6_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "6.0/AudioPrimaryHidlHalTest.cpp", ], @@ -150,7 +159,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=6", @@ -244,7 +252,10 @@ cc_test { cc_test { name: "HalAudioV6_0GeneratorTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], srcs: [ "6.0/Generators.cpp", "tests/generators_tests.cpp", @@ -252,7 +263,6 @@ cc_test { static_libs: [ "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", - "android.media.audio.common.types-V1-cpp", "libaudiofoundation", "libaudiopolicycomponents", "libmedia_helper", diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp index 0658519bd9..426bf48e2f 100644 --- a/soundtrigger/aidl/Android.bp +++ b/soundtrigger/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { ], stability: "vintf", imports: [ - "android.media.soundtrigger.types-V1", + "android.media.soundtrigger.types", ], backend: { cpp: { @@ -39,6 +39,20 @@ aidl_interface { version: "1", imports: ["android.media.soundtrigger.types-V1"], }, + // IMPORTANT: Update latest_android_hardware_soundtrigger3 every time + // you add the latest frozen version to versions_with_info + ], +} + +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V2" + +// Modules that depend on android.hardware.soundtrigger3 directly can include +// the following java_defaults to avoid explicitly managing dependency versions +// across many scattered files. +java_defaults { + name: "latest_android_hardware_soundtrigger3_java_static", + static_libs: [ + latest_android_hardware_soundtrigger3 + "-java", ], - } From d38e3f0d4b990694d155101dbb6a125bcb496f0a Mon Sep 17 00:00:00 2001 From: Lorena Torres-Huerta Date: Mon, 29 Aug 2022 21:48:01 +0000 Subject: [PATCH 46/53] Use explicit aidl versions for audio hal and soundtrigger dependencies. There are still issues with importing implicit versions. Switching to explicit versions while b/188871598 is worked out. Bug: 242678729 Test: m; AIDL_TRANSITIVE_FREEZE=true m aidl-freeze-api && AIDL_FROZEN_REL=true m Merged-In: Ide6a90716bf042fbb925357e110bc84ddb9e96fb Change-Id: Ide6a90716bf042fbb925357e110bc84ddb9e96fb (cherry picked from commit 8296aa824b0bd5890866eb3bfa20f1836c48846e) --- audio/aidl/Android.bp | 19 +++++++++++++------ audio/aidl/default/Android.bp | 4 +++- audio/aidl/vts/Android.bp | 2 +- automotive/audiocontrol/aidl/Android.bp | 6 +++--- automotive/audiocontrol/aidl/vts/Android.bp | 4 ++-- soundtrigger/aidl/Android.bp | 4 ++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 9c7a6a208a..d4c1e85e91 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -33,7 +33,7 @@ aidl_interface { "android/hardware/audio/common/SourceMetadata.aidl", ], imports: [ - "android.media.audio.common.types", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -59,7 +59,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.media.audio.common.types-V1"], + imports: ["android.media.audio.common.types-V2"], }, // IMPORTANT: Update latest_android_hardware_audio_common every time you // add the latest frozen version to versions_with_info @@ -68,11 +68,18 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_audio_common = "android.hardware.audio.common-V2" +latest_android_hardware_audio_common = "android.hardware.audio.common-V1" // Modules that depend on android.hardware.audio.common directly can include // the following cc_defaults to avoid explicitly managing dependency versions // across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_common_cpp_static", + static_libs: [ + latest_android_hardware_audio_common + "-cpp", + ], +} + cc_defaults { name: "latest_android_hardware_audio_common_ndk_static", static_libs: [ @@ -97,8 +104,8 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common", - "android.media.audio.common.types", + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -145,7 +152,7 @@ aidl_interface { ], imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 6225fb3d66..5d63347569 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -60,11 +60,13 @@ cc_binary { cc_defaults { name: "aidlaudioeffectservice_defaults", + defaults: [ + "latest_android_media_audio_common_types_ndk_shared", + ], vendor: true, shared_libs: [ "libbase", "libbinder_ndk", - "android.media.audio.common.types-V1-ndk", "android.hardware.audio.effect-V1-ndk", ], cflags: [ diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 2e12e7e334..6ea7cef0e2 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -45,6 +45,7 @@ cc_test { cc_test { name: "VtsHalAudioEffectTargetTest", defaults: [ + "latest_android_media_audio_common_types_ndk_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -55,7 +56,6 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.media.audio.common.types-V1-ndk", "android.hardware.audio.effect-V1-ndk", ], cflags: [ diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index e5f7a4f8c1..03dab08f1f 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { srcs: ["android/hardware/automotive/audiocontrol/*.aidl"], imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -33,14 +33,14 @@ aidl_interface { version: "1", imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], }, { version: "2", imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], }, diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index 3d4be4828f..edac160e77 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -24,6 +24,8 @@ package { cc_test { name: "VtsAidlHalAudioControlTest", defaults: [ + "latest_android_media_audio_common_types_cpp_static", + "latest_android_hardware_audio_common_cpp_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -38,8 +40,6 @@ cc_test { ], static_libs: [ "android.hardware.automotive.audiocontrol-V2-cpp", - "android.hardware.audio.common-V1-cpp", - "android.media.audio.common.types-V1-cpp", "libgmock", ], test_suites: [ diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp index 426bf48e2f..27d43d3fc3 100644 --- a/soundtrigger/aidl/Android.bp +++ b/soundtrigger/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { ], stability: "vintf", imports: [ - "android.media.soundtrigger.types", + "android.media.soundtrigger.types-V1", ], backend: { cpp: { @@ -45,7 +45,7 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V2" +latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V1" // Modules that depend on android.hardware.soundtrigger3 directly can include // the following java_defaults to avoid explicitly managing dependency versions From 16579d8a76e6b61c104d493a36255446e56d7250 Mon Sep 17 00:00:00 2001 From: Rambo Wang Date: Wed, 7 Sep 2022 15:48:29 +0000 Subject: [PATCH 47/53] Enable java backend for IDumpstateDevice HAL Java backend of IDumpstateDevice AIDL service is used in Settings app to enable verbose vendor logging. Bug: 242634531 Test: make && make RunSettingsRoboTests Change-Id: I2aa1a7ae81e5b05aa7088c16bbb201f3a5d88a8e Merged-In: I2aa1a7ae81e5b05aa7088c16bbb201f3a5d88a8e (cherry picked from commit 531809e22d6c9dd6e6fafb44c0f14f0860eeb7c9) --- dumpstate/aidl/Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dumpstate/aidl/Android.bp b/dumpstate/aidl/Android.bp index d9acc7a59c..b250d74aa0 100644 --- a/dumpstate/aidl/Android.bp +++ b/dumpstate/aidl/Android.bp @@ -31,7 +31,8 @@ aidl_interface { enabled: false, }, java: { - enabled: false, + enabled: true, + sdk_version: "module_current", }, ndk: { vndk: { From 2842eb598d540fc000b74fb0eea3428479af22ba Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 31 Aug 2022 18:08:10 -0700 Subject: [PATCH 48/53] Add VHAL_SUPPORTED_PROPERTY_IDS to ref VHAL. Add the special property VHAL_SUPPORTED_PROPERTY_IDS to ref VHAL to test getting all property configs through multiiple requests. Test: atest DefaultConfigSupportedPropertyIdsTest Run gcar emulator and check HVAC property. Bug: 243449202 Change-Id: I9e7e8e798044c363548b879db1c4f39841362bbd Merged-In: I9e7e8e798044c363548b879db1c4f39841362bbd --- automotive/vehicle/2.0/default/Android.bp | 24 +++++++- .../default/impl/vhal_v2_0/DefaultConfig.h | 40 +++++++++++++ ...DefaultConfigSupportedPropertyIds_test.cpp | 56 +++++++++++++++++++ .../vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 4 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp index 0d3253b9f8..33e211ca8c 100644 --- a/automotive/vehicle/2.0/default/Android.bp +++ b/automotive/vehicle/2.0/default/Android.bp @@ -84,7 +84,10 @@ cc_library_static { name: "android.hardware.automotive.vehicle@2.0-default-impl-lib", vendor: true, defaults: ["vhal_v2_0_target_defaults"], - cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], + cflags: [ + "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", + "-DENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS", + ], srcs: [ "impl/vhal_v2_0/DefaultVehicleHal.cpp", "impl/vhal_v2_0/VehicleHalClient.cpp", @@ -225,6 +228,25 @@ cc_test { test_suites: ["general-tests"], } +cc_test { + name: "android.hardware.automotive.vehicle@2.0-default-config-test", + vendor: true, + defaults: ["vhal_v2_0_target_defaults"], + srcs: [ + "impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp", + ], + cflags: [ + "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", + "-DENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS", + ], + static_libs: [ + "android.hardware.automotive.vehicle@2.0-default-impl-lib", + "libgtest", + "libgmock", + ], + test_suites: ["general-tests"], +} + cc_binary { name: "android.hardware.automotive.vehicle@2.0-default-service", defaults: ["vhal_v2_0_target_defaults"], diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index e276a39314..55a7720fc2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1170,6 +1170,46 @@ const ConfigDeclaration kVehicleProperties[]{ }, }, #endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +#ifdef ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS + { + .config = + { + // VHAL_SUPPORTED_PROPERTY_IDS + .prop = 289476424, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + // Fetch 100 configs in one request. This number is just arbitrarily + // chosen here. But some HAL impl with bigger config data may need a + // smaller number. + .configArray = {100}, + }, + // All supported property IDs. This list is checked by + // DefaultConfigSupportedPropertyIds_test. + .initialValue = + {.int32Values = + {291504388, 289472773, 291504390, 289472775, 289407240, 289407241, + 289472780, 286261505, 286261506, 289407235, 289472779, 291504647, + 289408517, 356518832, 356516106, 291504644, 291504649, 291504656, + 291504901, 291504903, 287310600, 291504905, 287310602, 287310603, + 291504908, 291504904, 392168201, 392168202, 289408514, 289408001, + 287310850, 287310851, 287310853, 289475088, 289475104, 289475120, + 354419984, 320865540, 320865556, 354419975, 354419976, 354419986, + 354419973, 354419974, 354419978, 354419977, 356517120, 356517121, + 356582673, 356517139, 289408269, 356517131, 358614275, 291570965, + 291505923, 289408270, 289408512, 287310855, 289408000, 289408008, + 289408009, 289407747, 291504900, 568332561, 371198722, 373295872, + 320867268, 322964416, 290521862, 287310858, 287310859, 289475072, + 289475073, 289409539, 299896064, 299896065, 299896066, 299896067, + 289410560, 289410561, 289410562, 289410563, 289410576, 289410577, + 289410578, 289410579, 289476368, 299895808, 639631617, 627048706, + 591397123, 554696964, 289410873, 289410874, 287313669, 299896583, + 299896584, 299896585, 299896586, 299896587, 286265121, 286265122, + 286265123, 290457094, 290459441, 299896626, 290459443, 289410868, + 289476405, 299896630, 289410871, 292556600, 557853201, 559950353, + 555756049, 554707473, 289410887, 557846324, 557911861, 568332086, + 557846327, 560992056, 289476424}}, + }, +#endif // ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS }; } // impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp new file mode 100644 index 0000000000..aa05daafdc --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2022 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. + */ + +#include +#include +#include + +#include "vhal_v2_0/DefaultConfig.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { +namespace impl { + +using ::testing::ElementsAreArray; + +// Test that VHAL_SUPPORTED_PROPERTY_IDS contains all supported property IDs. +TEST(DefaultConfigSupportedPropertyIdsTest, testIncludeAllSupportedIds) { + const int32_t vhalSupportedPropertyIdsPropId = 289476424; + + std::vector allSupportedIds; + std::vector configuredSupportedIds; + + for (const auto& property : impl::kVehicleProperties) { + int propId = property.config.prop; + allSupportedIds.push_back(propId); + + if (propId == vhalSupportedPropertyIdsPropId) { + configuredSupportedIds = property.initialValue.int32Values; + } + } + + ASSERT_THAT(allSupportedIds, ElementsAreArray(configuredSupportedIds)); +} + +} // namespace impl +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index d35792d4b2..25a1940e0e 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)122, configs.size()); + EXPECT_EQ((size_t)123, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { From db060b4f8f1ae2d3407b0f2eba9631466917d84d Mon Sep 17 00:00:00 2001 From: shihchienc Date: Tue, 6 Sep 2022 08:44:44 +0000 Subject: [PATCH 49/53] Expose different offload audio capabilities by project The current LE audio offload capabilities is hardcode in the Bluetooth audio HAL. It has the limitation that all the project would expose the same capabilities. As the newer project comes, if the ADSP or the controller could handle more configuration with higher quality or higher bandwidth. It would impact older project may not work on it. So we plan the feature to make the le audio offload support to be more flexible. Bug: 238983662 Test: 1. atest VtsHalBluetoothAudioTargetTest 2. make sure offload capabilities can be supported with those devices having config XML file Change-Id: Id82581fdcd22e38108f17c7942bca997b53bab35 Merged-In: Id82581fdcd22e38108f17c7942bca997b53bab35 (cherry picked from commit 8ed901a977a9180b8edc79cd291be054c6e228b0) --- bluetooth/audio/utils/Android.bp | 16 +- .../aidl_session/BluetoothAudioCodecs.cpp | 113 +------ .../BluetoothLeAudioCodecsProvider.cpp | 312 ++++++++++++++++++ .../BluetoothLeAudioCodecsProvider.h | 87 +++++ .../le_audio_codec_capabilities.xml | 61 ++++ .../le_audio_codec_capabilities.xsd | 74 +++++ .../schema/current.txt | 111 +++++++ .../schema/last_current.txt | 0 .../schema/last_removed.txt | 0 .../schema/removed.txt | 1 + 10 files changed, 665 insertions(+), 110 deletions(-) create mode 100644 bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp create mode 100644 bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.h create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xml create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xsd create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/schema/current.txt create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_current.txt create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_removed.txt create mode 100644 bluetooth/audio/utils/le_audio_codec_capabilities/schema/removed.txt diff --git a/bluetooth/audio/utils/Android.bp b/bluetooth/audio/utils/Android.bp index d08cb0a8e6..674dd116cf 100644 --- a/bluetooth/audio/utils/Android.bp +++ b/bluetooth/audio/utils/Android.bp @@ -40,9 +40,13 @@ cc_library_shared { "aidl_session/BluetoothAudioCodecs.cpp", "aidl_session/BluetoothAudioSession.cpp", "aidl_session/HidlToAidlMiddleware.cpp", + "aidl_session/BluetoothLeAudioCodecsProvider.cpp", ], export_include_dirs: ["aidl_session/"], - header_libs: ["libhardware_headers"], + header_libs: [ + "libhardware_headers", + "libxsdc-utils", + ], shared_libs: [ "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth.audio@2.1", @@ -53,5 +57,15 @@ cc_library_shared { "liblog", "android.hardware.bluetooth.audio-V2-ndk", "libhidlbase", + "libxml2", ], + generated_sources: ["le_audio_codec_capabilities"], + generated_headers: ["le_audio_codec_capabilities"], +} + +xsd_config { + name: "le_audio_codec_capabilities", + srcs: ["le_audio_codec_capabilities/le_audio_codec_capabilities.xsd"], + package_name: "aidl.android.hardware.bluetooth.audio.setting", + api_dir: "le_audio_codec_capabilities/schema", } diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp index 036d6cd60e..855dd28718 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp @@ -32,6 +32,8 @@ #include #include +#include "BluetoothLeAudioCodecsProvider.h" + namespace aidl { namespace android { namespace hardware { @@ -96,67 +98,6 @@ const std::vector kDefaultOffloadA2dpCodecCapabilities = { std::vector kDefaultOffloadLeAudioCapabilities; -static const UnicastCapability kInvalidUnicastCapability = { - .codecType = CodecType::UNKNOWN}; - -static const BroadcastCapability kInvalidBroadcastCapability = { - .codecType = CodecType::UNKNOWN}; - -// Default Supported Codecs -// LC3 16_1: sample rate: 16 kHz, frame duration: 7.5 ms, octets per frame: 30 -static const Lc3Capabilities kLc3Capability_16_1 = { - .samplingFrequencyHz = {16000}, - .frameDurationUs = {7500}, - .octetsPerFrame = {30}}; - -// Default Supported Codecs -// LC3 16_2: sample rate: 16 kHz, frame duration: 10 ms, octets per frame: 40 -static const Lc3Capabilities kLc3Capability_16_2 = { - .samplingFrequencyHz = {16000}, - .frameDurationUs = {10000}, - .octetsPerFrame = {40}}; - -// Default Supported Codecs -// LC3 24_2: sample rate: 24 kHz, frame duration: 10 ms, octets per frame: 60 -static const Lc3Capabilities kLc3Capability_24_2 = { - .samplingFrequencyHz = {24000}, - .frameDurationUs = {10000}, - .octetsPerFrame = {60}}; - -// Default Supported Codecs -// LC3 32_2: sample rate: 32 kHz, frame duration: 10 ms, octets per frame: 80 -static const Lc3Capabilities kLc3Capability_32_2 = { - .samplingFrequencyHz = {32000}, - .frameDurationUs = {10000}, - .octetsPerFrame = {80}}; - -// Default Supported Codecs -// LC3 48_4: sample rate: 48 kHz, frame duration: 10 ms, octets per frame: 120 -static const Lc3Capabilities kLc3Capability_48_4 = { - .samplingFrequencyHz = {48000}, - .frameDurationUs = {10000}, - .octetsPerFrame = {120}}; - -static const std::vector supportedLc3CapabilityList = { - kLc3Capability_48_4, kLc3Capability_32_2, kLc3Capability_24_2, - kLc3Capability_16_2, kLc3Capability_16_1}; - -static AudioLocation stereoAudio = static_cast( - static_cast(AudioLocation::FRONT_LEFT) | - static_cast(AudioLocation::FRONT_RIGHT)); -static AudioLocation monoAudio = AudioLocation::UNKNOWN; - -// Stores the supported setting of audio location, connected device, and the -// channel count for each device -std::vector> - supportedDeviceSetting = { - // Stereo, two connected device, one for L one for R - std::make_tuple(stereoAudio, 2, 1), - // Stereo, one connected device for both L and R - std::make_tuple(stereoAudio, 1, 2), - // Mono - std::make_tuple(monoAudio, 1, 1)}; - template bool BluetoothAudioCodecs::ContainedInVector( const std::vector& vector, const typename identity::type& target) { @@ -444,19 +385,6 @@ bool BluetoothAudioCodecs::IsOffloadCodecConfigurationValid( return false; } -UnicastCapability composeUnicastLc3Capability( - AudioLocation audioLocation, uint8_t deviceCnt, uint8_t channelCount, - const Lc3Capabilities& capability) { - return { - .codecType = CodecType::LC3, - .supportedChannel = audioLocation, - .deviceCount = deviceCnt, - .channelCountPerDevice = channelCount, - .leAudioCodecCapabilities = - UnicastCapability::LeAudioCodecCapabilities(capability), - }; -} - std::vector BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities( const SessionType& session_type) { @@ -470,41 +398,8 @@ BluetoothAudioCodecs::GetLeAudioOffloadCodecCapabilities( } if (kDefaultOffloadLeAudioCapabilities.empty()) { - for (auto [audioLocation, deviceCnt, channelCount] : - supportedDeviceSetting) { - for (auto capability : supportedLc3CapabilityList) { - UnicastCapability lc3Capability = composeUnicastLc3Capability( - audioLocation, deviceCnt, channelCount, capability); - UnicastCapability lc3MonoDecodeCapability = - composeUnicastLc3Capability(monoAudio, 1, 1, capability); - - // Adds the capability for encode only - kDefaultOffloadLeAudioCapabilities.push_back( - {.unicastEncodeCapability = lc3Capability, - .unicastDecodeCapability = kInvalidUnicastCapability, - .broadcastCapability = kInvalidBroadcastCapability}); - - // Adds the capability for decode only - kDefaultOffloadLeAudioCapabilities.push_back( - {.unicastEncodeCapability = kInvalidUnicastCapability, - .unicastDecodeCapability = lc3Capability, - .broadcastCapability = kInvalidBroadcastCapability}); - - // Adds the capability for the case that encode and decode exist at the - // same time(force one active device for decode) - kDefaultOffloadLeAudioCapabilities.push_back( - {.unicastEncodeCapability = lc3Capability, - .unicastDecodeCapability = lc3MonoDecodeCapability, - .broadcastCapability = kInvalidBroadcastCapability}); - - // Adds the capability for the case that encode and decode exist at the - // same time - kDefaultOffloadLeAudioCapabilities.push_back( - {.unicastEncodeCapability = lc3Capability, - .unicastDecodeCapability = lc3Capability, - .broadcastCapability = kInvalidBroadcastCapability}); - } - } + kDefaultOffloadLeAudioCapabilities = + BluetoothLeAudioCodecsProvider::GetLeAudioCodecCapabilities(); } return kDefaultOffloadLeAudioCapabilities; diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp new file mode 100644 index 0000000000..bf492706c8 --- /dev/null +++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "BTAudioCodecsProviderAidl" + +#include "BluetoothLeAudioCodecsProvider.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace bluetooth { +namespace audio { + +static const char* kLeAudioCodecCapabilitiesFile = + "/vendor/etc/le_audio_codec_capabilities.xml"; + +static const AudioLocation kStereoAudio = static_cast( + static_cast(AudioLocation::FRONT_LEFT) | + static_cast(AudioLocation::FRONT_RIGHT)); +static const AudioLocation kMonoAudio = AudioLocation::UNKNOWN; + +static std::vector leAudioCodecCapabilities; + +std::vector +BluetoothLeAudioCodecsProvider::GetLeAudioCodecCapabilities() { + if (!leAudioCodecCapabilities.empty()) { + return leAudioCodecCapabilities; + } + + const auto le_audio_offload_setting = + setting::readLeAudioOffloadSetting(kLeAudioCodecCapabilitiesFile); + if (!le_audio_offload_setting.has_value()) { + LOG(ERROR) << __func__ << ": Failed to read " + << kLeAudioCodecCapabilitiesFile; + return {}; + } + + std::vector supported_scenarios = + GetScenarios(le_audio_offload_setting); + if (supported_scenarios.empty()) { + LOG(ERROR) << __func__ << ": No scenarios in " + << kLeAudioCodecCapabilitiesFile; + return {}; + } + + UpdateConfigurationsToMap(le_audio_offload_setting); + if (configuration_map_.empty()) { + LOG(ERROR) << __func__ << ": No configurations in " + << kLeAudioCodecCapabilitiesFile; + return {}; + } + + UpdateCodecConfigurationsToMap(le_audio_offload_setting); + if (codec_configuration_map_.empty()) { + LOG(ERROR) << __func__ << ": No codec configurations in " + << kLeAudioCodecCapabilitiesFile; + return {}; + } + + UpdateStrategyConfigurationsToMap(le_audio_offload_setting); + if (strategy_configuration_map_.empty()) { + LOG(ERROR) << __func__ << ": No strategy configurations in " + << kLeAudioCodecCapabilitiesFile; + return {}; + } + + leAudioCodecCapabilities = + ComposeLeAudioCodecCapabilities(supported_scenarios); + return leAudioCodecCapabilities; +} + +std::vector BluetoothLeAudioCodecsProvider::GetScenarios( + const std::optional& + le_audio_offload_setting) { + std::vector supported_scenarios; + if (le_audio_offload_setting->hasScenarioList()) { + for (const auto& scenario_list : + le_audio_offload_setting->getScenarioList()) { + if (!scenario_list.hasScenario()) { + continue; + } + for (const auto& scenario : scenario_list.getScenario()) { + if (scenario.hasEncode() && scenario.hasDecode()) { + supported_scenarios.push_back(scenario); + } + } + } + } + return supported_scenarios; +} + +void BluetoothLeAudioCodecsProvider::UpdateConfigurationsToMap( + const std::optional& + le_audio_offload_setting) { + if (le_audio_offload_setting->hasConfigurationList()) { + for (const auto& configuration_list : + le_audio_offload_setting->getConfigurationList()) { + if (!configuration_list.hasConfiguration()) { + continue; + } + for (const auto& configuration : configuration_list.getConfiguration()) { + if (configuration.hasName() && configuration.hasCodecConfiguration() && + configuration.hasStrategyConfiguration()) { + configuration_map_.insert( + make_pair(configuration.getName(), configuration)); + } + } + } + } +} + +void BluetoothLeAudioCodecsProvider::UpdateCodecConfigurationsToMap( + const std::optional& + le_audio_offload_setting) { + if (le_audio_offload_setting->hasCodecConfigurationList()) { + for (const auto& codec_configuration_list : + le_audio_offload_setting->getCodecConfigurationList()) { + if (!codec_configuration_list.hasCodecConfiguration()) { + continue; + } + for (const auto& codec_configuration : + codec_configuration_list.getCodecConfiguration()) { + if (IsValidCodecConfiguration(codec_configuration)) { + codec_configuration_map_.insert( + make_pair(codec_configuration.getName(), codec_configuration)); + } + } + } + } +} + +void BluetoothLeAudioCodecsProvider::UpdateStrategyConfigurationsToMap( + const std::optional& + le_audio_offload_setting) { + if (le_audio_offload_setting->hasStrategyConfigurationList()) { + for (const auto& strategy_configuration_list : + le_audio_offload_setting->getStrategyConfigurationList()) { + if (!strategy_configuration_list.hasStrategyConfiguration()) { + continue; + } + for (const auto& strategy_configuration : + strategy_configuration_list.getStrategyConfiguration()) { + if (IsValidStrategyConfiguration(strategy_configuration)) { + strategy_configuration_map_.insert(make_pair( + strategy_configuration.getName(), strategy_configuration)); + } + } + } + } +} + +std::vector +BluetoothLeAudioCodecsProvider::ComposeLeAudioCodecCapabilities( + const std::vector& supported_scenarios) { + std::vector le_audio_codec_capabilities; + for (const auto& scenario : supported_scenarios) { + UnicastCapability unicast_encode_capability = + GetUnicastCapability(scenario.getEncode()); + UnicastCapability unicast_decode_capability = + GetUnicastCapability(scenario.getDecode()); + // encode and decode cannot be unknown at the same time + if (unicast_encode_capability.codecType == CodecType::UNKNOWN && + unicast_decode_capability.codecType == CodecType::UNKNOWN) { + continue; + } + BroadcastCapability broadcast_capability = {.codecType = + CodecType::UNKNOWN}; + le_audio_codec_capabilities.push_back( + {.unicastEncodeCapability = unicast_encode_capability, + .unicastDecodeCapability = unicast_decode_capability, + .broadcastCapability = broadcast_capability}); + } + return le_audio_codec_capabilities; +} + +UnicastCapability BluetoothLeAudioCodecsProvider::GetUnicastCapability( + const std::string& coding_direction) { + if (coding_direction == "invalid") { + return {.codecType = CodecType::UNKNOWN}; + } + + auto configuration_iter = configuration_map_.find(coding_direction); + if (configuration_iter == configuration_map_.end()) { + return {.codecType = CodecType::UNKNOWN}; + } + + auto codec_configuration_iter = codec_configuration_map_.find( + configuration_iter->second.getCodecConfiguration()); + if (codec_configuration_iter == codec_configuration_map_.end()) { + return {.codecType = CodecType::UNKNOWN}; + } + + auto strategy_configuration_iter = strategy_configuration_map_.find( + configuration_iter->second.getStrategyConfiguration()); + if (strategy_configuration_iter == strategy_configuration_map_.end()) { + return {.codecType = CodecType::UNKNOWN}; + } + + CodecType codec_type = + GetCodecType(codec_configuration_iter->second.getCodec()); + if (codec_type == CodecType::LC3) { + return ComposeUnicastCapability( + codec_type, + GetAudioLocation( + strategy_configuration_iter->second.getAudioLocation()), + strategy_configuration_iter->second.getConnectedDevice(), + strategy_configuration_iter->second.getChannelCount(), + ComposeLc3Capability(codec_configuration_iter->second)); + } + return {.codecType = CodecType::UNKNOWN}; +} + +template +UnicastCapability BluetoothLeAudioCodecsProvider::ComposeUnicastCapability( + const CodecType& codec_type, const AudioLocation& audio_location, + const uint8_t& device_cnt, const uint8_t& channel_count, + const T& capability) { + return { + .codecType = codec_type, + .supportedChannel = audio_location, + .deviceCount = device_cnt, + .channelCountPerDevice = channel_count, + .leAudioCodecCapabilities = + UnicastCapability::LeAudioCodecCapabilities(capability), + }; +} + +Lc3Capabilities BluetoothLeAudioCodecsProvider::ComposeLc3Capability( + const setting::CodecConfiguration& codec_configuration) { + return {.samplingFrequencyHz = {codec_configuration.getSamplingFrequency()}, + .frameDurationUs = {codec_configuration.getFrameDurationUs()}, + .octetsPerFrame = {codec_configuration.getOctetsPerCodecFrame()}}; +} + +AudioLocation BluetoothLeAudioCodecsProvider::GetAudioLocation( + const setting::AudioLocation& audio_location) { + switch (audio_location) { + case setting::AudioLocation::MONO: + return kMonoAudio; + case setting::AudioLocation::STEREO: + return kStereoAudio; + default: + return AudioLocation::UNKNOWN; + } +} + +CodecType BluetoothLeAudioCodecsProvider::GetCodecType( + const setting::CodecType& codec_type) { + switch (codec_type) { + case setting::CodecType::LC3: + return CodecType::LC3; + default: + return CodecType::UNKNOWN; + } +} + +bool BluetoothLeAudioCodecsProvider::IsValidCodecConfiguration( + const setting::CodecConfiguration& codec_configuration) { + return codec_configuration.hasName() && codec_configuration.hasCodec() && + codec_configuration.hasSamplingFrequency() && + codec_configuration.hasFrameDurationUs() && + codec_configuration.hasOctetsPerCodecFrame(); +} + +bool BluetoothLeAudioCodecsProvider::IsValidStrategyConfiguration( + const setting::StrategyConfiguration& strategy_configuration) { + if (!strategy_configuration.hasName() || + !strategy_configuration.hasAudioLocation() || + !strategy_configuration.hasConnectedDevice() || + !strategy_configuration.hasChannelCount()) { + return false; + } + if (strategy_configuration.getAudioLocation() == + setting::AudioLocation::STEREO) { + if ((strategy_configuration.getConnectedDevice() == 2 && + strategy_configuration.getChannelCount() == 1) || + (strategy_configuration.getConnectedDevice() == 1 && + strategy_configuration.getChannelCount() == 2)) { + // Stereo + // 1. two connected device, one for L one for R + // 2. one connected device for both L and R + return true; + } + } else if (strategy_configuration.getAudioLocation() == + setting::AudioLocation::MONO) { + if (strategy_configuration.getConnectedDevice() == 1 && + strategy_configuration.getChannelCount() == 1) { + // Mono + return true; + } + } + return false; +} + +} // namespace audio +} // namespace bluetooth +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.h b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.h new file mode 100644 index 0000000000..402235f0cd --- /dev/null +++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2022 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. + */ + +#pragma once + +#include +#include + +#include + +#include "aidl_android_hardware_bluetooth_audio_setting.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace bluetooth { +namespace audio { + +class BluetoothLeAudioCodecsProvider { + public: + static std::vector + GetLeAudioCodecCapabilities(); + + private: + static inline std::unordered_map + configuration_map_; + static inline std::unordered_map + codec_configuration_map_; + static inline std::unordered_map + strategy_configuration_map_; + + static std::vector GetScenarios( + const std::optional& + le_audio_offload_setting); + static void UpdateConfigurationsToMap( + const std::optional& + le_audio_offload_setting); + static void UpdateCodecConfigurationsToMap( + const std::optional& + le_audio_offload_setting); + static void UpdateStrategyConfigurationsToMap( + const std::optional& + le_audio_offload_setting); + + static std::vector + ComposeLeAudioCodecCapabilities( + const std::vector& supported_scenarios); + + static UnicastCapability GetUnicastCapability( + const std::string& coding_direction); + template + static inline UnicastCapability ComposeUnicastCapability( + const CodecType& codec_type, const AudioLocation& audio_location, + const uint8_t& device_cnt, const uint8_t& channel_count, + const T& capability); + + static inline Lc3Capabilities ComposeLc3Capability( + const setting::CodecConfiguration& codec_configuration); + + static inline AudioLocation GetAudioLocation( + const setting::AudioLocation& audio_location); + static inline CodecType GetCodecType(const setting::CodecType& codec_type); + + static inline bool IsValidCodecConfiguration( + const setting::CodecConfiguration& codec_configuration); + static inline bool IsValidStrategyConfiguration( + const setting::StrategyConfiguration& strategy_configuration); +}; + +} // namespace audio +} // namespace bluetooth +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xml b/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xml new file mode 100644 index 0000000000..c7904b338c --- /dev/null +++ b/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xsd b/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xsd new file mode 100644 index 0000000000..213e5974da --- /dev/null +++ b/bluetooth/audio/utils/le_audio_codec_capabilities/le_audio_codec_capabilities.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/schema/current.txt b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/current.txt new file mode 100644 index 0000000000..06aa21a7b3 --- /dev/null +++ b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/current.txt @@ -0,0 +1,111 @@ +// Signature format: 2.0 +package aidl.android.hardware.bluetooth.audio.setting { + + public enum AudioLocation { + method public String getRawName(); + enum_constant public static final aidl.android.hardware.bluetooth.audio.setting.AudioLocation MONO; + enum_constant public static final aidl.android.hardware.bluetooth.audio.setting.AudioLocation STEREO; + } + + public class CodecConfiguration { + ctor public CodecConfiguration(); + method public aidl.android.hardware.bluetooth.audio.setting.CodecType getCodec(); + method public short getCodecFrameBlocksPerSdu(); + method public int getFrameDurationUs(); + method public String getName(); + method public int getOctetsPerCodecFrame(); + method public short getPcmBitDepth(); + method public int getSamplingFrequency(); + method public void setCodec(aidl.android.hardware.bluetooth.audio.setting.CodecType); + method public void setCodecFrameBlocksPerSdu(short); + method public void setFrameDurationUs(int); + method public void setName(String); + method public void setOctetsPerCodecFrame(int); + method public void setPcmBitDepth(short); + method public void setSamplingFrequency(int); + } + + public class CodecConfigurationList { + ctor public CodecConfigurationList(); + method public java.util.List getCodecConfiguration(); + } + + public enum CodecType { + method public String getRawName(); + enum_constant public static final aidl.android.hardware.bluetooth.audio.setting.CodecType LC3; + } + + public class Configuration { + ctor public Configuration(); + method public String getCodecConfiguration(); + method public String getName(); + method public String getStrategyConfiguration(); + method public void setCodecConfiguration(String); + method public void setName(String); + method public void setStrategyConfiguration(String); + } + + public class ConfigurationList { + ctor public ConfigurationList(); + method public java.util.List getConfiguration(); + } + + public class LeAudioOffloadSetting { + ctor public LeAudioOffloadSetting(); + method public aidl.android.hardware.bluetooth.audio.setting.CodecConfigurationList getCodecConfigurationList(); + method public aidl.android.hardware.bluetooth.audio.setting.ConfigurationList getConfigurationList(); + method public aidl.android.hardware.bluetooth.audio.setting.ScenarioList getScenarioList(); + method public aidl.android.hardware.bluetooth.audio.setting.StrategyConfigurationList getStrategyConfigurationList(); + method public void setCodecConfigurationList(aidl.android.hardware.bluetooth.audio.setting.CodecConfigurationList); + method public void setConfigurationList(aidl.android.hardware.bluetooth.audio.setting.ConfigurationList); + method public void setScenarioList(aidl.android.hardware.bluetooth.audio.setting.ScenarioList); + method public void setStrategyConfigurationList(aidl.android.hardware.bluetooth.audio.setting.StrategyConfigurationList); + } + + public class Scenario { + ctor public Scenario(); + method public String getDecode(); + method public String getEncode(); + method public void setDecode(String); + method public void setEncode(String); + } + + public class ScenarioList { + ctor public ScenarioList(); + method public java.util.List getScenario(); + } + + public class StrategyConfiguration { + ctor public StrategyConfiguration(); + method public aidl.android.hardware.bluetooth.audio.setting.AudioLocation getAudioLocation(); + method public short getChannelCount(); + method public short getConnectedDevice(); + method public String getName(); + method public void setAudioLocation(aidl.android.hardware.bluetooth.audio.setting.AudioLocation); + method public void setChannelCount(short); + method public void setConnectedDevice(short); + method public void setName(String); + } + + public class StrategyConfigurationList { + ctor public StrategyConfigurationList(); + method public java.util.List getStrategyConfiguration(); + } + + public class XmlParser { + ctor public XmlParser(); + method public static aidl.android.hardware.bluetooth.audio.setting.CodecConfiguration readCodecConfiguration(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.CodecConfigurationList readCodecConfigurationList(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.Configuration readConfiguration(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.ConfigurationList readConfigurationList(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.LeAudioOffloadSetting readLeAudioOffloadSetting(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.Scenario readScenario(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.ScenarioList readScenarioList(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.StrategyConfiguration readStrategyConfiguration(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static aidl.android.hardware.bluetooth.audio.setting.StrategyConfigurationList readStrategyConfigurationList(java.io.InputStream) throws javax.xml.datatype.DatatypeConfigurationException, java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static String readText(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + method public static void skip(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException; + } + +} + diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_current.txt b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_current.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_removed.txt b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/last_removed.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bluetooth/audio/utils/le_audio_codec_capabilities/schema/removed.txt b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/removed.txt new file mode 100644 index 0000000000..d802177e24 --- /dev/null +++ b/bluetooth/audio/utils/le_audio_codec_capabilities/schema/removed.txt @@ -0,0 +1 @@ +// Signature format: 2.0 From adeb7aa0e1fa5608ae41144fb0b056c0d3d274f6 Mon Sep 17 00:00:00 2001 From: Alice Kuo Date: Thu, 25 Aug 2022 02:45:02 +0800 Subject: [PATCH 50/53] Add soft_audio_configuration_changed_cb_ to handle the streamMap changed Based on the stream status and Bluetooth Audio Session to switch the different configuration_changed_cb_ notifcation. audio_configuration_changed_cb_ for the context type handover case soft_audio_configuration_changed_cb_ for the streamMap changed during media stream case Bug: 231084798 Test: LE audio offload later join and disappear with downmix enable Change-Id: I199c2b765b128875fb2c66abb1a500e4a6c820b7 Merged-In: I199c2b765b128875fb2c66abb1a500e4a6c820b7 (cherry picked from commit 851ef342ede367375ea46215cfdf3a449e7b8ef4) --- .../aidl_session/BluetoothAudioSession.cpp | 78 +++++++++++++++++-- .../aidl_session/BluetoothAudioSession.h | 16 ++++ .../BluetoothAudioSessionControl.h | 19 +++++ 3 files changed, 108 insertions(+), 5 deletions(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 292d352b9c..2b0caadeae 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -60,12 +60,14 @@ void BluetoothAudioSession::OnSessionStarted( LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_) << " MqDescriptor Invalid"; audio_config_ = nullptr; + leaudio_connection_map_ = nullptr; } else { stack_iface_ = stack_iface; latency_modes_ = latency_modes; LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << ", AudioConfiguration=" << audio_config.toString(); ReportSessionStatus(); + is_streaming_ = false; } } @@ -74,11 +76,13 @@ void BluetoothAudioSession::OnSessionEnded() { bool toggled = IsSessionReady(); LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); audio_config_ = nullptr; + leaudio_connection_map_ = nullptr; stack_iface_ = nullptr; UpdateDataPath(nullptr); if (toggled) { ReportSessionStatus(); } + is_streaming_ = false; } /*** @@ -106,18 +110,72 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() { return *audio_config_; } +const AudioConfiguration BluetoothAudioSession::GetLeAudioConnectionMap() { + std::lock_guard guard(mutex_); + if (!IsSessionReady()) { + return AudioConfiguration(LeAudioConfiguration{}); + } + return *leaudio_connection_map_; +} + void BluetoothAudioSession::ReportAudioConfigChanged( const AudioConfiguration& audio_config) { if (session_type_ != SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH && session_type_ != - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH && - session_type_ != - SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH) { + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) { return; } + std::lock_guard guard(mutex_); - audio_config_ = std::make_unique(audio_config); + if (audio_config.getTag() != AudioConfiguration::leAudioConfig) { + LOG(ERROR) << __func__ << " invalid audio config type for SessionType =" + << toString(session_type_); + return; + } + + if (is_streaming_) { + if (audio_config_ == nullptr) { + LOG(ERROR) << __func__ << " for SessionType=" << toString(session_type_) + << " audio_config_ is nullptr during streaming. It shouldn't " + "be happened"; + return; + } + + auto new_leaudio_config = + audio_config.get(); + auto current_leaudio_config = + (*audio_config_).get(); + if (new_leaudio_config.codecType != current_leaudio_config.codecType) { + LOG(ERROR) + << __func__ << " for SessionType=" << toString(session_type_) + << " codec type changed during streaming. It shouldn't be happened "; + } + auto new_lc3_config = new_leaudio_config.leAudioCodecConfig + .get(); + auto current_lc3_config = current_leaudio_config.leAudioCodecConfig + .get(); + if ((new_lc3_config.pcmBitDepth != current_lc3_config.pcmBitDepth) || + (new_lc3_config.samplingFrequencyHz != + current_lc3_config.samplingFrequencyHz) || + (new_lc3_config.frameDurationUs != + current_lc3_config.frameDurationUs) || + (new_lc3_config.octetsPerFrame != current_lc3_config.octetsPerFrame) || + (new_lc3_config.blocksPerSdu != current_lc3_config.blocksPerSdu)) { + LOG(ERROR) + << __func__ << " for SessionType=" << toString(session_type_) + << " lc3 config changed during streaming. It shouldn't be happened"; + return; + } + + leaudio_connection_map_ = + std::make_unique(audio_config); + } else { + audio_config_ = std::make_unique(audio_config); + leaudio_connection_map_ = + std::make_unique(audio_config); + } + if (observers_.empty()) { LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_) << " has NO port state observer"; @@ -129,7 +187,11 @@ void BluetoothAudioSession::ReportAudioConfigChanged( LOG(INFO) << __func__ << " for SessionType=" << toString(session_type_) << ", bluetooth_audio=0x" << ::android::base::StringPrintf("%04x", cookie); - if (cb->audio_configuration_changed_cb_ != nullptr) { + if (is_streaming_) { + if (cb->soft_audio_configuration_changed_cb_ != nullptr) { + cb->soft_audio_configuration_changed_cb_(cookie); + } + } else if (cb->audio_configuration_changed_cb_ != nullptr) { cb->audio_configuration_changed_cb_(cookie); } } @@ -419,6 +481,12 @@ void BluetoothAudioSession::ReportControlStatus(bool start_resp, << " has NO port state observer"; return; } + if (start_resp && status == BluetoothAudioStatus::SUCCESS) { + is_streaming_ = true; + } else if (!start_resp && (status == BluetoothAudioStatus::SUCCESS || + status == BluetoothAudioStatus::RECONFIGURATION)) { + is_streaming_ = false; + } for (auto& observer : observers_) { uint16_t cookie = observer.first; std::shared_ptr callback = observer.second; diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h index 5bf17bd3d2..faf4ffbabe 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h @@ -102,6 +102,13 @@ struct PortStatusCallbacks { ***/ std::function low_latency_mode_allowed_cb_; + /*** + * soft_audio_configuration_changed_cb_ - when the Bluetooth stack change + * the streamMap during the streaming, the BluetoothAudioProvider will invoke + * this callback to report to the bluetooth_audio module. + * @param: cookie - indicates which bluetooth_audio output should handle + ***/ + std::function soft_audio_configuration_changed_cb_; }; class BluetoothAudioSession { @@ -158,6 +165,12 @@ class BluetoothAudioSession { ***/ const AudioConfiguration GetAudioConfig(); + /*** + * The control function is for the bluetooth_audio module to get the current + * LE audio connection map + ***/ + const AudioConfiguration GetLeAudioConnectionMap(); + /*** * The report function is used to report that the Bluetooth stack has notified * the audio configuration changed, and will invoke @@ -206,8 +219,11 @@ class BluetoothAudioSession { std::unique_ptr data_mq_; // audio data configuration for both software and offloading std::unique_ptr audio_config_; + std::unique_ptr leaudio_connection_map_; std::vector latency_modes_; bool low_latency_allowed_ = true; + // saving those steaming state based on the session_type + bool is_streaming_ = false; // saving those registered bluetooth_audio's callbacks std::unordered_map> diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h index 0782c824e1..881c6c10b2 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h @@ -94,6 +94,25 @@ class BluetoothAudioSessionControl { } } + /*** + * The control API for the bluetooth_audio module to get current + * LE audio connection map + ***/ + static const AudioConfiguration GetLeAudioConnectionMap( + const SessionType& session_type) { + std::shared_ptr session_ptr = + BluetoothAudioSessionInstance::GetSessionInstance(session_type); + if ((session_type == + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || + session_type == + SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) && + session_ptr != nullptr) { + return session_ptr->GetLeAudioConnectionMap(); + } + + return AudioConfiguration(LeAudioConfiguration{}); + } + /*** * Those control APIs for the bluetooth_audio module to start / suspend / stop From 8fb96d255e2836e90175693de4a922e052d73bef Mon Sep 17 00:00:00 2001 From: Chase Wu Date: Tue, 20 Sep 2022 13:38:57 +0800 Subject: [PATCH 51/53] Fix VtsHalVibratorManagerTargetTest test fail Adding the cancelSynced() once prepareSynced() was called and return ok. Fix: 247687286 Test: atest VtsHalVibratorManagerTargetTest Signed-off-by: Chase Wu Change-Id: I91e08e92cb8e1399eb6acdbedf95958fbf44c393 --- vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp index 44fa3be7ab..e8ed26ab69 100644 --- a/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp +++ b/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp @@ -96,6 +96,7 @@ TEST_P(VibratorAidl, ValidatePrepareSyncedExistingVibrators) { if (!(capabilities & IVibratorManager::CAP_SYNC)) return; if (vibratorIds.empty()) return; EXPECT_TRUE(manager->prepareSynced(vibratorIds).isOk()); + EXPECT_TRUE(manager->cancelSynced().isOk()); } TEST_P(VibratorAidl, PrepareSyncedEmptySetIsInvalid) { @@ -208,6 +209,7 @@ TEST_P(VibratorAidl, TriggerCallbackNotSupported) { EXPECT_TRUE(manager->prepareSynced(vibratorIds).isOk()); Status status = manager->triggerSynced(callback); EXPECT_TRUE(isUnknownOrUnsupported(status)) << status; + EXPECT_TRUE(manager->cancelSynced().isOk()); } } From fc74dada36d4b830edb726868cbb54018da8f03c Mon Sep 17 00:00:00 2001 From: shihchienc Date: Fri, 23 Sep 2022 08:18:05 +0000 Subject: [PATCH 52/53] Update Bluetoot Audio HAL Target Test Since we change the design of loading LE Audio Capabilities in BT Audio HAL, we update the VTS test to make sure no matter a device supports LE Audio Offload or not, it can pass all tests that they should pass. Also, update vts test to match C++ coding style. Bug: 248181252 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: Ie46c86663e0a22627c324f96360063cd4d4874e4 Merged-In: Ie46c86663e0a22627c324f96360063cd4d4874e4 (cherry picked from commit 3ab9f5e2f0b7510c7488e04e7a13a9ef855f120b) --- .../vts/VtsHalBluetoothAudioTargetTest.cpp | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index ebd728db34..e9b74b771c 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -248,7 +249,8 @@ class BluetoothAudioProviderFactoryAidl case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH: case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH: case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH: { - ASSERT_FALSE(temp_provider_capabilities_.empty()); + // empty capability means offload is unsupported since capabilities are + // not hardcoded for (auto audio_capability : temp_provider_capabilities_) { ASSERT_EQ(audio_capability.getTag(), AudioCapabilities::leAudioCapabilities); @@ -513,8 +515,9 @@ class BluetoothAudioProviderFactoryAidl for (auto channel_mode : opus_capability->channelMode) { OpusConfiguration opus_data{ .samplingFrequencyHz = samplingFrequencyHz, + .frameDurationUs = frameDurationUs, .channelMode = channel_mode, - .frameDurationUs = frameDurationUs}; + }; opus_codec_specifics.push_back( CodecConfiguration::CodecSpecific(opus_data)); } @@ -623,8 +626,8 @@ TEST_P(BluetoothAudioProviderA2dpEncodingSoftwareAidl, for (auto channel_mode : a2dp_channel_modes) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, }; bool is_codec_config_valid = IsPcmConfigSupported(pcm_config); DataMQDesc mq_desc; @@ -937,8 +940,8 @@ TEST_P(BluetoothAudioProviderHearingAidSoftwareAidl, for (auto channel_mode : hearing_aid_channel_modes_) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, }; bool is_codec_config_valid = IsPcmConfigSupported(pcm_config); DataMQDesc mq_desc; @@ -1008,8 +1011,8 @@ TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareAidl, for (auto data_interval_us : le_audio_output_data_interval_us_) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, .dataIntervalUs = data_interval_us, }; bool is_codec_config_valid = @@ -1081,8 +1084,8 @@ TEST_P(BluetoothAudioProviderLeAudioInputSoftwareAidl, for (auto data_interval_us : le_audio_input_data_interval_us_) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, .dataIntervalUs = data_interval_us, }; bool is_codec_config_valid = @@ -1144,7 +1147,7 @@ class BluetoothAudioProviderLeAudioOutputHardwareAidl bool supported) { std::vector le_audio_codec_configs; if (!supported) { - Lc3Configuration lc3_config{.samplingFrequencyHz = 0, .pcmBitDepth = 0}; + Lc3Configuration lc3_config{.pcmBitDepth = 0, .samplingFrequencyHz = 0}; le_audio_codec_configs.push_back(lc3_config); return le_audio_codec_configs; } @@ -1428,8 +1431,8 @@ TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl, for (auto data_interval_us : le_audio_output_data_interval_us_) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, .dataIntervalUs = data_interval_us, }; bool is_codec_config_valid = @@ -1490,7 +1493,7 @@ class BluetoothAudioProviderLeAudioBroadcastHardwareAidl std::vector GetBroadcastLc3SupportedList(bool supported) { std::vector le_audio_codec_configs; if (!supported) { - Lc3Configuration lc3_config{.samplingFrequencyHz = 0, .pcmBitDepth = 0}; + Lc3Configuration lc3_config{.pcmBitDepth = 0, .samplingFrequencyHz = 0}; le_audio_codec_configs.push_back(lc3_config); return le_audio_codec_configs; } @@ -1650,8 +1653,8 @@ TEST_P(BluetoothAudioProviderA2dpDecodingSoftwareAidl, for (auto channel_mode : a2dp_channel_modes) { PcmConfiguration pcm_config{ .sampleRateHz = sample_rate, - .bitsPerSample = bits_per_sample, .channelMode = channel_mode, + .bitsPerSample = bits_per_sample, }; bool is_codec_config_valid = IsPcmConfigSupported(pcm_config); DataMQDesc mq_desc; From 1437e0139aa24bdbd57d6fb854613d494d7d88bc Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 18 Nov 2022 19:42:01 +0000 Subject: [PATCH 53/53] allocator frozen false magic -> explicit Bug: 259465531 Test: N/A Merged-In: I56b04a0f682a0ba3dc58a42c0a14bb506591c594 Change-Id: I56b04a0f682a0ba3dc58a42c0a14bb506591c594 (cherry picked from commit f65553745b87f3716f8390ec7c37d1a634fa6d35) --- graphics/allocator/aidl/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 6dc983c4d6..9edc555943 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -39,6 +39,7 @@ aidl_interface { min_sdk_version: "29", }, }, + frozen: false, versions_with_info: [ { version: "1",