Merge "audio: add device definitions for BLE Audio"
This commit is contained in:
@@ -23396,6 +23396,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
|
||||
|
||||
@@ -128,6 +128,19 @@ public final class AudioDeviceInfo {
|
||||
*/
|
||||
public static final int TYPE_HEARING_AID = 23;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@@ -152,7 +165,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 {} /** @hide */
|
||||
@@ -172,7 +187,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 {}
|
||||
@@ -198,7 +214,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 {}
|
||||
@@ -226,6 +244,8 @@ public final class AudioDeviceInfo {
|
||||
case TYPE_IP:
|
||||
case TYPE_BUS:
|
||||
case TYPE_HEARING_AID:
|
||||
case TYPE_BLE_HEADSET:
|
||||
case TYPE_BLE_SPEAKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -251,6 +271,7 @@ public final class AudioDeviceInfo {
|
||||
case TYPE_LINE_DIGITAL:
|
||||
case TYPE_IP:
|
||||
case TYPE_BUS:
|
||||
case TYPE_BLE_HEADSET:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -447,6 +468,8 @@ public final class AudioDeviceInfo {
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_IP, TYPE_IP);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BUS, TYPE_BUS);
|
||||
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HEARING_AID, TYPE_HEARING_AID);
|
||||
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);
|
||||
@@ -470,6 +493,7 @@ public final class AudioDeviceInfo {
|
||||
// not covered here, legacy
|
||||
//AudioSystem.DEVICE_OUT_REMOTE_SUBMIX
|
||||
//AudioSystem.DEVICE_IN_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();
|
||||
@@ -496,6 +520,8 @@ public final class AudioDeviceInfo {
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_IP, AudioSystem.DEVICE_OUT_IP);
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUS, AudioSystem.DEVICE_OUT_BUS);
|
||||
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HEARING_AID, AudioSystem.DEVICE_OUT_HEARING_AID);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,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 "".
|
||||
|
||||
@@ -4044,6 +4044,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
|
||||
@@ -4128,6 +4136,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.
|
||||
|
||||
@@ -630,6 +630,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;
|
||||
@@ -654,6 +658,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);
|
||||
@@ -684,6 +690,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<>();
|
||||
@@ -709,6 +717,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
|
||||
@@ -783,6 +795,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;
|
||||
|
||||
@@ -820,6 +834,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<>();
|
||||
@@ -879,6 +894,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";
|
||||
@@ -906,6 +923,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
|
||||
@@ -968,6 +986,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);
|
||||
@@ -1030,6 +1052,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);
|
||||
|
||||
@@ -23396,6 +23396,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