diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 12481af..0776e9d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -315,9 +315,6 @@
             <intent-filter>
                 <action android:name="android.bluetooth.IBluetoothHeadsetPhone"/>
             </intent-filter>
-            <intent-filter>
-                <action android:name="android.bluetooth.IBluetoothLeCallControlCallback" />
-            </intent-filter>
         </service>
 
         <service android:name=".components.TelecomService"
diff --git a/src/com/android/server/telecom/CallAudioRouteStateMachine.java b/src/com/android/server/telecom/CallAudioRouteStateMachine.java
index f6f710e..e5a6ecc 100644
--- a/src/com/android/server/telecom/CallAudioRouteStateMachine.java
+++ b/src/com/android/server/telecom/CallAudioRouteStateMachine.java
@@ -875,8 +875,8 @@
                     return HANDLED;
                 case SWITCH_FOCUS:
                     if (msg.arg1 == NO_FOCUS) {
-                        // Only disconnect audio here instead of routing away from BT entirely.
-                        mBluetoothRouteManager.disconnectAudio();
+                        // Only disconnect SCO audio here instead of routing away from BT entirely.
+                        mBluetoothRouteManager.disconnectSco();
                         reinitialize();
                         mCallAudioManager.notifyAudioOperationsComplete();
                     } else if (msg.arg1 == RINGING_FOCUS
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
index cb31990..c7671e3 100644
--- a/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
+++ b/src/com/android/server/telecom/bluetooth/BluetoothDeviceManager.java
@@ -20,7 +20,6 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
-import android.bluetooth.BluetoothLeAudio;
 import android.bluetooth.BluetoothProfile;
 import android.content.Context;
 import android.telecom.Log;
@@ -38,11 +37,6 @@
 import java.util.Set;
 
 public class BluetoothDeviceManager {
-
-    public static final int DEVICE_TYPE_HEADSET = 0;
-    public static final int DEVICE_TYPE_HEARING_AID = 1;
-    public static final int DEVICE_TYPE_LE_AUDIO = 2;
-
     private final BluetoothProfile.ServiceListener mBluetoothProfileServiceListener =
             new BluetoothProfile.ServiceListener() {
                 @Override
@@ -58,10 +52,6 @@
                                 mBluetoothHearingAid = (BluetoothHearingAid) proxy;
                                 logString = "Got BluetoothHearingAid: "
                                         + mBluetoothHearingAid;
-                            } else if (profile == BluetoothProfile.LE_AUDIO) {
-                                mBluetoothLeAudioService = (BluetoothLeAudio) proxy;
-                                logString = "Got BluetoothLeAudio: "
-                                        + mBluetoothLeAudioService;
                             } else {
                                 logString = "Connected to non-requested bluetooth service." +
                                         " Not changing bluetooth headset.";
@@ -84,8 +74,7 @@
                             if (profile == BluetoothProfile.HEADSET) {
                                 mBluetoothHeadset = null;
                                 lostServiceDevices = mHfpDevicesByAddress;
-                                mBluetoothRouteManager.onActiveDeviceChanged(null,
-                                        DEVICE_TYPE_HEADSET);
+                                mBluetoothRouteManager.onActiveDeviceChanged(null, false);
                                 logString = "Lost BluetoothHeadset service. " +
                                         "Removing all tracked devices";
                             } else if (profile == BluetoothProfile.HEARING_AID) {
@@ -93,15 +82,7 @@
                                 logString = "Lost BluetoothHearingAid service. " +
                                         "Removing all tracked devices.";
                                 lostServiceDevices = mHearingAidDevicesByAddress;
-                                mBluetoothRouteManager.onActiveDeviceChanged(null,
-                                        DEVICE_TYPE_HEARING_AID);
-                            } else if (profile == BluetoothProfile.LE_AUDIO) {
-                                mBluetoothLeAudioService = null;
-                                logString = "Lost BluetoothLeAudio service. " +
-                                        "Removing all tracked devices.";
-                                lostServiceDevices = mLeAudioDevicesByAddress;
-                                mBluetoothRouteManager.onActiveDeviceChanged(null,
-                                        DEVICE_TYPE_LE_AUDIO);
+                                mBluetoothRouteManager.onActiveDeviceChanged(null, true);
                             } else {
                                 return;
                             }
@@ -127,12 +108,6 @@
             new LinkedHashMap<>();
     private final LinkedHashMap<BluetoothDevice, Long> mHearingAidDeviceSyncIds =
             new LinkedHashMap<>();
-    private final LinkedHashMap<String, BluetoothDevice> mLeAudioDevicesByAddress =
-            new LinkedHashMap<>();
-    private final LinkedHashMap<BluetoothDevice, Integer> mGroupsByDevice =
-            new LinkedHashMap<>();
-    private int mGroupIdActive = BluetoothLeAudio.GROUP_ID_INVALID;
-    private int mGroupIdPending = BluetoothLeAudio.GROUP_ID_INVALID;
     private final LocalLog mLocalLog = new LocalLog(20);
 
     // This lock only protects internal state -- it doesn't lock on anything going into Telecom.
@@ -141,7 +116,6 @@
     private BluetoothRouteManager mBluetoothRouteManager;
     private BluetoothHeadset mBluetoothHeadset;
     private BluetoothHearingAid mBluetoothHearingAid;
-    private BluetoothLeAudio mBluetoothLeAudioService;
     private BluetoothDevice mBluetoothHearingAidActiveDeviceCache;
     private BluetoothAdapter mBluetoothAdapter;
 
@@ -152,8 +126,6 @@
                     BluetoothProfile.HEADSET);
             bluetoothAdapter.getProfileProxy(context, mBluetoothProfileServiceListener,
                     BluetoothProfile.HEARING_AID);
-            bluetoothAdapter.getProfileProxy(context, mBluetoothProfileServiceListener,
-                    BluetoothProfile.LE_AUDIO);
         }
     }
 
@@ -161,20 +133,9 @@
         mBluetoothRouteManager = brm;
     }
 
-    private List<BluetoothDevice> getLeAudioConnectedDevices() {
-        synchronized (mLock) {
-            // Filter out disconnected devices and/or those that have no group assigned
-            ArrayList<BluetoothDevice> devices = new ArrayList<>(mGroupsByDevice.keySet());
-            devices.removeIf(device -> !mLeAudioDevicesByAddress.containsValue(device));
-            return devices;
-        }
-    }
-
     public int getNumConnectedDevices() {
         synchronized (mLock) {
-            return mHfpDevicesByAddress.size() +
-                    mHearingAidDevicesByAddress.size() +
-                    getLeAudioConnectedDevices().size();
+            return mHfpDevicesByAddress.size() + mHearingAidDevicesByAddress.size();
         }
     }
 
@@ -182,7 +143,6 @@
         synchronized (mLock) {
             ArrayList<BluetoothDevice> result = new ArrayList<>(mHfpDevicesByAddress.values());
             result.addAll(mHearingAidDevicesByAddress.values());
-            result.addAll(getLeAudioConnectedDevices());
             return Collections.unmodifiableCollection(result);
         }
     }
@@ -217,31 +177,6 @@
                 seenHiSyncIds.add(hiSyncId);
             }
         }
