Merge "audio: support for LC3 a2dp stereo recording" into r-keystone-qcom-dev
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
index 86fa598..5f874d0 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
@@ -124,12 +124,6 @@
private final Map<String, LocalBluetoothProfile>
mProfileNameMap = new HashMap<String, LocalBluetoothProfile>();
- private static final int NO_ADV_AUDIO_SUPPORT = 0;
- private static final int ADV_AUDIO_CONNECTION_SUPPORT = 1;
- private static final int ADV_AUDIO_CONECTIONLESS_SUPPORT = 2;
-
- private int mAdvAudioFeatureMask;
-
LocalBluetoothProfileManager(Context context,
LocalBluetoothAdapter adapter,
CachedBluetoothDeviceManager deviceManager,
@@ -141,9 +135,6 @@
// pass this reference to adapter and event manager (circular dependency)
adapter.setProfileManager(this);
- mAdvAudioFeatureMask = SystemProperties.getInt(
- "persist.vendor.service.bt.adv_audio_mask", NO_ADV_AUDIO_SUPPORT);
-
if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete");
}
@@ -621,39 +612,36 @@
removedProfiles.remove(mA2dpProfile);
}
- if ((mAdvAudioFeatureMask & ADV_AUDIO_CONNECTION_SUPPORT)
- == ADV_AUDIO_CONNECTION_SUPPORT) {
- if (mHeadsetProfile != null) {
- if (ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_VOICE_P_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_VOICE_T_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_HEARINGAID_UUID)
- || (mHeadsetProfile.getConnectionStatus(device)
- == BluetoothProfile.STATE_CONNECTED)) {
- if(DEBUG) Log.d(TAG, " Advance Audio Voice supported ");
- if (!profiles.contains(mHeadsetProfile)) {
- profiles.add(mHeadsetProfile);
- removedProfiles.remove(mHeadsetProfile);
- } else {
- if(DEBUG) Log.d(TAG, " HeadsetProfile already added ");
- }
+ if (mHeadsetProfile != null) {
+ if (ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_VOICE_P_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_VOICE_T_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_HEARINGAID_UUID)
+ || (mHeadsetProfile.getConnectionStatus(device)
+ == BluetoothProfile.STATE_CONNECTED)) {
+ if (!profiles.contains(mHeadsetProfile)) {
+ profiles.add(mHeadsetProfile);
+ removedProfiles.remove(mHeadsetProfile);
+ if (DEBUG) Log.d(TAG, "Advance Audio Voice supported");
+ } else {
+ if (DEBUG) Log.d(TAG, "HeadsetProfile already added");
}
}
+ }
- if ((mA2dpProfile != null)
- && (ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_T_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_HEARINGAID_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_P_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_G_UUID)
- || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_W_UUID)
- || (mA2dpProfile.getConnectionStatus(device)
- == BluetoothProfile.STATE_CONNECTED))) {
- if(DEBUG) Log.d(TAG, " Advance Audio Media supported ");
- if (!profiles.contains(mA2dpProfile)) {
- profiles.add(mA2dpProfile);
- removedProfiles.remove(mA2dpProfile);
- } else {
- if(DEBUG) Log.d(TAG, " A2dpProfile already added ");
- }
+ if ((mA2dpProfile != null)
+ && (ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_T_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_HEARINGAID_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_P_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_G_UUID)
+ || ArrayUtils.contains(uuids, BluetoothUuid.ADVANCE_MEDIA_W_UUID)
+ || (mA2dpProfile.getConnectionStatus(device)
+ == BluetoothProfile.STATE_CONNECTED))) {
+ if (!profiles.contains(mA2dpProfile)) {
+ profiles.add(mA2dpProfile);
+ removedProfiles.remove(mA2dpProfile);
+ if (DEBUG) Log.d(TAG, "Advance Audio Media supported");
+ } else {
+ if (DEBUG) Log.d(TAG, "A2dpProfile already added");
}
}
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index 2ab6306..23083f8 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -341,7 +341,8 @@
return true;
}
if (o instanceof BtDeviceConnectionInfo) {
- return mDevice.equals(((BtDeviceConnectionInfo) o).mDevice);
+ return mDevice.equals(((BtDeviceConnectionInfo) o).mDevice) &&
+ mProfile == (((BtDeviceConnectionInfo) o).mProfile);
}
return false;
}
@@ -374,7 +375,7 @@
// when receiving a request to change the connection state of a device, this last
// request is the source of truth, so cancel all previous requests that are already in
// the handler
- removeScheduledA2dpEvents(device);
+ removeScheduledA2dpEvents(device, profile);
sendLMsgNoDelay(
state == BluetoothProfile.STATE_CONNECTED
@@ -386,14 +387,14 @@
/** remove all previously scheduled connection and state change events for the given device */
@GuardedBy("mDeviceStateLock")
- private void removeScheduledA2dpEvents(@NonNull BluetoothDevice device) {
+ private void removeScheduledA2dpEvents(@NonNull BluetoothDevice device, int profile) {
mBrokerHandler.removeEqualMessages(MSG_L_A2DP_DEVICE_CONFIG_CHANGE, device);
final BtDeviceConnectionInfo connectionInfoToRemove = new BtDeviceConnectionInfo(device,
// the next parameters of the constructor will be ignored when finding the message
// to remove as the equality of the message's object is tested on the device itself
// (see BtDeviceConnectionInfo.equals() method override)
- BluetoothProfile.STATE_CONNECTED, 0, false, -1);
+ BluetoothProfile.STATE_CONNECTED, profile, false, -1);
mBrokerHandler.removeEqualMessages(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_DISCONNECTION,
connectionInfoToRemove);
mBrokerHandler.removeEqualMessages(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT_CONNECTION,