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

Commit 90460c79 authored by Jason Monk's avatar Jason Monk Committed by Android (Google) Code Review
Browse files

Merge "Add more intelligence to bluetooth connection state" into mnc-dev

parents bd29b07e bba7317d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -164,11 +164,18 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa
            // Our current device is still valid.
            return;
        }
        mLastDevice = null;
        for (CachedBluetoothDevice device : getDevices()) {
            if (device.isConnected()) {
                mLastDevice = device;
            }
        }
        if (mLastDevice == null && mConnectionState == BluetoothAdapter.STATE_CONNECTED) {
            // If somehow we think we are connected, but have no connected devices, we aren't
            // connected.
            mConnectionState = BluetoothAdapter.STATE_DISCONNECTED;
            mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED);
        }
    }

    @Override