Snap for 6148474 from bb9b867b3fe387c7ea949efc45e308d03bf67060 to q-keystone-qcom-release
Change-Id: I4f502558107c6b79cb26c38755a097bb7004a4c1
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 491a0bb..fa5a525 100644
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -2208,6 +2208,37 @@
mNativeInterface.phoneStateChange(mDevice, updateCallState);
mIsCallIndDelay = true;
}
+
+ /* The device is blacklisted for sending incoming call setup
+ * indicator after SCO disconnection and sending active call end
+ * indicator. While the incoming call setup indicator is in queue,
+ * waiting call moved to active state. Send call setup update first
+ * and remove it from queue. Create SCO since SCO might be in
+ * disconnecting/disconnected state */
+ if (mIsBlacklistedDevice &&
+ callState.mNumActive == 1 &&
+ callState.mNumHeld == 0 &&
+ callState.mCallState == HeadsetHalConstants.CALL_STATE_IDLE &&
+ hasMessages(SEND_INCOMING_CALL_IND)) {
+
+ Log.w(TAG, "waiting call moved to active state while incoming call");
+ Log.w(TAG, "setup indicator is in queue. Send it first and create SCO");
+ //remove call setup indicator from queue.
+ removeMessages(SEND_INCOMING_CALL_IND);
+
+ HeadsetCallState incomingCallSetupState =
+ new HeadsetCallState(0, 0, HeadsetHalConstants.CALL_STATE_INCOMING,
+ mSystemInterface.getHeadsetPhoneState().getNumber(),
+ mSystemInterface.getHeadsetPhoneState().getType(),
+ "");
+ mNativeInterface.phoneStateChange(mDevice, incomingCallSetupState);
+
+ if (mDevice.equals(mHeadsetService.getActiveDevice())) {
+ Message m = obtainMessage(CONNECT_AUDIO);
+ m.obj = mDevice;
+ sendMessage(m);
+ }
+ }
}
mStateMachineCallState.mNumActive = callState.mNumActive;
mStateMachineCallState.mNumHeld = callState.mNumHeld;