diff --git a/media/Android.bp b/media/Android.bp index 25cf75c4696c6..b049cb663d4c0 100644 --- a/media/Android.bp +++ b/media/Android.bp @@ -57,6 +57,7 @@ aidl_interface { "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/AudioDeviceAddress.aidl", "aidl/android/media/audio/common/AudioDeviceDescription.aidl", "aidl/android/media/audio/common/AudioDeviceType.aidl", "aidl/android/media/audio/common/AudioEncapsulationMetadataType.aidl", diff --git a/media/aidl/android/media/audio/common/AudioDevice.aidl b/media/aidl/android/media/audio/common/AudioDevice.aidl index 14c0eab8b6863..f897eb2ac059a 100644 --- a/media/aidl/android/media/audio/common/AudioDevice.aidl +++ b/media/aidl/android/media/audio/common/AudioDevice.aidl @@ -16,6 +16,7 @@ package android.media.audio.common; +import android.media.audio.common.AudioDeviceAddress; import android.media.audio.common.AudioDeviceDescription; /** @@ -28,5 +29,5 @@ import android.media.audio.common.AudioDeviceDescription; @VintfStability parcelable AudioDevice { AudioDeviceDescription type; - @utf8InCpp String address; + AudioDeviceAddress address; } diff --git a/media/aidl/android/media/audio/common/AudioDeviceAddress.aidl b/media/aidl/android/media/audio/common/AudioDeviceAddress.aidl new file mode 100644 index 0000000000000..ca48f7ebbe3aa --- /dev/null +++ b/media/aidl/android/media/audio/common/AudioDeviceAddress.aidl @@ -0,0 +1,61 @@ +/* + * 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; + +/** + * This structure defines various representations for the audio device + * address. + * + * {@hide} + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +union AudioDeviceAddress { + /** + * String uniquely identifying the device among other devices + * of the same type. Can be empty in case there is only one device + * of this type. + * + * Depending on the device type, its id may be assigned by the framework + * (one case used at the time of writing is REMOTE_SUBMIX), or assigned by + * the HAL service (the canonical examples are BUS and MIC devices). In any + * case, both framework and HAL must never attempt to parse the value of the + * 'id' field, regardless of whom has generated it. If the address must be + * parsed, one of the members below must be used instead of 'id'. + */ + @utf8InCpp String id; + /** + * IEEE 802 MAC address. Set for Bluetooth devices. The array must have + * exactly 6 elements. + */ + byte[] mac; + /** + * IPv4 Address. Set for IPv4 devices. The array must have exactly 4 + * elements. + */ + byte[] ipv4; + /** + * IPv6 Address. Set for IPv6 devices. The array must have exactly 8 + * elements. + */ + int[] ipv6; + /** + * PCI bus Address. Set for USB devices. The array must have exactly 2 + * elements, in the following order: the card id, and the device id. + */ + int[] alsa; +} 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 index 541c423113941..fb5cb62281e27 100644 --- 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 @@ -36,5 +36,5 @@ package android.media.audio.common; @JavaDerive(equals=true, toString=true) @VintfStability parcelable AudioDevice { android.media.audio.common.AudioDeviceDescription type; - @utf8InCpp String address; + android.media.audio.common.AudioDeviceAddress address; } diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceAddress.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceAddress.aidl new file mode 100644 index 0000000000000..905d3aa5fb0db --- /dev/null +++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceAddress.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 +union AudioDeviceAddress { + @utf8InCpp String id; + byte[] mac; + byte[] ipv4; + int[] ipv6; + int[] alsa; +}