OSDN Git Service

Additional check included for the case when PhoneApp queries Bluetooth Audio state...
authorSreenidhi T <nidhit@broadcom.com>
Tue, 5 Jun 2012 10:09:06 +0000 (03:09 -0700)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 17 Jul 2012 05:10:49 +0000 (22:10 -0700)
Change-Id: I8b85fc9d3b4463205f01dfaa3bb309a3dbeb8231

src/com/android/bluetooth/hfp/HeadsetStateMachine.java

index 7e1f834..b56f41b 100755 (executable)
@@ -1031,7 +1031,15 @@ final class HeadsetStateMachine extends StateMachine {
 
     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;
             }
         }