Change-Id: I8b85fc9d3b4463205f01dfaa3bb309a3dbeb8231
boolean isAudioConnected(BluetoothDevice device) {
synchronized(this) {
- if (getCurrentState() == mAudioOn && mCurrentDevice.equals(device)) {
+
+ /* Additional check for audio state included for the case when PhoneApp queries
+ Bluetooth Audio state, before we receive the close event from the stack for the
+ sco disconnect issued in AudioOn state. This was causing a mismatch in the
+ Incall screen UI. */
+
+ if (getCurrentState() == mAudioOn && mCurrentDevice.equals(device)
+ && mAudioState != BluetoothHeadset.STATE_AUDIO_DISCONNECTED)
+ {
return true;
}
}