Merge "audio: add device definitions for BLE Audio" am: 42ac870219
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1399178
Change-Id: I800c0a5adb3738924c8714be4f32c4185a334b92
diff --git a/api/current.txt b/api/current.txt
index 24d7cb2..ea98b5e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23396,6 +23396,8 @@
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
diff --git a/media/java/android/media/AudioDeviceInfo.java b/media/java/android/media/AudioDeviceInfo.java
index a39bc51..8c149f4 100644
--- a/media/java/android/media/AudioDeviceInfo.java
+++ b/media/java/android/media/AudioDeviceInfo.java
@@ -128,6 +128,19 @@
*/
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 @@
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 @@
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 @@
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 @@
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 @@
case TYPE_LINE_DIGITAL:
case TYPE_IP:
case TYPE_BUS:
+ case TYPE_BLE_HEADSET:
return true;
default:
return false;
@@ -447,6 +468,8 @@
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 @@
// 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 @@
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);
}
}
diff --git a/media/java/android/media/AudioDevicePort.java b/media/java/android/media/AudioDevicePort.java
index 51909db..ddd3e56 100644
--- a/media/java/android/media/AudioDevicePort.java
+++ b/media/java/android/media/AudioDevicePort.java
@@ -62,7 +62,9 @@
* {@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 "".
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 06494dd..fa971ba 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -4045,6 +4045,14 @@
*/
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
* platform-specific implementation.
@@ -4128,6 +4136,10 @@
* 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.
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 457ae4f..c76ccf4 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -630,6 +630,10 @@
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 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 @@
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 @@
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 @@
/** @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 @@
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 @@
/** @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 @@
/** @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 @@
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 @@
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);
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index a495250..8afe3d7 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -23396,6 +23396,8 @@
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