From 49ba38fc19403ae07a1e608f562becc144a346a7 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 15 Sep 2021 22:20:30 +0000 Subject: [PATCH] Move AudioDevice* from android.media -> a.m.audio.common SAIDL Also add missing "@hide" on a few interfaces Bug: 198812639 Test: m Change-Id: Ie5205571e17300008a1c80ef4dbe50c0a248ba6b --- media/Android.bp | 3 + .../media/audio/common/AudioDevice.aidl | 32 ++++ .../audio/common/AudioDeviceDescription.aidl | 108 ++++++++++++ .../media/audio/common/AudioDeviceType.aidl | 161 ++++++++++++++++++ .../media/audio/common/AudioFormatType.aidl | 2 + .../android/media/audio/common/PcmType.aidl | 2 + .../media/audio/common/AudioDevice.aidl | 40 +++++ .../audio/common/AudioDeviceDescription.aidl | 54 ++++++ .../media/audio/common/AudioDeviceType.aidl | 68 ++++++++ .../media/audio/common/AudioFormatType.aidl | 1 + .../android/media/audio/common/PcmType.aidl | 1 + 11 files changed, 472 insertions(+) create mode 100644 media/aidl/android/media/audio/common/AudioDevice.aidl create mode 100644 media/aidl/android/media/audio/common/AudioDeviceDescription.aidl create mode 100644 media/aidl/android/media/audio/common/AudioDeviceType.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDevice.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl create mode 100644 media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl diff --git a/media/Android.bp b/media/Android.bp index 7592c15ec5347..25cf75c4696c6 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -56,6 +56,9 @@ aidl_interface { "aidl/android/media/audio/common/AudioConfig.aidl", "aidl/android/media/audio/common/AudioConfigBase.aidl", "aidl/android/media/audio/common/AudioContentType.aidl", + "aidl/android/media/audio/common/AudioDevice.aidl", + "aidl/android/media/audio/common/AudioDeviceDescription.aidl", + "aidl/android/media/audio/common/AudioDeviceType.aidl", "aidl/android/media/audio/common/AudioEncapsulationMetadataType.aidl", "aidl/android/media/audio/common/AudioEncapsulationMode.aidl", "aidl/android/media/audio/common/AudioEncapsulationType.aidl", diff --git a/media/aidl/android/media/audio/common/AudioDevice.aidl b/media/aidl/android/media/audio/common/AudioDevice.aidl new file mode 100644 index 0000000000000..14c0eab8b6863 --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioDevice.aidl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2020 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.media.audio.common; + +import android.media.audio.common.AudioDeviceDescription; + +/** + * Represents a concrete audio device by bundling together the device type and + * the device address. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioDevice { + AudioDeviceDescription type; + @utf8InCpp String address; +} diff --git a/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl new file mode 100644 index 0000000000000..4e8a735dc58df --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl @@ -0,0 +1,108 @@ +/* + * 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.media.audio.common; + +import android.media.audio.common.AudioDeviceType; + +/** + * Describes the kind of an audio device. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioDeviceDescription { + /** + * Type and directionality of the device. For bidirectional audio devices + * two descriptions need to be created, having the same value for + * the 'connection' field. + * + * See 'AudioDeviceType' for the list of supported values. + */ + AudioDeviceType type = AudioDeviceType.NONE; + /** + * Specifies the type of the connection of the device to the audio system. + * Usually it's some kind of a communication protocol, e.g. Bluetooth SCO or + * USB. There is a list of connection types recognized by the framework, + * defined using 'CONNECTION_' constants. Vendors can add their own + * connection types with "vx.." prefix. + * + * When the 'connection' field is left empty and 'type != NONE | DEFAULT', + * it is assumed that the device is permanently attached to the audio + * system, e.g. a built-in speaker or microphone. + * + * The 'connection' field must be left empty if 'type' is 'NONE' or + * '{IN|OUT}_DEFAULT'. + */ + @utf8InCpp String connection; + /** + * Analog connection, for example, via 3.5 mm analog jack. + */ + const @utf8InCpp String CONNECTION_ANALOG = "analog"; + /** + * Low-End (Analog) Desk Dock. + */ + const @utf8InCpp String CONNECTION_ANALOG_DOCK = "analog-dock"; + /** + * Bluetooth A2DP connection. + */ + const @utf8InCpp String CONNECTION_BT_A2DP = "bt-a2dp"; + /** + * Bluetooth Low Energy (LE) connection. + */ + const @utf8InCpp String CONNECTION_BT_LE = "bt-le"; + /** + * Bluetooth SCO connection. + */ + const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco"; + /** + * Bus connection. Mostly used in automotive scenarios. + */ + const @utf8InCpp String CONNECTION_BUS = "bus"; + /** + * High-End (Digital) Desk Dock. + */ + const @utf8InCpp String CONNECTION_DIGITAL_DOCK = "digital-dock"; + /** + * HDMI connection. + */ + const @utf8InCpp String CONNECTION_HDMI = "hdmi"; + /** + * HDMI ARC connection. + */ + const @utf8InCpp String CONNECTION_HDMI_ARC = "hdmi-arc"; + /** + * HDMI eARC connection. + */ + const @utf8InCpp String CONNECTION_HDMI_EARC = "hdmi-earc"; + /** + * IP v4 connection. + */ + const @utf8InCpp String CONNECTION_IP_V4 = "ip-v4"; + /** + * SPDIF connection. + */ + const @utf8InCpp String CONNECTION_SPDIF = "spdif"; + /** + * A wireless connection when the actual protocol is unspecified. + */ + const @utf8InCpp String CONNECTION_WIRELESS = "wireless"; + /** + * USB connection. + */ + const @utf8InCpp String CONNECTION_USB = "usb"; +} diff --git a/media/aidl/android/media/audio/common/AudioDeviceType.aidl b/media/aidl/android/media/audio/common/AudioDeviceType.aidl new file mode 100644 index 0000000000000..95dbe2ae3f63e --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioDeviceType.aidl @@ -0,0 +1,161 @@ +/* + * 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.media.audio.common; + +/** + * The type of the audio device. Only used as part of 'AudioDeviceDescription' + * structure. + * + * Types are divided into "input" and "output" categories. Audio devices that + * have both audio input and output, for example, headsets, are represented by a + * pair of input and output device types. + * + * The 'AudioDeviceType' intentionally binds together directionality and 'kind' + * of the device to avoid making them fully orthogonal. This is because not all + * types of devices are bidirectional, for example, speakers can only be used + * for output and microphones can only be used for input (at least, in the + * context of the audio framework). + * + * {@hide} + */ +@VintfStability +@Backing(type="int") +enum AudioDeviceType { + /** + * "None" type is a "null" value. All fields of 'AudioDeviceDescription' + * must have default / empty / null values. + */ + NONE = 0, + /** + * The "default" device is used when the client does not have any + * preference for a particular device. + */ + IN_DEFAULT = 1, + /** + * A device implementing Android Open Accessory protocol. + */ + IN_ACCESSORY = 2, + /** + * Input from a DSP front-end proxy device. + */ + IN_AFE_PROXY = 3, + /** + * Used when only the connection protocol is known, e.g. a "HDMI Device." + */ + IN_DEVICE = 4, + /** + * A device providing reference input for echo canceller. + */ + IN_ECHO_REFERENCE = 5, + /** + * FM Tuner input. + */ + IN_FM_TUNER = 6, + /** + * A microphone of a headset. + */ + IN_HEADSET = 7, + /** + * Loopback input. + */ + IN_LOOPBACK = 8, + /** + * The main microphone (the frontal mic on mobile devices). + */ + IN_MICROPHONE = 9, + /** + * The secondary microphone (the back mic on mobile devices). + */ + IN_MICROPHONE_BACK = 10, + /** + * Input from a submix of other streams. + */ + IN_SUBMIX = 11, + /** + * Audio received via the telephone line. + */ + IN_TELEPHONY_RX = 12, + /** + * TV Tuner audio input. + */ + IN_TV_TUNER = 13, + /** + * The "default" device is used when the client does not have any + * preference for a particular device. + */ + OUT_DEFAULT = 129, + /** + * A device implementing Android Open Accessory protocol. + */ + OUT_ACCESSORY = 130, + /** + * Output from a DSP front-end proxy device. + */ + OUT_AFE_PROXY = 131, + /** + * Car audio system. + */ + OUT_CARKIT = 132, + /** + * Used when only the connection protocol is known, e.g. a "HDMI Device." + */ + OUT_DEVICE = 133, + /** + * The echo canceller device. + */ + OUT_ECHO_CANCELLER = 134, + /** + * The FM Tuner device. + */ + OUT_FM = 135, + /** + * Headphones. + */ + OUT_HEADPHONE = 136, + /** + * Headphones of a headset. + */ + OUT_HEADSET = 137, + /** + * Hearing aid. + */ + OUT_HEARING_AID = 138, + /** + * Secondary line level output. + */ + OUT_LINE_AUX = 139, + /** + * The main speaker. + */ + OUT_SPEAKER = 140, + /** + * The speaker of a mobile device in the case when it is close to the ear. + */ + OUT_SPEAKER_EARPIECE = 141, + /** + * The main speaker with overload / overheating protection. + */ + OUT_SPEAKER_SAFE = 142, + /** + * Output into a submix. + */ + OUT_SUBMIX = 143, + /** + * Output into a telephone line. + */ + OUT_TELEPHONY_TX = 144, +} diff --git a/media/aidl/android/media/audio/common/AudioFormatType.aidl b/media/aidl/android/media/audio/common/AudioFormatType.aidl index 17594017973fa..ea78c7a302dbd 100644 --- a/media/aidl/android/media/audio/common/AudioFormatType.aidl +++ b/media/aidl/android/media/audio/common/AudioFormatType.aidl @@ -19,6 +19,8 @@ package android.media.audio.common; /** * The type of the audio format. Only used as part of 'AudioFormatDescription' * structure. + * + * {@hide} */ @VintfStability @Backing(type="byte") diff --git a/media/aidl/android/media/audio/common/PcmType.aidl b/media/aidl/android/media/audio/common/PcmType.aidl index db77769226e91..6e07d9b19eaf7 100644 --- a/media/aidl/android/media/audio/common/PcmType.aidl +++ b/media/aidl/android/media/audio/common/PcmType.aidl @@ -19,6 +19,8 @@ package android.media.audio.common; /** * The type of the encoding used for representing PCM samples. Only used as * part of 'AudioFormatDescription' structure. + * + * {@hide} */ @VintfStability @Backing(type="byte") diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDevice.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDevice.aidl new file mode 100644 index 0000000000000..541c423113941 --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDevice.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.media.audio.common; +/* @hide */ +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioDevice { + android.media.audio.common.AudioDeviceDescription type; + @utf8InCpp String address; +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl new file mode 100644 index 0000000000000..b4d71d77e258d --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.media.audio.common; +/* @hide */ +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioDeviceDescription { + android.media.audio.common.AudioDeviceType type = android.media.audio.common.AudioDeviceType.NONE; + @utf8InCpp String connection; + const @utf8InCpp String CONNECTION_ANALOG = "analog"; + const @utf8InCpp String CONNECTION_ANALOG_DOCK = "analog-dock"; + const @utf8InCpp String CONNECTION_BT_A2DP = "bt-a2dp"; + const @utf8InCpp String CONNECTION_BT_LE = "bt-le"; + const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco"; + const @utf8InCpp String CONNECTION_BUS = "bus"; + const @utf8InCpp String CONNECTION_DIGITAL_DOCK = "digital-dock"; + const @utf8InCpp String CONNECTION_HDMI = "hdmi"; + const @utf8InCpp String CONNECTION_HDMI_ARC = "hdmi-arc"; + const @utf8InCpp String CONNECTION_HDMI_EARC = "hdmi-earc"; + const @utf8InCpp String CONNECTION_IP_V4 = "ip-v4"; + const @utf8InCpp String CONNECTION_SPDIF = "spdif"; + const @utf8InCpp String CONNECTION_WIRELESS = "wireless"; + const @utf8InCpp String CONNECTION_USB = "usb"; +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl new file mode 100644 index 0000000000000..ffdb778b1f71e --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl @@ -0,0 +1,68 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // +/////////////////////////////////////////////////////////////////////////////// + +// This file is a snapshot of an AIDL file. Do not edit it manually. There are +// two cases: +// 1). this is a frozen version file - do not edit this in any case. +// 2). this is a 'current' file. If you make a backwards compatible change to +// the interface (from the latest frozen version), the build system will +// prompt you to update this file with `m -update-api`. +// +// You must not make a backward incompatible change to any AIDL file built +// with the aidl_interface module type with versions property set. The module +// type is used to build AIDL files in a way that they can be used across +// independently updatable components of the system. If a device is shipped +// with such a backward incompatible change, it has a high risk of breaking +// later when a module using the interface is updated, e.g., Mainline modules. + +package android.media.audio.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum AudioDeviceType { + NONE = 0, + IN_DEFAULT = 1, + IN_ACCESSORY = 2, + IN_AFE_PROXY = 3, + IN_DEVICE = 4, + IN_ECHO_REFERENCE = 5, + IN_FM_TUNER = 6, + IN_HEADSET = 7, + IN_LOOPBACK = 8, + IN_MICROPHONE = 9, + IN_MICROPHONE_BACK = 10, + IN_SUBMIX = 11, + IN_TELEPHONY_RX = 12, + IN_TV_TUNER = 13, + OUT_DEFAULT = 129, + OUT_ACCESSORY = 130, + OUT_AFE_PROXY = 131, + OUT_CARKIT = 132, + OUT_DEVICE = 133, + OUT_ECHO_CANCELLER = 134, + OUT_FM = 135, + OUT_HEADPHONE = 136, + OUT_HEADSET = 137, + OUT_HEARING_AID = 138, + OUT_LINE_AUX = 139, + OUT_SPEAKER = 140, + OUT_SPEAKER_EARPIECE = 141, + OUT_SPEAKER_SAFE = 142, + OUT_SUBMIX = 143, + OUT_TELEPHONY_TX = 144, +} diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioFormatType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioFormatType.aidl index b94c850002d86..7f55abeeaf0ce 100644 --- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioFormatType.aidl +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioFormatType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.media.audio.common; +/* @hide */ @Backing(type="byte") @VintfStability enum AudioFormatType { DEFAULT = 0, diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/PcmType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/PcmType.aidl index 42c4679fe1252..79bfa625ba8ef 100644 --- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/PcmType.aidl +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/PcmType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.media.audio.common; +/* @hide */ @Backing(type="byte") @VintfStability enum PcmType { DEFAULT = 0,