diff options
author | Tyler Gunn <tgunn@google.com> | 2023-11-30 00:23:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-11-30 00:23:41 +0000 |
commit | 1014751959823d91aa8718f1c7fb2eeb11c7fcee (patch) | |
tree | 416f084160a73f07c850af621ecca1e4b7f051c4 | |
parent | 82dce2df7a109fff9366f75f542c0b9fe309b52f (diff) | |
parent | 11d0950ae4ca61ffd8dc71d94d6c12df79d5d3fe (diff) | |
download | Telecomm-1014751959823d91aa8718f1c7fb2eeb11c7fcee.tar.gz |
Merge "Revert "Fix ringtone play issue via LE devices."" into main
3 files changed, 9 insertions, 10 deletions
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java index c5e56b377..9ae58b33d 100644 --- a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +++ b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java @@ -740,9 +740,7 @@ public class BluetoothDeviceManager { } public boolean isInbandRingingEnabled() { - // Get the inband ringing enabled status of expected BT device to route call audio instead - // of using the address of currently connected device. - BluetoothDevice activeDevice = mBluetoothRouteManager.getMostRecentlyReportedActiveDevice(); + BluetoothDevice activeDevice = mBluetoothRouteManager.getBluetoothAudioConnectedDevice(); Log.i(this, "isInbandRingingEnabled: activeDevice: " + activeDevice); if (mBluetoothRouteManager.isCachedLeAudioDevice(activeDevice)) { if (mBluetoothLeAudioService == null) { diff --git a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java index 8124f6001..ed2a72c0a 100644 --- a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java +++ b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java @@ -691,10 +691,6 @@ public class BluetoothRouteManager extends StateMachine { } } - public BluetoothDevice getMostRecentlyReportedActiveDevice() { - return mMostRecentlyReportedActiveDevice; - } - public boolean hasBtActiveDevice() { return mLeAudioActiveDeviceCache != null || mHearingAidActiveDeviceCache != null || diff --git a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java index 86d2beefb..977cef9b8 100644 --- a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +++ b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java @@ -739,14 +739,19 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { when(mBluetoothLeAudio.isInbandRingtoneEnabled(1)).thenReturn(true); when(mBluetoothLeAudio.getGroupId(eq(device3))).thenReturn(1); receiverUnderTest.onReceive(mContext, + buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, + BluetoothDeviceManager.DEVICE_TYPE_HEADSET)); + receiverUnderTest.onReceive(mContext, + buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, + BluetoothDeviceManager.DEVICE_TYPE_HEADSET)); + receiverUnderTest.onReceive(mContext, buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3, BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO)); leAudioCallbacksTest.getValue().onGroupNodeAdded(device3, 1); + when(mBluetoothLeAudio.getConnectedGroupLeadDevice(1)).thenReturn(device3); when(mRouteManager.getBluetoothAudioConnectedDevice()).thenReturn(device3); when(mRouteManager.isCachedLeAudioDevice(eq(device3))).thenReturn(true); - when(mBluetoothLeAudio.getConnectedGroupLeadDevice(1)).thenReturn(device3); - when(mRouteManager.getMostRecentlyReportedActiveDevice()).thenReturn(device3); - assertEquals(1, mBluetoothDeviceManager.getNumConnectedDevices()); + assertEquals(3, mBluetoothDeviceManager.getNumConnectedDevices()); assertTrue(mBluetoothDeviceManager.isInbandRingingEnabled()); } |