audio: add device definitions for BLE Audio
Add device type enums for BLE Audio. Device types for BLE audio headset and BLE audio speaker are added to AudioDeviceInfo class. Conversions to internal device types are added to AudioSystem. Bug: 161358428 Test: make flash and boot Change-Id: I0a39ffc49c0e7e5b36975656a33a2dd2946b60b7
This commit is contained in:
committed by
Glenn Kasten
parent
f1a408f208
commit
6239d7ee87
@@ -24065,6 +24065,8 @@ package android.media {
|
||||
method public boolean isSink();
|
||||
method public boolean isSource();
|
||||
field public static final int TYPE_AUX_LINE = 19; // 0x13
|
||||
field public static final int TYPE_BLE_HEADSET = 26; // 0x1a
|
||||
field public static final int TYPE_BLE_SPEAKER = 27; // 0x1b
|
||||
field public static final int TYPE_BLUETOOTH_A2DP = 8; // 0x8
|
||||
field public static final int TYPE_BLUETOOTH_SCO = 7; // 0x7
|
||||
field public static final int TYPE_BUILTIN_EARPIECE = 1; // 0x1
|
||||
|
||||
@@ -147,6 +147,19 @@ public final class AudioDeviceInfo {
|
||||
// {@link android.media.audiopolicy.AudioMix#ROUTE_FLAG_LOOP_BACK} flag.
|
||||
public static final int TYPE_REMOTE_SUBMIX = 25;
|
||||
|
||||
/**
|
||||
* A device type describing a Bluetooth Low Energy (BLE) audio headset or headphones.
|
||||
* Headphones are grouped with headsets when the device is a sink:
|
||||
* the features of headsets and headphones with regard to playback are the same.
|
||||
*/
|
||||
public static final int TYPE_BLE_HEADSET = 26;
|
||||
|
||||
/**
|
||||
* A device type describing a Bluetooth Low Energy (BLE) audio speaker.
|
||||
*/
|
||||
public static final int TYPE_BLE_SPEAKER = 27;
|
||||
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = false, prefix = "TYPE", value = {
|
||||
TYPE_BUILTIN_EARPIECE,
|
||||
@@ -171,7 +184,9 @@ public final class AudioDeviceInfo {
|
||||
TYPE_HEARING_AID,
|
||||
TYPE_BUILTIN_MIC,
|
||||
TYPE_FM_TUNER,
|
||||
TYPE_TV_TUNER }
|
||||
TYPE_TV_TUNER,
|
||||
TYPE_BLE_HEADSET,
|
||||
TYPE_BLE_SPEAKER}
|
||||
)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AudioDeviceType {}
|
||||
@@ -193,7 +208,8 @@ public final class AudioDeviceInfo {
|
||||
TYPE_LINE_ANALOG,
|
||||
TYPE_LINE_DIGITAL,
|
||||
TYPE_IP,
|
||||
TYPE_BUS }
|
||||
TYPE_BUS,
|
||||
TYPE_BLE_HEADSET}
|
||||
)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AudioDeviceTypeIn {}
|
||||
@@ -219,7 +235,9 @@ public final class AudioDeviceInfo {
|
||||
TYPE_AUX_LINE,
|
||||
TYPE_IP,
|
||||
TYPE_BUS,
|
||||
TYPE_HEARING_AID }
|
||||
TYPE_HEARING_AID,
|
||||
TYPE_BLE_HEADSET,
|
||||
TYPE_BLE_SPEAKER}
|
||||
)
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AudioDeviceTypeOut {}
|
||||
@@ -248,7 +266,8 @@ public final class AudioDeviceInfo {
|
||||
case TYPE_BUS:
|
||||
case TYPE_HEARING_AID:
|
||||
case TYPE_BUILTIN_SPEAKER_SAFE:
|
||||
case TYPE_REMOTE_SUBMIX:
|
||||
case TYPE_BLE_HEADSET:
|
||||
case TYPE_BLE_SPEAKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -275,6 +294,7 @@ public final class AudioDeviceInfo {
|
||||
case TYPE_IP:
|
||||
case TYPE_BUS:
|
||||
case TYPE_REMOTE_SUBMIX:
|
||||
case TYPE_BLE_HEADSET:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -527,6 +547,8 @@ public final class AudioDeviceInfo {
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPEAKER_SAFE,
|
||||
TYPE_BUILTIN_SPEAKER_SAFE);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_HEADSET, TYPE_BLE_HEADSET);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_SPEAKER, TYPE_BLE_SPEAKER);
|
||||
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUILTIN_MIC, TYPE_BUILTIN_MIC);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET, TYPE_BLUETOOTH_SCO);
|
||||
@@ -547,6 +569,7 @@ public final class AudioDeviceInfo {
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_IP, TYPE_IP);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUS, TYPE_BUS);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLE_HEADSET, TYPE_BLE_HEADSET);
|
||||
|
||||
// privileges mapping to output device
|
||||
EXT_TO_INT_DEVICE_MAPPING = new SparseIntArray();
|
||||
@@ -576,6 +599,8 @@ public final class AudioDeviceInfo {
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_SPEAKER_SAFE,
|
||||
AudioSystem.DEVICE_OUT_SPEAKER_SAFE);
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_OUT_REMOTE_SUBMIX);
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_OUT_BLE_HEADSET);
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_SPEAKER, AudioSystem.DEVICE_OUT_BLE_SPEAKER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,9 @@ public class AudioDevicePort extends AudioPort {
|
||||
* {@link AudioManager#DEVICE_IN_USB_DEVICE}) use an address composed of the ALSA card number
|
||||
* and device number: "card=2;device=1"
|
||||
* - Bluetooth devices ({@link AudioManager#DEVICE_OUT_BLUETOOTH_SCO},
|
||||
* {@link AudioManager#DEVICE_OUT_BLUETOOTH_SCO}, {@link AudioManager#DEVICE_OUT_BLUETOOTH_A2DP})
|
||||
* {@link AudioManager#DEVICE_OUT_BLUETOOTH_SCO},
|
||||
* {@link AudioManager#DEVICE_OUT_BLUETOOTH_A2DP}),
|
||||
* {@link AudioManager#DEVICE_OUT_BLE_HEADSET}, {@link AudioManager#DEVICE_OUT_BLE_SPEAKER})
|
||||
* use the MAC address of the bluetooth device in the form "00:11:22:AA:BB:CC" as reported by
|
||||
* {@link BluetoothDevice#getAddress()}.
|
||||
* - Deivces that do not have an address will indicate an empty string "".
|
||||
|
||||
@@ -4412,6 +4412,14 @@ public class AudioManager {
|
||||
* The audio output device code for built-in FM transmitter.
|
||||
*/
|
||||
public static final int DEVICE_OUT_FM = AudioSystem.DEVICE_OUT_FM;
|
||||
/** @hide
|
||||
* The audio output device code for a BLE audio headset.
|
||||
*/
|
||||
public static final int DEVICE_OUT_BLE_HEADSET = AudioSystem.DEVICE_OUT_BLE_HEADSET;
|
||||
/** @hide
|
||||
* The audio output device code for a BLE audio speaker.
|
||||
*/
|
||||
public static final int DEVICE_OUT_BLE_SPEAKER = AudioSystem.DEVICE_OUT_BLE_SPEAKER;
|
||||
/** @hide
|
||||
* This is not used as a returned value from {@link #getDevicesForStream}, but could be
|
||||
* used in the future in a set method to select whatever default device is chosen by the
|
||||
@@ -4496,6 +4504,10 @@ public class AudioManager {
|
||||
* The audio input device code for audio loopback
|
||||
*/
|
||||
public static final int DEVICE_IN_LOOPBACK = AudioSystem.DEVICE_IN_LOOPBACK;
|
||||
/** @hide
|
||||
* The audio input device code for a BLE audio headset.
|
||||
*/
|
||||
public static final int DEVICE_IN_BLE_HEADSET = AudioSystem.DEVICE_IN_BLE_HEADSET;
|
||||
|
||||
/**
|
||||
* Return true if the device code corresponds to an output device.
|
||||
|
||||
@@ -866,6 +866,10 @@ public class AudioSystem
|
||||
public static final int DEVICE_OUT_USB_HEADSET = 0x4000000;
|
||||
/** @hide */
|
||||
public static final int DEVICE_OUT_HEARING_AID = 0x8000000;
|
||||
/** @hide */
|
||||
public static final int DEVICE_OUT_BLE_HEADSET = 0x20000000;
|
||||
/** @hide */
|
||||
public static final int DEVICE_OUT_BLE_SPEAKER = 0x20000001;
|
||||
|
||||
/** @hide */
|
||||
public static final int DEVICE_OUT_DEFAULT = DEVICE_BIT_DEFAULT;
|
||||
@@ -890,6 +894,8 @@ public class AudioSystem
|
||||
public static final Set<Integer> DEVICE_OUT_ALL_HDMI_SYSTEM_AUDIO_SET;
|
||||
/** @hide */
|
||||
public static final Set<Integer> DEVICE_ALL_HDMI_SYSTEM_AUDIO_AND_SPEAKER_SET;
|
||||
/** @hide */
|
||||
public static final Set<Integer> DEVICE_OUT_ALL_BLE_SET;
|
||||
static {
|
||||
DEVICE_OUT_ALL_SET = new HashSet<>();
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_EARPIECE);
|
||||
@@ -920,6 +926,8 @@ public class AudioSystem
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_PROXY);
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_USB_HEADSET);
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_HEARING_AID);
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_BLE_HEADSET);
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_BLE_SPEAKER);
|
||||
DEVICE_OUT_ALL_SET.add(DEVICE_OUT_DEFAULT);
|
||||
|
||||
DEVICE_OUT_ALL_A2DP_SET = new HashSet<>();
|
||||
@@ -945,6 +953,10 @@ public class AudioSystem
|
||||
DEVICE_ALL_HDMI_SYSTEM_AUDIO_AND_SPEAKER_SET = new HashSet<>();
|
||||
DEVICE_ALL_HDMI_SYSTEM_AUDIO_AND_SPEAKER_SET.addAll(DEVICE_OUT_ALL_HDMI_SYSTEM_AUDIO_SET);
|
||||
DEVICE_ALL_HDMI_SYSTEM_AUDIO_AND_SPEAKER_SET.add(DEVICE_OUT_SPEAKER);
|
||||
|
||||
DEVICE_OUT_ALL_BLE_SET = new HashSet<>();
|
||||
DEVICE_OUT_ALL_BLE_SET.add(DEVICE_OUT_BLE_HEADSET);
|
||||
DEVICE_OUT_ALL_BLE_SET.add(DEVICE_OUT_BLE_SPEAKER);
|
||||
}
|
||||
|
||||
// input devices
|
||||
@@ -1019,6 +1031,8 @@ public class AudioSystem
|
||||
/** @hide */
|
||||
public static final int DEVICE_IN_ECHO_REFERENCE = DEVICE_BIT_IN | 0x10000000;
|
||||
/** @hide */
|
||||
public static final int DEVICE_IN_BLE_HEADSET = DEVICE_BIT_IN | 0x20000000;
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
public static final int DEVICE_IN_DEFAULT = DEVICE_BIT_IN | DEVICE_BIT_DEFAULT;
|
||||
|
||||
@@ -1056,6 +1070,7 @@ public class AudioSystem
|
||||
DEVICE_IN_ALL_SET.add(DEVICE_IN_BLUETOOTH_BLE);
|
||||
DEVICE_IN_ALL_SET.add(DEVICE_IN_HDMI_ARC);
|
||||
DEVICE_IN_ALL_SET.add(DEVICE_IN_ECHO_REFERENCE);
|
||||
DEVICE_IN_ALL_SET.add(DEVICE_IN_BLE_HEADSET);
|
||||
DEVICE_IN_ALL_SET.add(DEVICE_IN_DEFAULT);
|
||||
|
||||
DEVICE_IN_ALL_SCO_SET = new HashSet<>();
|
||||
@@ -1118,6 +1133,8 @@ public class AudioSystem
|
||||
/** @hide */ public static final String DEVICE_OUT_PROXY_NAME = "proxy";
|
||||
/** @hide */ public static final String DEVICE_OUT_USB_HEADSET_NAME = "usb_headset";
|
||||
/** @hide */ public static final String DEVICE_OUT_HEARING_AID_NAME = "hearing_aid_out";
|
||||
/** @hide */ public static final String DEVICE_OUT_BLE_HEADSET_NAME = "ble_headset";
|
||||
/** @hide */ public static final String DEVICE_OUT_BLE_SPEAKER_NAME = "ble_speaker";
|
||||
|
||||
/** @hide */ public static final String DEVICE_IN_COMMUNICATION_NAME = "communication";
|
||||
/** @hide */ public static final String DEVICE_IN_AMBIENT_NAME = "ambient";
|
||||
@@ -1145,6 +1162,7 @@ public class AudioSystem
|
||||
/** @hide */ public static final String DEVICE_IN_BLUETOOTH_BLE_NAME = "bt_ble";
|
||||
/** @hide */ public static final String DEVICE_IN_ECHO_REFERENCE_NAME = "echo_reference";
|
||||
/** @hide */ public static final String DEVICE_IN_HDMI_ARC_NAME = "hdmi_arc";
|
||||
/** @hide */ public static final String DEVICE_IN_BLE_HEADSET_NAME = "ble_headset";
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage
|
||||
@@ -1207,6 +1225,10 @@ public class AudioSystem
|
||||
return DEVICE_OUT_USB_HEADSET_NAME;
|
||||
case DEVICE_OUT_HEARING_AID:
|
||||
return DEVICE_OUT_HEARING_AID_NAME;
|
||||
case DEVICE_OUT_BLE_HEADSET:
|
||||
return DEVICE_OUT_BLE_HEADSET_NAME;
|
||||
case DEVICE_OUT_BLE_SPEAKER:
|
||||
return DEVICE_OUT_BLE_SPEAKER_NAME;
|
||||
case DEVICE_OUT_DEFAULT:
|
||||
default:
|
||||
return Integer.toString(device);
|
||||
@@ -1269,6 +1291,8 @@ public class AudioSystem
|
||||
return DEVICE_IN_ECHO_REFERENCE_NAME;
|
||||
case DEVICE_IN_HDMI_ARC:
|
||||
return DEVICE_IN_HDMI_ARC_NAME;
|
||||
case DEVICE_IN_BLE_HEADSET:
|
||||
return DEVICE_IN_BLE_HEADSET_NAME;
|
||||
case DEVICE_IN_DEFAULT:
|
||||
default:
|
||||
return Integer.toString(device);
|
||||
|
||||
@@ -24047,6 +24047,8 @@ package android.media {
|
||||
method public boolean isSink();
|
||||
method public boolean isSource();
|
||||
field public static final int TYPE_AUX_LINE = 19; // 0x13
|
||||
field public static final int TYPE_BLE_HEADSET = 26; // 0x1a
|
||||
field public static final int TYPE_BLE_SPEAKER = 27; // 0x1b
|
||||
field public static final int TYPE_BLUETOOTH_A2DP = 8; // 0x8
|
||||
field public static final int TYPE_BLUETOOTH_SCO = 7; // 0x7
|
||||
field public static final int TYPE_BUILTIN_EARPIECE = 1; // 0x1
|
||||
|
||||
Reference in New Issue
Block a user