Loading
Add Bluetooth state check as service null isn't sufficient.
When verifying if Bluetooth is up in some APIs, BluetoothDevice was only checking if the service is null. When the adapter turns off, getState can return STATE_OFF before the callback to inform the Adapter of the new state is received, so the service isn't null but the state is off for a brief period of time. Adding the state checks along with the service checks prevents being able to call an API when Bluetooth is off. Bug: 214056525 Tag: #feature Test: atest BluetoothDeviceTest Ignore-AOSP-First: Merge conflict Change-Id: Ic387a19402ec6cd3e06677f554da8a8de695b4fc