-
-        Set<Integer> seenGroupIds = new LinkedHashSet<>();
-        if (mBluetoothAdapter != null) {
-            for (BluetoothDevice device : mBluetoothAdapter.getActiveDevices(
-                        BluetoothProfile.LE_AUDIO)) {
-                if (device != null) {
-                    result.add(device);
-                    seenGroupIds.add(mGroupsByDevice.getOrDefault(device, -1));
-                    break;
-                }
-            }
-        }
-        synchronized (mLock) {
-            for (BluetoothDevice d : getLeAudioConnectedDevices()) {
-                int groupId = mGroupsByDevice.getOrDefault(d,
-                        BluetoothLeAudio.GROUP_ID_INVALID);
-                if (groupId == BluetoothLeAudio.GROUP_ID_INVALID
-                        || seenGroupIds.contains(groupId)) {
-                    continue;
-                }
-                result.add(d);
-                seenGroupIds.add(groupId);
-            }
-        }
-
         return Collections.unmodifiableCollection(result);
     }
 
@@ -257,10 +192,6 @@
         return mBluetoothHearingAid;
     }
 
-    public BluetoothLeAudio getLeAudioService() {
-        return mBluetoothLeAudioService;
-    }
-
     public void setHeadsetServiceForTesting(BluetoothHeadset bluetoothHeadset) {
         mBluetoothHeadset = bluetoothHeadset;
     }
@@ -269,33 +200,12 @@
         mBluetoothHearingAid = bluetoothHearingAid;
     }
 
