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

Commit 2c8308de authored by jiangyou li's avatar jiangyou li Committed by android-build-merger
Browse files

Merge "Avoid a NullPointerException in getDevicesMatchingConnectionStates" am:...

Merge "Avoid a NullPointerException in getDevicesMatchingConnectionStates" am: 38609374 am: 47310cd6
am: 27ee27b0

Change-Id: I6a00b253806e487f02194a35efd069cd2af5016a
parents b4f73b22 27ee27b0
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -220,7 +220,9 @@ public class HeadsetService extends ProfileService {
        mStateMachinesThread.quitSafely();
        mStateMachinesThread = null;
        // Step 1: Clear
        synchronized (mStateMachines) {
            mAdapterService = null;
        }
        return true;
    }

@@ -771,14 +773,14 @@ public class HeadsetService extends ProfileService {
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        ArrayList<BluetoothDevice> devices = new ArrayList<>();
        if (states == null) {
        synchronized (mStateMachines) {
            if (states == null || mAdapterService == null) {
                return devices;
            }
            final BluetoothDevice[] bondedDevices = mAdapterService.getBondedDevices();
            if (bondedDevices == null) {
                return devices;
            }
        synchronized (mStateMachines) {
            for (BluetoothDevice device : bondedDevices) {
                final ParcelUuid[] featureUuids = mAdapterService.getRemoteUuids(device);
                if (!BluetoothUuid.containsAnyUuid(featureUuids, HEADSET_UUIDS)) {