Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b56a9951 authored by Hall Liu's avatar Hall Liu
Browse files

Create new list of BT devices when querying

Don't store a view of the available BT devices in CARSM's version of
CallAudioState. Create a new list instead.

Change-Id: Ib66706ca1844fdb2b7d6ba1a7713840d598722f3
Fixes: 79154559
Test: manual
parent 7ca497ba
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.media.IAudioService;
import android.os.Binder;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.telecom.CallAudioState;
import android.telecom.Log;
+6 −3
Original line number Diff line number Diff line
@@ -32,7 +32,9 @@ import com.android.server.telecom.BluetoothHeadsetProxy;
import com.android.server.telecom.TelecomSystem;
import com.android.server.telecom.Timeouts;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -563,7 +565,7 @@ public class BluetoothRouteManager extends StateMachine {
        sendMessage(NEW_DEVICE_CONNECTED, args);

        mListener.onBluetoothDeviceListChanged();
        if (getConnectedDevices().size() == 1) {
        if (mDeviceManager.getConnectedDevices().size() == 1) {
            mListener.onBluetoothDeviceAvailable();
        }
    }
@@ -575,13 +577,14 @@ public class BluetoothRouteManager extends StateMachine {
        sendMessage(LOST_DEVICE, args);

        mListener.onBluetoothDeviceListChanged();
        if (getConnectedDevices().size() == 0) {
        if (mDeviceManager.getConnectedDevices().size() == 0) {
            mListener.onBluetoothDeviceUnavailable();
        }
    }

    public Collection<BluetoothDevice> getConnectedDevices() {
        return mDeviceManager.getConnectedDevices();
        return Collections.unmodifiableCollection(
                new ArrayList<>(mDeviceManager.getConnectedDevices()));
    }

    private String connectHfpAudio(String address) {