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

Commit 4e6a4835 authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Create new list of BT devices when querying" into pi-dev

parents 7cc0bb44 e79cec08
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) {