From b77c5ffd3d5f944ef56167880da67c4e1eee6b7f Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 17 Mar 2014 09:10:01 +0100 Subject: [PATCH] android/handsfree: Fix connecting audio when call is active on connect --- android/handsfree.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/android/handsfree.c b/android/handsfree.c index 62bb1cfce..c8e5f8a69 100644 --- a/android/handsfree.c +++ b/android/handsfree.c @@ -2089,6 +2089,14 @@ static void phone_state_idle(int num_active, int num_held) /* TODO better way for forcing indicator */ device.inds[IND_CALLHELD].val = 0; update_indicator(IND_CALLHELD, 1); + } else if (num_active > 0 && device.num_active == 0) { + /* If number of active calls change but there was no + * call setup change this means that there were active + * calls present when headset was connected. + * + * TODO should we care about held calls here as well? + */ + connect_audio(); } else { update_indicator(IND_CALLHELD, num_held ? (num_active ? 1 : 2) : 0); @@ -2096,10 +2104,6 @@ static void phone_state_idle(int num_active, int num_held) update_indicator(IND_CALL, !!(num_active + num_held)); update_indicator(IND_CALLSETUP, 0); - - break; - case HAL_HANDSFREE_CALL_STATE_ACTIVE: - connect_audio(); break; default: DBG("unhandled state %u", device.setup_state); -- 2.47.3