From acc99899ec1c747365d7568a2fe53f53dfc3593f Mon Sep 17 00:00:00 2001 From: Mallikarjuna GB <gbmalli@codeaurora.org> Date: Thu, 4 Jun 2015 16:59:39 +0530 Subject: [PATCH] Handle SLC in MultiHFPending state Use case: Connect 2 headsets one after another in quick succession. Failure: SLC for first headset is not happening. Root cause: SLC for first headset is not handled when second headset is connecting. Fix: Add handling for SLC event for HS1 in MultiHFPending state. Change-Id: If0c2553c28e233bea4622fca10c94fddd913afa7 --- .../bluetooth/hfp/HeadsetStateMachine.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java index 72f5cbfb..e547a47c 100644 --- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java @@ -1545,7 +1545,7 @@ final class HeadsetStateMachine extends StateMachine { } else { Log.e(TAG, "Handsfree phone proxy null for query phone state"); } - } + } private void processIntentScoVolume(Intent intent, BluetoothDevice device) { int volumeValue = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, 0); @@ -1920,6 +1920,9 @@ final class HeadsetStateMachine extends StateMachine { } } break; + case HeadsetHalConstants.CONNECTION_STATE_SLC_CONNECTED: + processSlcConnected(); + break; case HeadsetHalConstants.CONNECTION_STATE_CONNECTING: if (mConnectedDevicesList.contains(device)) { Log.e(TAG, "current device tries to connect back"); @@ -1998,6 +2001,19 @@ final class HeadsetStateMachine extends StateMachine { } } + private void processSlcConnected() { + if (mPhoneProxy != null) { + try { + mPhoneProxy.queryPhoneState(); + } catch (RemoteException e) { + Log.e(TAG, Log.getStackTraceString(new Throwable())); + } + } else { + Log.e(TAG, "Handsfree phone proxy null for query phone state"); + } + } + + private void processMultiHFConnected(BluetoothDevice device) { log("MultiHFPending state: processMultiHFConnected"); if (mActiveScoDevice != null && mActiveScoDevice.equals(device)) { -- GitLab