LeAudio: Use new isInbandRingtoneEnabled API

Bug: 242685105
Test: atest BluetoothDeviceManagerTest
Tag: #feature
Change-Id: I079ba3191ed1214abacc7abb96f1fa2cb2081ac2
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
index 6a701da..1b0cd7e 100644
--- a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
+++ b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
@@ -641,7 +641,12 @@
         BluetoothDevice activeDevice = mBluetoothRouteManager.getBluetoothAudioConnectedDevice();
         Log.i(this, "isInbandRingingEnabled: activeDevice: " + activeDevice);
         if (mBluetoothRouteManager.isCachedLeAudioDevice(activeDevice)) {
-            return true;
+            if (mBluetoothLeAudioService == null) {
+                Log.i(this, "isInbandRingingEnabled: no leaudio service available.");
+                return false;
+            }
+            int groupId = mBluetoothLeAudioService.getGroupId(activeDevice);
+            return mBluetoothLeAudioService.isInbandRingtoneEnabled(groupId);
         } else {
             if (mBluetoothHeadset == null) {
                 Log.i(this, "isInbandRingingEnabled: no headset service available.");
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
index e730274..ad6d559 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
@@ -518,6 +518,8 @@
     @Test
     public void testInBandRingingEnabledForLeDevice() {
         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));