Add stuctured audio device address type: AudioDeviceAddress

This type is similar to `DeviceAddress` from Audio HAL V7.

Bug: 198812639
Test: m
Change-Id: I9d36ab43290bb471aad042dade91a2b5e8f96c4f
This commit is contained in:
Mikhail Naganov
2021-09-16 01:03:48 +00:00
parent 49ba38fc19
commit 54d0193e05
5 changed files with 108 additions and 2 deletions

View File

@@ -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",

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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 <name>-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;
}