All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] android/handsfree: Improve audio connection handling
@ 2014-03-19  7:25 Szymon Janc
  2014-03-19  7:25 ` [PATCH 2/2] android/handsfree: Fix not sending callheld=2 when single call was held Szymon Janc
  2014-03-20 12:36 ` [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Szymon Janc @ 2014-03-19  7:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This add disconnecting SCO if last call was dropped (required by
Java 'virtual voice call'). Also make sure that SCO is connected
only there were no calls present before phone state change. This
makes sure SCO won't be re-connected in three way calling scenarios
when user choose to not use audio on BT headset.
---
 android/handsfree.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/android/handsfree.c b/android/handsfree.c
index c8e5f8a..ebeb751 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -1995,7 +1995,8 @@ static void phone_state_dialing(int num_active, int num_held)
 	if (num_active == 0 && num_held > 0)
 		update_indicator(IND_CALLHELD, 2);
 
-	connect_audio();
+	if (device.num_active == 0 && device.num_held == 0)
+		connect_audio();
 }
 
 static void phone_state_alerting(int num_active, int num_held)
@@ -2066,7 +2067,9 @@ static void phone_state_idle(int num_active, int num_held)
 	case HAL_HANDSFREE_CALL_STATE_INCOMING:
 		if (num_active > device.num_active) {
 			update_indicator(IND_CALL, 1);
-			connect_audio();
+
+			if (device.num_active == 0 && device.num_held == 0)
+				connect_audio();
 		}
 
 		if (num_held > device.num_held)
@@ -2089,14 +2092,16 @@ 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
+		} else if ((num_active > 0 || num_held > 0) &&
+						device.num_active == 0 &&
+						device.num_held == 0) {
+			/* If number of active or held calls change but there
+			 * was no call setup change this means that there were
 			 * calls present when headset was connected.
-			 *
-			 * TODO should we care about held calls here as well?
 			 */
 			connect_audio();
+		} else if (num_active == 0 && num_held == 0) {
+			disconnect_sco();
 		} else {
 			update_indicator(IND_CALLHELD,
 					num_held ? (num_active ? 1 : 2) : 0);
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] android/handsfree: Fix not sending callheld=2 when single call was held
  2014-03-19  7:25 [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc
@ 2014-03-19  7:25 ` Szymon Janc
  2014-03-20 12:36 ` [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-03-19  7:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

---
 android/handsfree.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/android/handsfree.c b/android/handsfree.c
index ebeb751..d56a812 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -2091,7 +2091,6 @@ static void phone_state_idle(int num_active, int num_held)
 				device.num_held == num_active) {
 			/* TODO better way for forcing indicator */
 			device.inds[IND_CALLHELD].val = 0;
-			update_indicator(IND_CALLHELD, 1);
 		} else if ((num_active > 0 || num_held > 0) &&
 						device.num_active == 0 &&
 						device.num_held == 0) {
@@ -2102,11 +2101,10 @@ static void phone_state_idle(int num_active, int num_held)
 			connect_audio();
 		} else if (num_active == 0 && num_held == 0) {
 			disconnect_sco();
-		} else {
-			update_indicator(IND_CALLHELD,
-					num_held ? (num_active ? 1 : 2) : 0);
 		}
 
+		update_indicator(IND_CALLHELD,
+					num_held ? (num_active ? 1 : 2) : 0);
 		update_indicator(IND_CALL, !!(num_active + num_held));
 		update_indicator(IND_CALLSETUP, 0);
 		break;
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] android/handsfree: Improve audio connection handling
  2014-03-19  7:25 [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc
  2014-03-19  7:25 ` [PATCH 2/2] android/handsfree: Fix not sending callheld=2 when single call was held Szymon Janc
@ 2014-03-20 12:36 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-03-20 12:36 UTC (permalink / raw)
  To: linux-bluetooth

On Wednesday 19 of March 2014 08:25:25 Szymon Janc wrote:
> This add disconnecting SCO if last call was dropped (required by
> Java 'virtual voice call'). Also make sure that SCO is connected
> only there were no calls present before phone state change. This
> makes sure SCO won't be re-connected in three way calling scenarios
> when user choose to not use audio on BT headset.
> ---
>  android/handsfree.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/android/handsfree.c b/android/handsfree.c
> index c8e5f8a..ebeb751 100644
> --- a/android/handsfree.c
> +++ b/android/handsfree.c
> @@ -1995,7 +1995,8 @@ static void phone_state_dialing(int num_active, int num_held)
>  	if (num_active == 0 && num_held > 0)
>  		update_indicator(IND_CALLHELD, 2);
>  
> -	connect_audio();
> +	if (device.num_active == 0 && device.num_held == 0)
> +		connect_audio();
>  }
>  
>  static void phone_state_alerting(int num_active, int num_held)
> @@ -2066,7 +2067,9 @@ static void phone_state_idle(int num_active, int num_held)
>  	case HAL_HANDSFREE_CALL_STATE_INCOMING:
>  		if (num_active > device.num_active) {
>  			update_indicator(IND_CALL, 1);
> -			connect_audio();
> +
> +			if (device.num_active == 0 && device.num_held == 0)
> +				connect_audio();
>  		}
>  
>  		if (num_held > device.num_held)
> @@ -2089,14 +2092,16 @@ 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
> +		} else if ((num_active > 0 || num_held > 0) &&
> +						device.num_active == 0 &&
> +						device.num_held == 0) {
> +			/* If number of active or held calls change but there
> +			 * was no call setup change this means that there were
>  			 * calls present when headset was connected.
> -			 *
> -			 * TODO should we care about held calls here as well?
>  			 */
>  			connect_audio();
> +		} else if (num_active == 0 && num_held == 0) {
> +			disconnect_sco();
>  		} else {
>  			update_indicator(IND_CALLHELD,
>  					num_held ? (num_active ? 1 : 2) : 0);
> 

Pushed.

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-20 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19  7:25 [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc
2014-03-19  7:25 ` [PATCH 2/2] android/handsfree: Fix not sending callheld=2 when single call was held Szymon Janc
2014-03-20 12:36 ` [PATCH 1/2] android/handsfree: Improve audio connection handling Szymon Janc

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.