From d42361e3d1ca707b1c5987652ed311b240b79fff Mon Sep 17 00:00:00 2001 From: jiabin Date: Tue, 4 Dec 2018 11:09:03 -0800 Subject: [PATCH 1/5] [Master port] Add haptic channel mask. This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. Bug: 111454766 Bug: 124247199 Test: build Change-Id: I00c28aa02473ce83b0d9b404b5cf33410c73a2c8 Merged-In: I00c28aa02473ce83b0d9b404b5cf33410c73a2c8 --- audio/common/5.0/types.hal | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index 2ce2929dce..e5919cbc22 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -376,6 +376,16 @@ enum AudioChannelMask : uint32_t { OUT_TOP_SIDE_LEFT = 0x40000, OUT_TOP_SIDE_RIGHT = 0x80000, + /** + * Haptic channel characteristics are specific to a device and + * only used to play device specific resources (eg: ringtones). + * The HAL can freely map A and B to haptic controllers, the + * framework shall not interpret those values and forward them + * from the device audio assets. + */ + OUT_HAPTIC_A = 0x20000000, + OUT_HAPTIC_B = 0x10000000, + OUT_MONO = OUT_FRONT_LEFT, OUT_STEREO = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT), OUT_2POINT1 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_LOW_FREQUENCY), @@ -423,6 +433,12 @@ enum AudioChannelMask : uint32_t { OUT_7POINT1POINT4 = (OUT_7POINT1 | OUT_TOP_FRONT_LEFT | OUT_TOP_FRONT_RIGHT | OUT_TOP_BACK_LEFT | OUT_TOP_BACK_RIGHT), + OUT_MONO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_HAPTIC_A), + OUT_STEREO_HAPTIC_A = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_HAPTIC_A), + OUT_HAPTIC_AB = (OUT_HAPTIC_A | OUT_HAPTIC_B), + OUT_MONO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_HAPTIC_A | OUT_HAPTIC_B), + OUT_STEREO_HAPTIC_AB = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | + OUT_HAPTIC_A | OUT_HAPTIC_B), // Note that the 2.0 OUT_ALL* have been moved to helper functions /* These are bits only, not complete values */ From 9c140b452a082071d145fcc31637de9d2d2f1be5 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 11 Dec 2018 15:52:14 -0800 Subject: [PATCH 2/5] [Master port] Audio HAL: Add optional Destination to SinkMetadata This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. Currently this is used to indicate the output device when the input stream is from an intermediate processing module like MSD. Bug: 124247199 Bug: 120859615 Test: make Change-Id: I60bac5c24a263ab0b8965e9dbf9514445e88c270 Merged-In: I60bac5c24a263ab0b8965e9dbf9514445e88c270 --- audio/common/5.0/Android.bp | 4 ++++ audio/common/5.0/types.hal | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp index c17f1442c6..86d935475f 100644 --- a/audio/common/5.0/Android.bp +++ b/audio/common/5.0/Android.bp @@ -9,6 +9,9 @@ hidl_interface { srcs: [ "types.hal", ], + interfaces: [ + "android.hidl.safe_union@1.0", + ], types: [ "AudioChannelMask", "AudioConfig", @@ -38,6 +41,7 @@ hidl_interface { "AudioSource", "AudioStreamType", "AudioUsage", + "DeviceAddress", "FixedChannelCount", "PlaybackTrackMetadata", "RecordTrackMetadata", diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index e5919cbc22..dab74645ff 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -16,6 +16,8 @@ package android.hardware.audio.common@5.0; +import android.hidl.safe_union@1.0; + /* * * IDs and Handles @@ -601,6 +603,29 @@ enum AudioDevice : uint32_t { // Note that the 2.0 IN_ALL* have been moved to helper functions }; +/** + * IEEE 802 MAC address. + */ +typedef uint8_t[6] MacAddress; + +/** + * Specifies a device address in case when several devices of the same type + * can be connected (e.g. BT A2DP, USB). + */ +struct DeviceAddress { + AudioDevice device; // discriminator + union Address { + MacAddress mac; // used for BLUETOOTH_A2DP_* + uint8_t[4] ipv4; // used for IP + struct Alsa { + int32_t card; + int32_t device; + } alsa; // used for USB_* + } address; + string busAddress; // used for BUS + string rSubmixAddress; // used for REMOTE_SUBMIX +}; + /** * The audio output flags serve two purposes: * @@ -748,9 +773,17 @@ struct RecordTrackMetadata { * Must not be negative. */ float gain; + /** + * Indicates the destination of an input stream, can be left unspecified. + */ + safe_union Destination { + Monostate unspecified; + DeviceAddress device; + }; + Destination destination; }; -/** Metadatas of the source of a StreamIn. */ +/** Metadatas of the sink of a StreamIn. */ struct SinkMetadata { vec tracks; }; From c32a993999f661c53853d6edaa8643ebdb291993 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 15 Jan 2019 18:31:49 -0800 Subject: [PATCH 3/5] [Master port]Add new audio sources for audio capture This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. This commit adds the following audio capture sources: - AUDIO_SOURCE_VOICE_PERFORMANCE: for real time live performances like Karaoke. - AUDIO_SOURCE_ECHO_REFERENCE: for capturing the reference signal to suppress by an echo canceller. Protected by privileged permission CAPTURE_AUDIO_OUTPUT. Also added device AUDIO_DEVICE_IN_ECHO_REFERENCE selected when the requested capture source is AUDIO_SOURCE_ECHO_REFERENCE. Bug: 124247199 Bug: 118203066 Test: CTS tests for audio capture Change-Id: Ia93550b278733ae9cc5cda731b014421002fde35 Merged-In: Ia93550b278733ae9cc5cda731b014421002fde35 --- audio/common/5.0/types.hal | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index dab74645ff..b4e947096f 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -133,7 +133,18 @@ enum AudioSource : int32_t { * and raw signal analysis. */ UNPROCESSED = 9, - + /** + * Source for capturing audio meant to be processed in real time and played back for live + * performance (e.g karaoke). The capture path will minimize latency and coupling with + * playback path. + */ + VOICE_PERFORMANCE = 10, + /** + * Source for an echo canceller to capture the reference signal to be cancelled. + * The echo reference signal will be captured as close as possible to the DAC in order + * to include all post processing applied to the playback path. + */ + ECHO_REFERENCE = 1997, FM_TUNER = 1998, }; @@ -598,6 +609,7 @@ enum AudioDevice : uint32_t { IN_PROXY = BIT_IN | 0x1000000, IN_USB_HEADSET = BIT_IN | 0x2000000, IN_BLUETOOTH_BLE = BIT_IN | 0x4000000, + IN_ECHO_REFERENCE = BIT_IN | 0x10000000, IN_DEFAULT = BIT_IN | BIT_DEFAULT, // Note that the 2.0 IN_ALL* have been moved to helper functions From 36274db4e553d849d60c93c67de8f6875247b7d1 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 22 Jan 2019 12:41:41 -0800 Subject: [PATCH 4/5] [Master port]audio: add new audio formats This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. Add AAC_LATM*, CELT and APTX_ADAPTIVE to the list of audio formats. Bug: 124247199 Bug: 123082414 Test: make Change-Id: Id75e1f5016929d5a67e777774aaa892df6f91e78 Merged-In: Id75e1f5016929d5a67e777774aaa892df6f91e78 --- audio/common/5.0/types.hal | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index b4e947096f..3f81836f0b 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -235,6 +235,10 @@ enum AudioFormat : uint32_t { LDAC = 0x23000000UL, /** Dolby Metadata-enhanced Audio Transmission */ MAT = 0x24000000UL, + AAC_LATM = 0x25000000UL, + CELT = 0x26000000UL, + APTX_ADAPTIVE = 0x27000000UL, + /** Deprecated */ MAIN_MASK = 0xFF000000UL, SUB_MASK = 0x00FFFFFFUL, @@ -306,6 +310,9 @@ enum AudioFormat : uint32_t { MAT_1_0 = (MAT | MAT_SUB_1_0), MAT_2_0 = (MAT | MAT_SUB_2_0), MAT_2_1 = (MAT | MAT_SUB_2_1), + AAC_LATM_LC = (AAC_LATM | AAC_SUB_LC), + AAC_LATM_HE_V1 = (AAC_LATM | AAC_SUB_HE_V1), + AAC_LATM_HE_V2 = (AAC_LATM | AAC_SUB_HE_V2), }; /** From 955b94e1d54485fc9baf3919ba92d0277f2de150 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 22 Jan 2019 12:56:56 -0800 Subject: [PATCH 5/5] [Master port]audio: add new audio formats This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. Add audio format for LHDC Bluetooth codec. Also add missing audio sources and devices in xsd. Bug: 124247199 Bug: 120395342 Test: make Change-Id: Ib55c7d351074d8ef75747bcb1195e1ce15ed8b20 Merged-In: Ib55c7d351074d8ef75747bcb1195e1ce15ed8b20 --- audio/common/5.0/types.hal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index 3f81836f0b..ffe45069a8 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -238,6 +238,8 @@ enum AudioFormat : uint32_t { AAC_LATM = 0x25000000UL, CELT = 0x26000000UL, APTX_ADAPTIVE = 0x27000000UL, + LHDC = 0x28000000UL, + LHDC_LL = 0x29000000UL, /** Deprecated */ MAIN_MASK = 0xFF000000UL,