diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2022-01-16 17:18:44 -0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2022-01-16 17:18:44 -0800 |
commit | 595d01ba96d1d4201de5aa929d588c5ec4a23fa5 (patch) | |
tree | e371815b330bb9527dab2021e1c61a0cf74541e5 | |
parent | 842683cc3fbdf15752892f5322c7387acc382904 (diff) | |
parent | 7d96315aed9760dd4f78e133e7b174fec25e6fa4 (diff) |
Merge 7d96315aed9760dd4f78e133e7b174fec25e6fa4 on remote branch
Change-Id: I6a0e67fb20052221513c970762c6df2904ccffc2
-rw-r--r-- | src/com/android/bluetooth/a2dp/A2dpService.java | 2 | ||||
-rw-r--r-- | src/com/android/bluetooth/apm/ActiveDeviceManagerServiceIntf.java | 22 | ||||
-rw-r--r-- | src/com/android/bluetooth/hfp/HeadsetService.java | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java index ccf4e5a3e..4fc3877ec 100644 --- a/src/com/android/bluetooth/a2dp/A2dpService.java +++ b/src/com/android/bluetooth/a2dp/A2dpService.java @@ -2406,7 +2406,7 @@ public class A2dpService extends ProfileService { public BluetoothDevice getActiveDevice(AttributionSource source) { if(ApmConstIntf.getLeAudioEnabled()) { ActiveDeviceManagerServiceIntf activeDeviceManager = ActiveDeviceManagerServiceIntf.get(); - return activeDeviceManager.getActiveDevice(ApmConstIntf.AudioFeatures.MEDIA_AUDIO); + return activeDeviceManager.getActiveAbsoluteDevice(ApmConstIntf.AudioFeatures.MEDIA_AUDIO); } A2dpService service = getService(source); if (service == null) { diff --git a/src/com/android/bluetooth/apm/ActiveDeviceManagerServiceIntf.java b/src/com/android/bluetooth/apm/ActiveDeviceManagerServiceIntf.java index 92244ad24..b22e53e28 100644 --- a/src/com/android/bluetooth/apm/ActiveDeviceManagerServiceIntf.java +++ b/src/com/android/bluetooth/apm/ActiveDeviceManagerServiceIntf.java @@ -241,6 +241,28 @@ public class ActiveDeviceManagerServiceIntf { } + public BluetoothDevice getActiveAbsoluteDevice(int mAudioType) { + if(activeDeviceManagerService == null) + return null; + + Class[] arg = new Class[1]; + arg[0] = Integer.class; + + try { + Method getActiveDevice = activeDeviceManagerService.getDeclaredMethod("getActiveAbsoluteDevice", arg); + BluetoothDevice ret = (BluetoothDevice)getActiveDevice.invoke(mActiveDeviceManagerService, mAudioType); + return ret; + } catch(IllegalAccessException e) { + Log.i(TAG, "Exception" + e); + } catch(NoSuchMethodException e) { + Log.i(TAG, "Exception" + e); + } catch(InvocationTargetException e) { + Log.i(TAG, "Exception" + e); + } + + return null; + } + public int getActiveProfile(int mAudioType) { if(activeDeviceManagerService == null) return -1; diff --git a/src/com/android/bluetooth/hfp/HeadsetService.java b/src/com/android/bluetooth/hfp/HeadsetService.java index ffc96a338..e7412452d 100644 --- a/src/com/android/bluetooth/hfp/HeadsetService.java +++ b/src/com/android/bluetooth/hfp/HeadsetService.java @@ -1019,7 +1019,7 @@ public class HeadsetService extends ProfileService { public BluetoothDevice getActiveDevice(AttributionSource source) { if(ApmConstIntf.getLeAudioEnabled()) { ActiveDeviceManagerServiceIntf activeDeviceManager = ActiveDeviceManagerServiceIntf.get(); - return activeDeviceManager.getActiveDevice(ApmConstIntf.AudioFeatures.CALL_AUDIO); + return activeDeviceManager.getActiveAbsoluteDevice(ApmConstIntf.AudioFeatures.CALL_AUDIO); } HeadsetService service = getService(source); if (service == null) { |