Resolve NPE in getConnectionState()

This change tactically addresses a potential NPE on a equals() call using
mCurrentDevice. If we're disconnecting when getConnectedState() is
called then there's a concurrency bug that could allow us to use
mCurrentDevice when its been set to null in the state machine.

Rather than refactor the code at this time, the best way to handle this
is to null check the input (which won't change) and call equals() on it.

Tag: #stability
Bug: 170919518
Test: atest BluetoothInstrumentationTests
Change-Id: If02192180fb07fd2d70899b626c3a81a4b33a0a2
1 file changed