summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul McLean <pmclean@google.com> 2015-05-14 15:59:18 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-05-14 15:59:20 +0000
commitfc56b88ac4ea56c53f9ab648b6a92d85a05562c8 (patch)
tree0cb94acaa6005b7601135ab36ae4acab94d72cd0
parent30bc0b9ebb6ea60427f4c42bb019557299dc2753 (diff)
parent20eec5bb794d0e1333ab3dca370f8b2ad2498416 (diff)
Merge "Add manufacturer-provided device name for AudioPort name field for BT devices. Change "a2dp-device" to empty string for EnumAPI." into mnc-dev
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 47ddfec747c5..6c83192a43ad 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -564,8 +564,6 @@ public class AudioService extends IAudioService.Stub {
return "card=" + card + ";device=" + device + ";";
}
- private final String DEVICE_NAME_A2DP = "a2dp-device";
-
///////////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////////////////////////////////////////////////
@@ -4387,7 +4385,7 @@ public class AudioService extends IAudioService.Stub {
}
// must be called synchronized on mConnectedDevices
- private void makeA2dpDeviceAvailable(String address) {
+ private void makeA2dpDeviceAvailable(String address, String name) {
// enable A2DP before notifying A2DP connection to avoid unecessary processing in
// audio policy manager
VolumeStreamState streamState = mStreamStates[AudioSystem.STREAM_MUSIC];
@@ -4395,12 +4393,12 @@ public class AudioService extends IAudioService.Stub {
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, 0, streamState, 0);
setBluetoothA2dpOnInt(true);
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_AVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_AVAILABLE, address, name);
// Reset A2DP suspend state each time a new sink is connected
AudioSystem.setParameters("A2dpSuspended=false");
mConnectedDevices.put(
makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address),
- new DeviceListSpec(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, DEVICE_NAME_A2DP,
+ new DeviceListSpec(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, name,
address));
}
@@ -4414,7 +4412,7 @@ public class AudioService extends IAudioService.Stub {
mAvrcpAbsVolSupported = false;
}
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_UNAVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "");
mConnectedDevices.remove(
makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address));
synchronized (mCurAudioRoutes) {
@@ -4444,17 +4442,17 @@ public class AudioService extends IAudioService.Stub {
// must be called synchronized on mConnectedDevices
private void makeA2dpSrcAvailable(String address) {
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_AVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_AVAILABLE, address, "");
mConnectedDevices.put(
makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address),
- new DeviceListSpec(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, DEVICE_NAME_A2DP,
+ new DeviceListSpec(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, "",
address));
}
// must be called synchronized on mConnectedDevices
private void makeA2dpSrcUnavailable(String address) {
AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP,
- AudioSystem.DEVICE_STATE_UNAVAILABLE, address, DEVICE_NAME_A2DP);
+ AudioSystem.DEVICE_STATE_UNAVAILABLE, address, "");
mConnectedDevices.remove(
makeDeviceListKey(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, address));
}
@@ -4520,7 +4518,7 @@ public class AudioService extends IAudioService.Stub {
makeA2dpDeviceUnavailableNow(mDockAddress);
}
}
- makeA2dpDeviceAvailable(address);
+ makeA2dpDeviceAvailable(address, btDevice.getName());
synchronized (mCurAudioRoutes) {
String name = btDevice.getAliasName();
if (!TextUtils.equals(mCurAudioRoutes.bluetoothName, name)) {
@@ -4871,7 +4869,7 @@ public class AudioService extends IAudioService.Stub {
if (btDevice == null) {
return;
}
-
+
address = btDevice.getAddress();
BluetoothClass btClass = btDevice.getBluetoothClass();
if (btClass != null) {
@@ -4891,9 +4889,11 @@ public class AudioService extends IAudioService.Stub {
}
boolean connected = (state == BluetoothProfile.STATE_CONNECTED);
+
+ String btDeviceName = btDevice.getName();
boolean success =
- handleDeviceConnection(connected, outDevice, address, "Bluetooth Headset") &&
- handleDeviceConnection(connected, inDevice, address, "Bluetooth Headset");
+ handleDeviceConnection(connected, outDevice, address, btDeviceName) &&
+ handleDeviceConnection(connected, inDevice, address, btDeviceName);
if (success) {
synchronized (mScoClients) {
if (connected) {