From 11d0950ae4ca61ffd8dc71d94d6c12df79d5d3fe Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Wed, 29 Nov 2023 21:05:54 +0000 Subject: Revert "Fix ringtone play issue via LE devices." This reverts commit 0e8f43a2a01692b6886a7d6b6365610ce55d0e49. Reason for revert: This is unflagged code; we can re-add with a flag at a later date. Bug: 278835031 Change-Id: I8cf40fbb58a4f3438cdbbbc95f00145974f88cab --- .../server/telecom/bluetooth/BluetoothDeviceManager.java | 4 +--- .../server/telecom/bluetooth/BluetoothRouteManager.java | 4 ---- .../server/telecom/tests/BluetoothDeviceManagerTest.java | 11 ++++++++--- 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 297fd7289..b19bf818f 100644 --- a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java +++ b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java @@ -711,9 +711,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 ce07532af..91c03b6b1 100644 --- a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java +++ b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java @@ -652,10 +652,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 ee6f0f203..a12846845 100644 --- a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java +++ b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java @@ -755,15 +755,20 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase { when(mBluetoothHeadset.isInbandRingingEnabled()).thenReturn(false); 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()); } -- cgit v1.2.3