diff options
author | Paul McLean <pmclean@google.com> | 2015-05-09 13:02:18 -0700 |
---|---|---|
committer | Paul McLean <pmclean@google.com> | 2015-05-13 10:18:47 -0700 |
commit | 20eec5bb794d0e1333ab3dca370f8b2ad2498416 (patch) | |
tree | f82acc95b2162afc6ae7d756e10a62670a27b34e /services/core/java/com/android/server/audio/AudioService.java | |
parent | b9599750235985e92ed393bbbd0f59e31ec25b01 (diff) | |
download | frameworks_base-20eec5bb794d0e1333ab3dca370f8b2ad2498416.zip frameworks_base-20eec5bb794d0e1333ab3dca370f8b2ad2498416.tar.gz frameworks_base-20eec5bb794d0e1333ab3dca370f8b2ad2498416.tar.bz2 |
Add manufacturer-provided device name for AudioPort name field for BT devices.
Change "a2dp-device" to empty string for EnumAPI.
Bug: 20880296
Change-Id: If377735b6d552bb929e5881743bcc3c9a2afb9e3
Diffstat (limited to 'services/core/java/com/android/server/audio/AudioService.java')
-rw-r--r-- | services/core/java/com/android/server/audio/AudioService.java | 26 |
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 47ddfec..6c83192 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) { |