-    public void setLeAudioServiceForTesting(BluetoothLeAudio bluetoothLeAudio) {
-        mBluetoothLeAudioService = bluetoothLeAudio;
-    }
-
-    public static String getDeviceTypeString(int deviceType) {
-        switch (deviceType) {
-            case DEVICE_TYPE_LE_AUDIO:
-                return "LeAudio";
-            case DEVICE_TYPE_HEARING_AID:
-                return "HearingAid";
-            case DEVICE_TYPE_HEADSET:
-                return "HFP";
-            default:
-                return "unknown type";
-        }
-    }
-
-    void onDeviceConnected(BluetoothDevice device, int deviceType) {
+    void onDeviceConnected(BluetoothDevice device, boolean isHearingAid) {
+        mLocalLog.log("Device connected -- address: " + device.getAddress() + " isHeadingAid: "
+                + isHearingAid);
         synchronized (mLock) {
             LinkedHashMap<String, BluetoothDevice> targetDeviceMap;
-            if (deviceType == DEVICE_TYPE_LE_AUDIO) {
-                if (mBluetoothLeAudioService == null) {
-                    Log.w(this, "LE audio service null when receiving device added broadcast");
-                    return;
-                }
-                targetDeviceMap = mLeAudioDevicesByAddress;
-            } else if (deviceType == DEVICE_TYPE_HEARING_AID) {
+            if (isHearingAid) {
                 if (mBluetoothHearingAid == null) {
                     Log.w(this, "Hearing aid service null when receiving device added broadcast");
                     return;
@@ -303,16 +213,12 @@
                 long hiSyncId = mBluetoothHearingAid.getHiSyncId(device);
                 mHearingAidDeviceSyncIds.put(device, hiSyncId);
                 targetDeviceMap = mHearingAidDevicesByAddress;
-            } else if (deviceType == DEVICE_TYPE_HEADSET) {
+            } else {
                 if (mBluetoothHeadset == null) {
                     Log.w(this, "Headset service null when receiving device added broadcast");
                     return;
                 }
                 targetDeviceMap = mHfpDevicesByAddress;
-            } else {
-                Log.w(this, "Device: " + device.getAddress() + " with invalid type: "
-                            + getDeviceTypeString(deviceType));
-                return;
             }
             if (!targetDeviceMap.containsKey(device.getAddress())) {
                 targetDeviceMap.put(device.getAddress(), device);
@@ -321,22 +227,16 @@
         }
     }
 
-    void onDeviceDisconnected(BluetoothDevice device, int deviceType) {
-        mLocalLog.log("Device disconnected -- address: " + device.getAddress() + " deviceType: "
-                + deviceType);
+    void onDeviceDisconnected(BluetoothDevice device, boolean isHearingAid) {
+        mLocalLog.log("Device disconnected -- address: " + device.getAddress() + " isHeadingAid: "
+                + isHearingAid);
         synchronized (mLock) {
             LinkedHashMap<String, BluetoothDevice> targetDeviceMap;
-            if (deviceType == DEVICE_TYPE_LE_AUDIO) {
-                targetDeviceMap = mLeAudioDevicesByAddress;
-            } else if (deviceType == DEVICE_TYPE_HEARING_AID) {
+            if (isHearingAid) {
                 mHearingAidDeviceSyncIds.remove(device);
                 targetDeviceMap = mHearingAidDevicesByAddress;
-            } else if (deviceType == DEVICE_TYPE_HEADSET) {
-                targetDeviceMap = mHfpDevicesByAddress;
             } else {
-                Log.w(this, "Device: " + device.getAddress() + " with invalid type: "
-                            + getDeviceTypeString(deviceType));
-                return;
+                targetDeviceMap = mHfpDevicesByAddress;
             }
             if (targetDeviceMap.containsKey(device.getAddress())) {
                 targetDeviceMap.remove(device.getAddress());
@@ -345,34 +245,16 @@
         }
     }
 
-    void onGroupNodeAdded(BluetoothDevice device, int groupId) {
-        Log.i(this, device.getAddress() + " group added " + groupId);
-        if (device == null || groupId == BluetoothLeAudio.GROUP_ID_INVALID) {
-            Log.w(this, "invalid parameter");
-            return;
-        }
-
-        synchronized (mLock) {
-            mGroupsByDevice.put(device, groupId);
-        }
-    }
-
-    void onGroupNodeRemoved(BluetoothDevice device, int groupId) {
-        if (device == null || groupId == BluetoothLeAudio.GROUP_ID_INVALID) {
-            Log.w(this, "invalid parameter");
-            return;
-        }
-
-        synchronized (mLock) {
-            mGroupsByDevice.remove(device);
-        }
-    }
-
     public void disconnectAudio() {
         if (mBluetoothAdapter != null) {
-            mBluetoothAdapter.removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
-            disconnectSco();
+            for (BluetoothDevice device: mBluetoothAdapter.getActiveDevices(
+                        BluetoothProfile.HEARING_AID)) {
+                if (device != null) {
+                    mBluetoothAdapter.removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
+                }
+            }
         }
+        disconnectSco();
     }
 
     public void disconnectSco() {
@@ -383,18 +265,10 @@
         }
     }
 
-    // Connect audio to the bluetooth device at address, checking to see whether it's
-    // le audio, hearing aid or a HFP device, and using the proper BT API.
+    // Connect audio to the bluetooth device at address, checking to see whether it's a hearing aid
+    // or a HFP device, and using the proper BT API.
     public boolean connectAudio(String address) {
-        if (mLeAudioDevicesByAddress.containsKey(address)) {
-            if (mBluetoothLeAudioService == null) {
-                Log.w(this, "Attempting to turn on audio when the le audio service is null");
-                return false;
-            }
-            BluetoothDevice device = mLeAudioDevicesByAddress.get(address);
-            return mBluetoothAdapter.setActiveDevice(
-                    device, BluetoothAdapter.ACTIVE_DEVICE_ALL);
-        } else if (mHearingAidDevicesByAddress.containsKey(address)) {
+        if (mHearingAidDevicesByAddress.containsKey(address)) {
             if (mBluetoothHearingAid == null) {
                 Log.w(this, "Attempting to turn on audio when the hearing aid service is null");
                 return false;
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
index 163dbb2..81f4ab6 100644
--- a/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
+++ b/src/com/android/server/telecom/bluetooth/BluetoothRouteManager.java
@@ -21,7 +21,6 @@
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
 import android.bluetooth.BluetoothProfile;
-import android.bluetooth.BluetoothLeAudio;
 import android.content.Context;
 import android.os.Message;
 import android.telecom.Log;
@@ -36,12 +35,10 @@
 import com.android.server.telecom.TelecomSystem;
 import com.android.server.telecom.Timeouts;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
@@ -297,7 +294,7 @@
                         break;
                     case BT_AUDIO_IS_ON:
                         if (Objects.equals(mDeviceAddress, address)) {
-                            Log.i(LOG_TAG, "BT connection success for device %s.", mDeviceAddress);
+                            Log.i(LOG_TAG, "HFP connection success for device %s.", mDeviceAddress);
                             transitionTo(mAudioConnectedStates.get(mDeviceAddress));
                         } else {
                             Log.w(LOG_TAG, "In connecting state for device %s but %s" +
@@ -454,7 +451,6 @@
     // Tracks the active devices in the BT stack (HFP or hearing aid).
     private BluetoothDevice mHfpActiveDeviceCache = null;
     private BluetoothDevice mHearingAidActiveDeviceCache = null;
-    private BluetoothDevice mLeAudioDeviceCache = null;
     private BluetoothDevice mMostRecentlyReportedActiveDevice = null;
 
     public BluetoothRouteManager(Context context, TelecomSystem.SyncRoot lock,
@@ -552,8 +548,8 @@
         sendMessage(DISCONNECT_HFP, args);
     }
 
-    public void disconnectAudio() {
-        mDeviceManager.disconnectAudio();
+    public void disconnectSco() {
+        mDeviceManager.disconnectSco();
     }
 
     public void cacheHearingAidDevice() {
@@ -586,37 +582,19 @@
         mListener.onBluetoothDeviceListChanged();
     }
 
-    public void onAudioOn(String address) {
-        Session session = Log.createSubsession();
-        SomeArgs args = SomeArgs.obtain();
-        args.arg1 = session;
-        args.arg2 = address;
-        sendMessage(BT_AUDIO_IS_ON, args);
-    }
-
-    public void onAudioLost(String address) {
-        Session session = Log.createSubsession();
-        SomeArgs args = SomeArgs.obtain();
-        args.arg1 = session;
-        args.arg2 = address;
-        sendMessage(BT_AUDIO_LOST, args);
-    }
-
-    public void onActiveDeviceChanged(BluetoothDevice device, int deviceType) {
-        boolean wasActiveDevicePresent = hasBtActiveDevice();
-        if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO) {
-            mLeAudioDeviceCache = device;
-        } else if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID) {
+    public void onActiveDeviceChanged(BluetoothDevice device, boolean isHearingAid) {
+        boolean wasActiveDevicePresent = mHearingAidActiveDeviceCache != null
+                || mHfpActiveDeviceCache != null;
+        if (isHearingAid) {
             mHearingAidActiveDeviceCache = device;
-        } else if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_HEADSET) {
-            mHfpActiveDeviceCache = device;
         } else {
-            return;
+            mHfpActiveDeviceCache = device;
         }
 
         if (device != null) mMostRecentlyReportedActiveDevice = device;
 
-        boolean isActiveDevicePresent = hasBtActiveDevice();
+        boolean isActiveDevicePresent = mHearingAidActiveDeviceCache != null
+                || mHfpActiveDeviceCache != null;
 
         if (wasActiveDevicePresent && !isActiveDevicePresent) {
             mListener.onBluetoothActiveDeviceGone();
@@ -626,9 +604,7 @@
     }
 
     public boolean hasBtActiveDevice() {
-        return mLeAudioDeviceCache != null ||
-                mHearingAidActiveDeviceCache != null ||
-                mHfpActiveDeviceCache != null;
+        return mHearingAidActiveDeviceCache != null || mHfpActiveDeviceCache != null;
     }
 
     public Collection<BluetoothDevice> getConnectedDevices() {
@@ -706,9 +682,6 @@
         if (mHearingAidActiveDeviceCache != null) {
             return mHearingAidActiveDeviceCache.getAddress();
         }
-        if (mLeAudioDeviceCache != null) {
-            return mLeAudioDeviceCache.getAddress();
-        }
         return null;
     }
 
@@ -732,33 +705,29 @@
         BluetoothAdapter bluetoothAdapter = mDeviceManager.getBluetoothAdapter();
         BluetoothHeadset bluetoothHeadset = mDeviceManager.getBluetoothHeadset();
         BluetoothHearingAid bluetoothHearingAid = mDeviceManager.getBluetoothHearingAid();
-        BluetoothLeAudio bluetoothLeAudio = mDeviceManager.getLeAudioService();
 
         BluetoothDevice hfpAudioOnDevice = null;
         BluetoothDevice hearingAidActiveDevice = null;
-        BluetoothDevice leAudioActiveDevice = null;
 
         if (bluetoothAdapter == null) {
             Log.i(this, "getBluetoothAudioConnectedDevice: no adapter available.");
             return null;
         }
-        if (bluetoothHeadset == null && bluetoothHearingAid == null && bluetoothLeAudio == null) {
+        if (bluetoothHeadset == null && bluetoothHearingAid == null) {
             Log.i(this, "getBluetoothAudioConnectedDevice: no service available.");
             return null;
         }
 
-        int activeDevices = 0;
         if (bluetoothHeadset != null) {
             for (BluetoothDevice device : bluetoothAdapter.getActiveDevices(
                         BluetoothProfile.HEADSET)) {
                 hfpAudioOnDevice = device;
                 break;
             }
+
             if (bluetoothHeadset.getAudioState(hfpAudioOnDevice)
                     == BluetoothHeadset.STATE_AUDIO_DISCONNECTED) {
                 hfpAudioOnDevice = null;
-            } else {
-                activeDevices++;
             }
         }
 
@@ -767,39 +736,22 @@
                         BluetoothProfile.HEARING_AID)) {
                 if (device != null) {
                     hearingAidActiveDevice = device;
-                    activeDevices++;
                     break;
                 }
             }
         }
 
-        if (bluetoothLeAudio != null) {
-            for (BluetoothDevice device : bluetoothLeAudio.getActiveDevices()) {
-                if (device != null) {
-                    leAudioActiveDevice = device;
-                    activeDevices++;
-                    break;
-                }
+        // Return the active device reported by either HFP or hearing aid. If both are reporting
+        // active devices, go with the most recent one as reported by the receiver.
+        if (hfpAudioOnDevice != null) {
+            if (hearingAidActiveDevice != null) {
+                Log.i(this, "Both HFP and hearing aid are reporting active devices. Going with"
+                        + " the most recently reported active device: %s");
+                return mMostRecentlyReportedActiveDevice;
             }
+            return hfpAudioOnDevice;
         }
-
-        // Return the active device reported by either HFP, hearing aid or le audio. If more than
-        // one is reporting active devices, go with the most recent one as reported by the receiver.
-        if (activeDevices > 1) {
-            Log.i(this, "More than one profile reporting active devices. Going with the most"
-                    + " recently reported active device: %s", mMostRecentlyReportedActiveDevice);
-            return mMostRecentlyReportedActiveDevice;
-        }
-
-        if (leAudioActiveDevice != null) {
-            return leAudioActiveDevice;
-        }
-
-        if (hearingAidActiveDevice != null) {
-            return hearingAidActiveDevice;
-        }
-
-        return hfpAudioOnDevice;
+        return hearingAidActiveDevice;
     }
 
     /**
@@ -895,12 +847,10 @@
     }
 
     @VisibleForTesting
-    public void setActiveDeviceCacheForTesting(BluetoothDevice device, int deviceType) {
-        if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO) {
-          mLeAudioDeviceCache = device;
-        } else if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID) {
+    public void setActiveDeviceCacheForTesting(BluetoothDevice device, boolean isHearingAid) {
+        if (isHearingAid) {
             mHearingAidActiveDeviceCache = device;
-        } else if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_HEADSET) {
+        } else {
             mHfpActiveDeviceCache = device;
         }
     }
diff --git a/src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java b/src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java
index 49489f4..8a14cbd 100644
--- a/src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java
+++ b/src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java
@@ -19,7 +19,6 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
-import android.bluetooth.BluetoothLeAudio;
 import android.bluetooth.BluetoothProfile;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -44,10 +43,6 @@
         INTENT_FILTER.addAction(BluetoothHeadset.ACTION_ACTIVE_DEVICE_CHANGED);
         INTENT_FILTER.addAction(BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED);
         INTENT_FILTER.addAction(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED);
-        INTENT_FILTER.addAction(BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED);
-        INTENT_FILTER.addAction(BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED);
-        INTENT_FILTER.addAction(BluetoothLeAudio.ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED);
-        INTENT_FILTER.addAction(BluetoothLeAudio.ACTION_LE_AUDIO_GROUP_STATUS_CHANGED);
     }
 
     // If not in a call, BSR won't listen to the Bluetooth stack's HFP on/off messages, since
@@ -64,19 +59,14 @@
                 case BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED:
                     handleAudioStateChanged(intent);
                     break;
-                case BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED:
                 case BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED:
                 case BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED:
                     handleConnectionStateChanged(intent);
                     break;
-                case BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED:
                 case BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED:
                 case BluetoothHeadset.ACTION_ACTIVE_DEVICE_CHANGED:
                     handleActiveDeviceChanged(intent);
                     break;
-                case BluetoothLeAudio.ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED:
-                    handleGroupNodeStatusChanged(intent);
-                    break;
             }
         } finally {
             Log.endSession();
@@ -127,52 +117,29 @@
             return;
         }
 
-        int deviceType;
-        if (BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO;
-        } else if (BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID;
-        } else if (BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEADSET;
-        } else {
-            Log.w(LOG_TAG, "handleConnectionStateChanged: %s invalid device type", device);
-            return;
-        }
-
-        Log.i(LOG_TAG, "%s device %s changed state to %d",
-                BluetoothDeviceManager.getDeviceTypeString(deviceType),
+        Log.i(LOG_TAG, "Device %s changed state to %d",
                 device.getAddress(), bluetoothHeadsetState);
 
+        boolean isHearingAid = BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED
+                .equals(intent.getAction());
         if (bluetoothHeadsetState == BluetoothProfile.STATE_CONNECTED) {
-            mBluetoothDeviceManager.onDeviceConnected(device, deviceType);
+            mBluetoothDeviceManager.onDeviceConnected(device, isHearingAid);
         } else if (bluetoothHeadsetState == BluetoothProfile.STATE_DISCONNECTED
                 || bluetoothHeadsetState == BluetoothProfile.STATE_DISCONNECTING) {
-            mBluetoothDeviceManager.onDeviceDisconnected(device, deviceType);
+            mBluetoothDeviceManager.onDeviceDisconnected(device, isHearingAid);
         }
     }
 
     private void handleActiveDeviceChanged(Intent intent) {
         BluetoothDevice device =
                 intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
-
-        int deviceType;
-        if (BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO;
-        } else if (BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID;
-        } else if (BluetoothHeadset.ACTION_ACTIVE_DEVICE_CHANGED.equals(intent.getAction())) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEADSET;
-        } else {
-            Log.w(LOG_TAG, "handleActiveDeviceChanged: %s invalid device type", device);
-            return;
-        }
-
+        boolean isHearingAid =
+                BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED.equals(intent.getAction());
         Log.i(LOG_TAG, "Device %s is now the preferred BT device for %s", device,
-                BluetoothDeviceManager.getDeviceTypeString(deviceType));
+                isHearingAid ? "hearing aid" : "HFP");
 
-        mBluetoothRouteManager.onActiveDeviceChanged(device, deviceType);
-        if (deviceType == BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID ||
-            deviceType == BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO) {
+        mBluetoothRouteManager.onActiveDeviceChanged(device, isHearingAid);
+        if (isHearingAid) {
             Session session = Log.createSubsession();
             SomeArgs args = SomeArgs.obtain();
             args.arg1 = session;
@@ -180,28 +147,12 @@
                 mBluetoothRouteManager.sendMessage(BT_AUDIO_LOST, args);
             } else {
                 if (!mIsInCall) {
-                    Log.i(LOG_TAG, "Ignoring audio on since we're not in a call");
+                    Log.i(LOG_TAG, "Ignoring hearing aid audio on since we're not in a call");
                     return;
                 }
                 args.arg2 = device.getAddress();
                 mBluetoothRouteManager.sendMessage(BT_AUDIO_IS_ON, args);
-           }
-        }
-    }
-
-    private void handleGroupNodeStatusChanged(Intent intent) {
-        BluetoothDevice device =
-                intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
-
-        int groupId = intent.getIntExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_ID,
-                BluetoothLeAudio.GROUP_ID_INVALID);
-        int groupNodeStatus = intent.getIntExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_NODE_STATUS,
-                -1);
-
-        if (groupNodeStatus == BluetoothLeAudio.GROUP_NODE_ADDED) {
-            mBluetoothDeviceManager.onGroupNodeAdded(device, groupId);
-        } else {
-            mBluetoothDeviceManager.onGroupNodeRemoved(device, groupId);
+            }
         }
     }
 
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
index fe156dc..db26aaf 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothDeviceManagerTest.java
@@ -20,7 +20,6 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
-import android.bluetooth.BluetoothLeAudio;
 import android.bluetooth.BluetoothProfile;
 import android.content.BroadcastReceiver;
 import android.content.Intent;
@@ -45,7 +44,6 @@
 import static org.mockito.ArgumentMatchers.nullable;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -57,7 +55,6 @@
     @Mock BluetoothHeadset mBluetoothHeadset;
     @Mock BluetoothAdapter mAdapter;
     @Mock BluetoothHearingAid mBluetoothHearingAid;
-    @Mock BluetoothLeAudio mBluetoothLeAudio;
 
     BluetoothDeviceManager mBluetoothDeviceManager;
     BluetoothProfile.ServiceListener serviceListenerUnderTest;
@@ -67,8 +64,6 @@
     private BluetoothDevice device2;
     private BluetoothDevice device3;
     private BluetoothDevice device4;
-    private BluetoothDevice device5;
-    private BluetoothDevice device6;
 
     @Override
     @Before
@@ -80,9 +75,6 @@
         device3 = makeBluetoothDevice("00:00:00:00:00:03");
         // hearing aid
         device4 = makeBluetoothDevice("00:00:00:00:00:04");
-        // le audio
-        device5 = makeBluetoothDevice("00:00:00:00:00:05");
-        device6 = makeBluetoothDevice("00:00:00:00:00:06");
 
         when(mBluetoothHearingAid.getHiSyncId(device2)).thenReturn(100L);
         when(mBluetoothHearingAid.getHiSyncId(device4)).thenReturn(100L);
@@ -101,7 +93,6 @@
 
         mBluetoothDeviceManager.setHeadsetServiceForTesting(mBluetoothHeadset);
         mBluetoothDeviceManager.setHearingAidServiceForTesting(mBluetoothHearingAid);
-        mBluetoothDeviceManager.setLeAudioServiceForTesting(mBluetoothLeAudio);
     }
 
     @Override
@@ -114,12 +105,10 @@
     @Test
     public void testSingleDeviceConnectAndDisconnect() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         assertEquals(1, mBluetoothDeviceManager.getNumConnectedDevices());
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device1, false));
         assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices());
     }
 
@@ -130,14 +119,9 @@
         mBluetoothDeviceManager.setHearingAidServiceForTesting(null);
 
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
 
         assertEquals(0, mBluetoothDeviceManager.getNumConnectedDevices());
     }
@@ -146,37 +130,16 @@
     @Test
     public void testMultiDeviceConnectAndDisconnect() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device5, BluetoothLeAudio.GROUP_NODE_ADDED));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3, false));
+        assertEquals(2, mBluetoothDeviceManager.getNumConnectedDevices());
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device6,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(2, device6, BluetoothLeAudio.GROUP_NODE_ADDED));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        assertEquals(3, mBluetoothDeviceManager.getNumConnectedDevices());
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device3,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device6,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device3, false));
         assertEquals(1, mBluetoothDeviceManager.getNumConnectedDevices());
     }
 
@@ -184,34 +147,11 @@
     @Test
     public void testHearingAidDedup() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device4,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
-        assertEquals(3, mBluetoothDeviceManager.getNumConnectedDevices());
-        assertEquals(2, mBluetoothDeviceManager.getUniqueConnectedDevices().size());
-    }
-
-    @SmallTest
-    @Test
-    public void testLeAudioDedup() {
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device5, BluetoothLeAudio.GROUP_NODE_ADDED));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device6,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device6, BluetoothLeAudio.GROUP_NODE_ADDED));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device4, true));
         assertEquals(3, mBluetoothDeviceManager.getNumConnectedDevices());
         assertEquals(2, mBluetoothDeviceManager.getUniqueConnectedDevices().size());
     }
@@ -220,18 +160,14 @@
     @Test
     public void testHeadsetServiceDisconnect() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         serviceListenerUnderTest.onServiceDisconnected(BluetoothProfile.HEADSET);
 
-        verify(mRouteManager).onActiveDeviceChanged(isNull(),
-                eq(BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+        verify(mRouteManager).onActiveDeviceChanged(isNull(), eq(false));
         verify(mRouteManager).onDeviceLost(device1.getAddress());
         verify(mRouteManager).onDeviceLost(device3.getAddress());
         verify(mRouteManager, never()).onDeviceLost(device2.getAddress());
@@ -243,18 +179,14 @@
     @Test
     public void testHearingAidServiceDisconnect() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3, false));
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         serviceListenerUnderTest.onServiceDisconnected(BluetoothProfile.HEARING_AID);
 
-        verify(mRouteManager).onActiveDeviceChanged(isNull(),
-                eq(BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+        verify(mRouteManager).onActiveDeviceChanged(isNull(), eq(true));
         verify(mRouteManager).onDeviceLost(device2.getAddress());
         verify(mRouteManager, never()).onDeviceLost(device1.getAddress());
         verify(mRouteManager, never()).onDeviceLost(device3.getAddress());
@@ -264,58 +196,16 @@
 
     @SmallTest
     @Test
-    public void testLeAudioServiceDisconnect() {
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device3,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothLeAudio.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        serviceListenerUnderTest.onServiceDisconnected(BluetoothProfile.LE_AUDIO);
-
-        verify(mRouteManager).onActiveDeviceChanged(isNull(),
-                eq(BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        verify(mRouteManager).onDeviceLost(device5.getAddress());
-        verify(mRouteManager, never()).onDeviceLost(device1.getAddress());
-        verify(mRouteManager, never()).onDeviceLost(device3.getAddress());
-        assertNull(mBluetoothDeviceManager.getLeAudioService());
-        assertEquals(2, mBluetoothDeviceManager.getNumConnectedDevices());
-    }
-
-    @SmallTest
-    @Test
     public void testHearingAidChangesIgnoredWhenNotInCall() {
         receiverUnderTest.setIsInCall(false);
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         Intent activeDeviceChangedIntent =
                 new Intent(BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED);
         activeDeviceChangedIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device2);
         receiverUnderTest.onReceive(mContext, activeDeviceChangedIntent);
 
-        verify(mRouteManager).onActiveDeviceChanged(device2,
-                BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID);
-        verify(mRouteManager, never()).sendMessage(BluetoothRouteManager.BT_AUDIO_IS_ON);
-    }
-
-    @SmallTest
-    @Test
-    public void testLeAudioGroupChangesIgnoredWhenNotInCall() {
-        receiverUnderTest.setIsInCall(false);
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothLeAudio.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        Intent activeDeviceChangedIntent =
-                        new Intent(BluetoothLeAudio.ACTION_LE_AUDIO_ACTIVE_DEVICE_CHANGED);
-        activeDeviceChangedIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device5);
-        receiverUnderTest.onReceive(mContext, activeDeviceChangedIntent);
-
-        verify(mRouteManager).onActiveDeviceChanged(device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO);
+        verify(mRouteManager).onActiveDeviceChanged(device2, true);
         verify(mRouteManager, never()).sendMessage(BluetoothRouteManager.BT_AUDIO_IS_ON);
     }
 
@@ -323,8 +213,7 @@
     @Test
     public void testConnectDisconnectAudioHeadset() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEADSET));
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device1, false));
         when(mAdapter.setActiveDevice(nullable(BluetoothDevice.class),
                     eq(BluetoothAdapter.ACTIVE_DEVICE_ALL))).thenReturn(true);
         mBluetoothDeviceManager.connectAudio(device1.getAddress());
@@ -339,10 +228,7 @@
     @Test
     public void testConnectDisconnectAudioHearingAid() {
         receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2,
-                        BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID));
-        when(mAdapter.setActiveDevice(nullable(BluetoothDevice.class),
-                eq(BluetoothAdapter.ACTIVE_DEVICE_ALL))).thenReturn(true);
+                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device2, true));
         mBluetoothDeviceManager.connectAudio(device2.getAddress());
         verify(mAdapter).setActiveDevice(device2, BluetoothAdapter.ACTIVE_DEVICE_ALL);
         verify(mBluetoothHeadset, never()).connectAudio();
@@ -357,98 +243,16 @@
         verify(mBluetoothHeadset).disconnectAudio();
     }
 
-    @SmallTest
-    @Test
-    public void testConnectDisconnectAudioLeAudio() {
-        receiverUnderTest.setIsInCall(true);
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device5, BluetoothLeAudio.GROUP_NODE_ADDED));
-        when(mAdapter.setActiveDevice(nullable(BluetoothDevice.class),
-                eq(BluetoothAdapter.ACTIVE_DEVICE_ALL))).thenReturn(true);
-        mBluetoothDeviceManager.connectAudio(device5.getAddress());
-        verify(mAdapter).setActiveDevice(device5, BluetoothAdapter.ACTIVE_DEVICE_ALL);
-        verify(mBluetoothHeadset, never()).connectAudio();
-        verify(mAdapter, never()).setActiveDevice(nullable(BluetoothDevice.class),
-                eq(BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL));
-
-        mBluetoothDeviceManager.disconnectAudio();
-        verify(mAdapter).removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
-    }
-
-    @SmallTest
-    @Test
-    public void testConnectEarbudLeAudio() {
-        receiverUnderTest.setIsInCall(true);
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_CONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device5, BluetoothLeAudio.GROUP_NODE_ADDED));
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothLeAudio.STATE_CONNECTED, device6,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-        receiverUnderTest.onReceive(mContext,
-                buildGroupNodeStatusChangedIntent(1, device6, BluetoothLeAudio.GROUP_NODE_ADDED));
-        when(mAdapter.setActiveDevice(nullable(BluetoothDevice.class),
-                eq(BluetoothAdapter.ACTIVE_DEVICE_ALL))).thenReturn(true);
-        mBluetoothDeviceManager.connectAudio(device5.getAddress());
-        verify(mAdapter).setActiveDevice(device5, BluetoothAdapter.ACTIVE_DEVICE_ALL);
-        verify(mBluetoothHeadset, never()).connectAudio();
-        verify(mAdapter, never()).setActiveDevice(nullable(BluetoothDevice.class),
-                eq(BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL));
-
-        when(mBluetoothLeAudio.getActiveDevices()).thenReturn(Arrays.asList(device5, device6));
-
-        receiverUnderTest.onReceive(mContext,
-                buildConnectionActionIntent(BluetoothHeadset.STATE_DISCONNECTED, device5,
-                        BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO));
-
-        mBluetoothDeviceManager.connectAudio(device6.getAddress());
-        verify(mAdapter).setActiveDevice(device6, BluetoothAdapter.ACTIVE_DEVICE_ALL);
-    }
-
-    private Intent buildConnectionActionIntent(int state, BluetoothDevice device, int deviceType) {
-        String intentString;
-
-        switch (deviceType) {
-            case BluetoothDeviceManager.DEVICE_TYPE_HEADSET:
-                intentString = BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED;
-                break;
-            case BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID:
-                intentString = BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED;
-                break;
-            case BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO:
-                intentString = BluetoothLeAudio.ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED;
-                break;
-            default:
-                return null;
-        }
-
-        Intent i = new Intent(intentString);
+    private Intent buildConnectionActionIntent(int state, BluetoothDevice device,
+            boolean isHearingAid) {
+        Intent i = new Intent(isHearingAid
+                ? BluetoothHearingAid.ACTION_CONNECTION_STATE_CHANGED
+                : BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
         i.putExtra(BluetoothHeadset.EXTRA_STATE, state);
         i.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
         return i;
     }
 
-    private Intent buildGroupNodeStatusChangedIntent(int groupId, BluetoothDevice device,
-                int nodeStatus) {
-        Intent i = new Intent(BluetoothLeAudio.ACTION_LE_AUDIO_GROUP_NODE_STATUS_CHANGED);
-        i.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
-        i.putExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_ID, groupId);
-        i.putExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_NODE_STATUS, nodeStatus);
-        return i;
-    }
-
-    private Intent buildGroupStatusChangedIntent(int groupId, int groupStatus) {
-        Intent i = new Intent(BluetoothLeAudio.ACTION_LE_AUDIO_GROUP_STATUS_CHANGED);
-        i.putExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_ID, groupId);
-        i.putExtra(BluetoothLeAudio.EXTRA_LE_AUDIO_GROUP_STATUS, groupStatus);
-        return i;
-    }
-
     private BluetoothDevice makeBluetoothDevice(String address) {
         Parcel p1 = Parcel.obtain();
         p1.writeString(address);
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java b/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
index d6a6d11..28f6966 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothRouteManagerTest.java
@@ -21,7 +21,6 @@
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
 import android.bluetooth.BluetoothProfile;
-import android.bluetooth.BluetoothLeAudio;
 import android.content.ContentResolver;
 import android.os.Parcel;
 import android.telecom.Log;
@@ -66,7 +65,6 @@
     @Mock private BluetoothDeviceManager mDeviceManager;
     @Mock private BluetoothHeadset mBluetoothHeadset;
     @Mock private BluetoothHearingAid mBluetoothHearingAid;
-    @Mock private BluetoothLeAudio mBluetoothLeAudio;
     @Mock private Timeouts.Adapter mTimeoutsAdapter;
     @Mock private BluetoothRouteManager.BluetoothStateListener mListener;
 
@@ -87,7 +85,7 @@
     public void testConnectHfpRetryWhileNotConnected() {
         BluetoothRouteManager sm = setupStateMachine(
                 BluetoothRouteManager.AUDIO_OFF_STATE_NAME, null);
-        setupConnectedDevices(new BluetoothDevice[]{DEVICE1}, null, null, null, null, null);
+        setupConnectedDevices(new BluetoothDevice[]{DEVICE1}, null, null, null);
         when(mTimeoutsAdapter.getRetryBluetoothConnectAudioBackoffMillis(
                 nullable(ContentResolver.class))).thenReturn(0L);
         when(mBluetoothHeadset.connectAudio()).thenReturn(false);
@@ -110,17 +108,13 @@
         BluetoothRouteManager sm = setupStateMachine(
                 BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX, DEVICE1);
         setupConnectedDevices(new BluetoothDevice[]{DEVICE1},
-                new BluetoothDevice[]{HEARING_AID_DEVICE}, new BluetoothDevice[]{DEVICE2},
-                DEVICE1, HEARING_AID_DEVICE, DEVICE2);
-        sm.onActiveDeviceChanged(DEVICE1, BluetoothDeviceManager.DEVICE_TYPE_HEADSET);
-        sm.onActiveDeviceChanged(DEVICE2, BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO);
-        sm.onActiveDeviceChanged(HEARING_AID_DEVICE,
-                BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID);
+                new BluetoothDevice[]{HEARING_AID_DEVICE}, DEVICE1, HEARING_AID_DEVICE);
+        sm.onActiveDeviceChanged(DEVICE1, false);
+        sm.onActiveDeviceChanged(HEARING_AID_DEVICE, true);
         executeRoutingAction(sm, BluetoothRouteManager.BT_AUDIO_LOST, DEVICE1.getAddress());
 
         verifyConnectionAttempt(HEARING_AID_DEVICE, 0);
         verifyConnectionAttempt(DEVICE1, 0);
-        verifyConnectionAttempt(DEVICE2, 0);
         assertEquals(BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX
                         + ":" + HEARING_AID_DEVICE.getAddress(),
                 sm.getCurrentState().getName());
@@ -132,7 +126,7 @@
     public void testAudioOnDeviceWithScoOffActiveDevice() {
         BluetoothRouteManager sm = setupStateMachine(
                 BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX, DEVICE1);
-        setupConnectedDevices(new BluetoothDevice[]{DEVICE1}, null, null, DEVICE1, null, null);
+        setupConnectedDevices(new BluetoothDevice[]{DEVICE1}, null, DEVICE1, null);
         when(mBluetoothHeadset.getAudioState(DEVICE1))
                 .thenReturn(BluetoothHeadset.STATE_AUDIO_DISCONNECTED);
         executeRoutingAction(sm, BluetoothRouteManager.BT_AUDIO_LOST, DEVICE1.getAddress());
@@ -148,8 +142,7 @@
     public void testConnectHfpRetryWhileConnectedToAnotherDevice() {
         BluetoothRouteManager sm = setupStateMachine(
                 BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX, DEVICE1);
-        setupConnectedDevices(new BluetoothDevice[]{DEVICE1, DEVICE2}, null, null, null, null,
-                              null);
+        setupConnectedDevices(new BluetoothDevice[]{DEVICE1, DEVICE2}, null, null, null);
         when(mTimeoutsAdapter.getRetryBluetoothConnectAudioBackoffMillis(
                 nullable(ContentResolver.class))).thenReturn(0L);
         when(mBluetoothHeadset.connectAudio()).thenReturn(false);
@@ -182,18 +175,16 @@
     }
 
     private void setupConnectedDevices(BluetoothDevice[] hfpDevices,
-            BluetoothDevice[] hearingAidDevices, BluetoothDevice[] leAudioDevices,
-            BluetoothDevice hfpActiveDevice, BluetoothDevice hearingAidActiveDevice,
-            BluetoothDevice leAudioDevice) {
+            BluetoothDevice[] hearingAidDevices,
+            BluetoothDevice hfpActiveDevice, BluetoothDevice hearingAidActiveDevice) {
         if (hfpDevices == null) hfpDevices = new BluetoothDevice[]{};
         if (hearingAidDevices == null) hearingAidDevices = new BluetoothDevice[]{};
-        if (leAudioDevice == null) leAudioDevices = new BluetoothDevice[]{};
 
         when(mDeviceManager.getNumConnectedDevices()).thenReturn(
-                hfpDevices.length + hearingAidDevices.length + leAudioDevices.length);
-        List<BluetoothDevice> allDevices = Stream.of(
-                Arrays.stream(hfpDevices), Arrays.stream(hearingAidDevices),
-                Arrays.stream(leAudioDevices)).flatMap(i -> i).collect(Collectors.toList());
+                hfpDevices.length + hearingAidDevices.length);
+        List<BluetoothDevice> allDevices = Stream.concat(
+                Arrays.stream(hfpDevices), Arrays.stream(hearingAidDevices))
+                .collect(Collectors.toList());
 
         when(mDeviceManager.getConnectedDevices()).thenReturn(allDevices);
         when(mBluetoothHeadset.getConnectedDevices()).thenReturn(Arrays.asList(hfpDevices));
@@ -206,8 +197,6 @@
                 .thenReturn(Arrays.asList(hearingAidDevices));
         when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.HEARING_AID)))
                 .thenReturn(Arrays.asList(hearingAidActiveDevice, null));
-        when(mBluetoothLeAudio.getActiveDevices())
-                .thenReturn(Arrays.asList(leAudioDevice, null));
     }
 
     static void executeRoutingAction(BluetoothRouteManager brm, int message, String
@@ -233,7 +222,6 @@
         when(mDeviceManager.getBluetoothHeadset()).thenReturn(mBluetoothHeadset);
         when(mDeviceManager.getBluetoothHearingAid()).thenReturn(mBluetoothHearingAid);
         when(mDeviceManager.getBluetoothAdapter()).thenReturn(mBluetoothAdapter);
-        when(mDeviceManager.getLeAudioService()).thenReturn(mBluetoothLeAudio);
         when(mBluetoothHeadset.connectAudio()).thenReturn(true);
         when(mBluetoothHeadset.setActiveDevice(nullable(BluetoothDevice.class))).thenReturn(true);
         when(mTimeoutsAdapter.getRetryBluetoothConnectAudioBackoffMillis(
diff --git a/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java b/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
index ef16eff..d96b687 100644
--- a/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
+++ b/tests/src/com/android/server/telecom/tests/BluetoothRouteTransitionTests.java
@@ -21,7 +21,6 @@
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothHearingAid;
 import android.bluetooth.BluetoothProfile;
-import android.bluetooth.BluetoothLeAudio;
 import android.content.ContentResolver;
 import android.telecom.Log;
 import android.test.suitebuilder.annotation.SmallTest;
@@ -44,8 +43,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import java.util.stream.Stream;
-import java.util.stream.Collectors;
 
 import static com.android.server.telecom.tests.BluetoothRouteManagerTest.DEVICE1;
 import static com.android.server.telecom.tests.BluetoothRouteManagerTest.DEVICE2;
@@ -83,7 +80,6 @@
         // the active device as returned by BluetoothAdapter#getActiveDevices
         private BluetoothDevice activeDevice = null;
         private List<BluetoothDevice> hearingAidBtDevices = Collections.emptyList();
-        private List<BluetoothDevice> leAudioDevices = Collections.emptyList();
 
         public BluetoothRouteTestParametersBuilder setName(String name) {
             this.name = name;
@@ -158,12 +154,6 @@
             return this;
         }
 
-        public BluetoothRouteTestParametersBuilder setLeAudioDevices(
-                List<BluetoothDevice> leAudioDevices) {
-            this.leAudioDevices = leAudioDevices;
-            return this;
-        }
-
         public BluetoothRouteTestParameters build() {
             return new BluetoothRouteTestParameters(name,
                     initialBluetoothState,
@@ -177,8 +167,7 @@
                     messageDevice,
                     audioOnDevice,
                     activeDevice,
-                    hearingAidBtDevices,
-                    leAudioDevices);
+                    hearingAidBtDevices);
 
         }
     }
@@ -198,7 +187,6 @@
         // the active device as returned by BluetoothAdapter#getActiveDevices
         private BluetoothDevice activeDevice = null;
         private List<BluetoothDevice> hearingAidBtDevices;
-        private List<BluetoothDevice> leAudioDevices;
 
         public BluetoothRouteTestParameters(String name, String initialBluetoothState,
                 BluetoothDevice initialDevice, int messageType, ListenerUpdate[]
@@ -206,7 +194,7 @@
                 expectedConnectionDevice, String expectedFinalStateName,
                 BluetoothDevice[] connectedDevices, BluetoothDevice messageDevice,
                 BluetoothDevice audioOnDevice, BluetoothDevice activeDevice,
-                List<BluetoothDevice> hearingAidBtDevices, List<BluetoothDevice> leAudioDevices) {
+                List<BluetoothDevice> hearingAidBtDevices) {
             this.name = name;
             this.initialBluetoothState = initialBluetoothState;
             this.initialDevice = initialDevice;
@@ -220,7 +208,6 @@
             this.audioOnDevice = audioOnDevice;
             this.activeDevice = activeDevice;
             this.hearingAidBtDevices = hearingAidBtDevices;
-            this.leAudioDevices = leAudioDevices;
         }
 
         @Override
@@ -238,7 +225,6 @@
                     ", connectedDevices=" + Arrays.toString(connectedDevices) +
                     ", activeDevice='" + activeDevice + '\'' +
                     ", hearingAidBtDevices ='" + hearingAidBtDevices + '\'' +
-                    ", leAudioDevices ='" + leAudioDevices + '\'' +
                     '}';
         }
     }
@@ -254,7 +240,6 @@
     @Mock private BluetoothAdapter mBluetoothAdapter;
     @Mock private BluetoothHeadset mBluetoothHeadset;
     @Mock private BluetoothHearingAid mBluetoothHearingAid;
-    @Mock private BluetoothLeAudio mBluetoothLeAudio;
     @Mock private Timeouts.Adapter mTimeoutsAdapter;
     @Mock private BluetoothRouteManager.BluetoothStateListener mListener;
 
@@ -281,16 +266,10 @@
         BluetoothRouteManager sm = setupStateMachine(
                 mParams.initialBluetoothState, mParams.initialDevice);
 
-        int deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEADSET;
-        if (mParams.hearingAidBtDevices.contains(mParams.messageDevice)) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_HEARING_AID;
-        } else if (mParams.hearingAidBtDevices.contains(mParams.messageDevice)) {
-            deviceType = BluetoothDeviceManager.DEVICE_TYPE_LE_AUDIO;
-        }
-
         setupConnectedDevices(mParams.connectedDevices,
                 mParams.audioOnDevice, mParams.activeDevice);
-        sm.setActiveDeviceCacheForTesting(mParams.activeDevice, deviceType);
+        sm.setActiveDeviceCacheForTesting(mParams.activeDevice,
+                mParams.hearingAidBtDevices.contains(mParams.messageDevice));
         if (mParams.initialDevice != null) {
             doAnswer(invocation -> {
                 SomeArgs args = SomeArgs.obtain();
@@ -306,16 +285,14 @@
         // Go through the utility methods for these two messages
         if (mParams.messageType == BluetoothRouteManager.NEW_DEVICE_CONNECTED) {
             sm.onDeviceAdded(mParams.messageDevice.getAddress());
-            sm.onActiveDeviceChanged(mParams.messageDevice, deviceType);
+            sm.onActiveDeviceChanged(mParams.messageDevice,
+                    mParams.hearingAidBtDevices.contains(mParams.messageDevice));
         } else if (mParams.messageType == BluetoothRouteManager.LOST_DEVICE) {
-            sm.onActiveDeviceChanged(null, deviceType);
+            sm.onActiveDeviceChanged(null,
+                    mParams.hearingAidBtDevices.contains(mParams.messageDevice));
             if (mParams.hearingAidBtDevices.contains(mParams.messageDevice)) {
                 when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.HEARING_AID)))
                     .thenReturn(Arrays.asList(null, null));
-                when(mBluetoothLeAudio.getActiveDevices())
-                    .thenReturn(mParams.leAudioDevices.stream()
-                       .filter(device -> device != mParams.messageDevice)
-                       .collect(Collectors.toList()));
             } else {
                 when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.HEADSET)))
                     .thenReturn(Arrays.asList((BluetoothDevice) null));
@@ -391,7 +368,6 @@
         resetMocks();
         when(mDeviceManager.getBluetoothHeadset()).thenReturn(mBluetoothHeadset);
         when(mDeviceManager.getBluetoothHearingAid()).thenReturn(mBluetoothHearingAid);
-        when(mDeviceManager.getLeAudioService()).thenReturn(mBluetoothLeAudio);
         when(mDeviceManager.connectAudio(nullable(String.class))).thenReturn(true);
         when(mTimeoutsAdapter.getRetryBluetoothConnectAudioBackoffMillis(
                 nullable(ContentResolver.class))).thenReturn(100000L);
@@ -684,36 +660,6 @@
                         + ":" + DEVICE2)
                 .build());
 
-        result.add(new BluetoothRouteTestParametersBuilder()
-                .setName("le audio device disconnects with hearing aid present")
-                .setInitialBluetoothState(BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX)
-                .setInitialDevice(DEVICE2)
-                .setConnectedDevices(DEVICE2, DEVICE3)
-                .setLeAudioDevices(Collections.singletonList(DEVICE2))
-                .setHearingAidBtDevices(Collections.singletonList(DEVICE3))
-                .setMessageType(BluetoothRouteManager.LOST_DEVICE)
-                .setMessageDevice(DEVICE2)
-                .setExpectedListenerUpdates(ListenerUpdate.AUDIO_DISCONNECTED,
-                        ListenerUpdate.DEVICE_LIST_CHANGED)
-                .setExpectedBluetoothInteraction(NONE)
-                .setExpectedFinalStateName(BluetoothRouteManager.AUDIO_OFF_STATE_NAME)
-                .build());
-
-        result.add(new BluetoothRouteTestParametersBuilder()
-                .setName("le audio device disconnects with another one connected")
-                .setInitialBluetoothState(BluetoothRouteManager.AUDIO_CONNECTED_STATE_NAME_PREFIX)
-                .setInitialDevice(DEVICE1)
-                .setConnectedDevices(DEVICE1, DEVICE2, DEVICE3)
-                .setHearingAidBtDevices(Collections.singletonList(DEVICE3))
-                .setLeAudioDevices(Arrays.asList(DEVICE1, DEVICE2))
-                .setMessageType(BluetoothRouteManager.LOST_DEVICE)
-                .setMessageDevice(DEVICE1)
-                .setExpectedListenerUpdates(ListenerUpdate.AUDIO_DISCONNECTED,
-                        ListenerUpdate.DEVICE_LIST_CHANGED)
-                .setExpectedBluetoothInteraction(NONE)
-                .setExpectedFinalStateName(BluetoothRouteManager.AUDIO_OFF_STATE_NAME)
-                .build());
-
         return result;
     }
 }
