• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revision9cb269c25be642526c4152ed7c14158300f28969 (tree)
Zeit2017-04-13 07:23:46
AutorJack He <siyuanh@goog...>
CommiterJack He

Log Message

Add support for inband ringing feature

* Change HFP init API so that the HFP feature bit field depends on

whether in-band ringing is supported on the device

* Feature disabled by default unless system property enables it

Bug: 19171297
Test: mm -j 40, HFP regression test, testplans/82144
Change-Id: Ib8ba28ac6e70eb23b2a2ad11c5805793911a4e43
(cherry picked from commit 7a9892c63bad8f8d93681fb74d5532a79387b60e)

Ändern Zusammenfassung

Diff

--- a/bta/ag/bta_ag_cmd.cc
+++ b/bta/ag/bta_ag_cmd.cc
@@ -1316,15 +1316,14 @@ void bta_ag_hsp_result(tBTA_AG_SCB* p_scb, tBTA_AG_API_RESULT* p_result) {
13161316 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
13171317 (p_scb->features & BTA_AG_FEAT_NOSCO)) {
13181318 bta_ag_send_ring(p_scb, (tBTA_AG_DATA*)p_result);
1319- }
1320- /* else open sco, send ring after sco opened */
1321- else {
1319+ } else {
1320+ /* else open sco, send ring after sco opened */
13221321 /* HSPv1.2: AG shall not send RING if using in-band ring tone. */
1323- if (p_scb->hsp_version >= HSP_VERSION_1_2)
1322+ if (p_scb->hsp_version >= HSP_VERSION_1_2) {
13241323 p_scb->post_sco = BTA_AG_POST_SCO_NONE;
1325- else
1324+ } else {
13261325 p_scb->post_sco = BTA_AG_POST_SCO_RING;
1327-
1326+ }
13281327 bta_ag_sco_open(p_scb, (tBTA_AG_DATA*)p_result);
13291328 }
13301329 break;
@@ -1337,12 +1336,14 @@ void bta_ag_hsp_result(tBTA_AG_SCB* p_scb, tBTA_AG_API_RESULT* p_result) {
13371336 }
13381337
13391338 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) {
1340- /* if audio connected to this scb open sco */
1341- if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb)) {
1339+ /* if audio connected to this scb AND sco is not opened, open sco */
1340+ if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1341+ !bta_ag_sco_is_open(p_scb)) {
13421342 bta_ag_sco_open(p_scb, (tBTA_AG_DATA*)p_result);
13431343 }
13441344 /* else if no audio at call close sco */
1345- else if (p_result->data.audio_handle == BTA_AG_HANDLE_NONE) {
1345+ else if (p_result->data.audio_handle == BTA_AG_HANDLE_NONE &&
1346+ bta_ag_sco_is_open(p_scb)) {
13461347 bta_ag_sco_close(p_scb, (tBTA_AG_DATA*)p_result);
13471348 }
13481349 }
@@ -1435,9 +1436,8 @@ void bta_ag_hfp_result(tBTA_AG_SCB* p_scb, tBTA_AG_API_RESULT* p_result) {
14351436 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
14361437 (p_scb->features & BTA_AG_FEAT_NOSCO)) {
14371438 bta_ag_send_ring(p_scb, (tBTA_AG_DATA*)p_result);
1438- }
1439- /* else open sco, send ring after sco opened */
1440- else {
1439+ } else {
1440+ /* else open sco, send ring after sco opened */
14411441 p_scb->post_sco = BTA_AG_POST_SCO_RING;
14421442 bta_ag_sco_open(p_scb, (tBTA_AG_DATA*)p_result);
14431443 }
@@ -1453,7 +1453,8 @@ void bta_ag_hfp_result(tBTA_AG_SCB* p_scb, tBTA_AG_API_RESULT* p_result) {
14531453 bta_ag_send_call_inds(p_scb, p_result->result);
14541454
14551455 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) {
1456- if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb)) {
1456+ if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1457+ !bta_ag_sco_is_open(p_scb)) {
14571458 bta_ag_sco_open(p_scb, (tBTA_AG_DATA*)p_result);
14581459 } else if ((p_result->data.audio_handle == BTA_AG_HANDLE_NONE) &&
14591460 bta_ag_sco_is_open(p_scb)) {
--- a/btif/src/btif_hf.cc
+++ b/btif/src/btif_hf.cc
@@ -41,6 +41,7 @@
4141 #include "btif_hf.h"
4242 #include "btif_profile_queue.h"
4343 #include "btif_util.h"
44+#include "osi/include/properties.h"
4445
4546 /*******************************************************************************
4647 * Constants & Macros
@@ -84,6 +85,9 @@
8485 #endif
8586 #endif
8687
88+/* HF features supported at runtime */
89+static uint32_t btif_hf_features = BTIF_HF_FEATURES;
90+
8791 #define BTIF_HF_CALL_END_TIMEOUT 6
8892
8993 #define BTIF_HF_INVALID_IDX (-1)
@@ -671,6 +675,17 @@ static void btif_in_hf_generic_evt(uint16_t event, char* p_param) {
671675 }
672676 }
673677
678+static bool inband_ringing_property_enabled() {
679+ char inband_ringing_flag[PROPERTY_VALUE_MAX] = {0};
680+ osi_property_get("persist.bluetooth.enableinbandringing", inband_ringing_flag,
681+ "false");
682+ if (strncmp(inband_ringing_flag, "true", 4) == 0) {
683+ BTIF_TRACE_DEBUG("%s: In-band ringing enabled by property", __func__);
684+ return true;
685+ }
686+ return false;
687+}
688+
674689 /*******************************************************************************
675690 *
676691 * Function btif_hf_init
@@ -680,10 +695,20 @@ static void btif_in_hf_generic_evt(uint16_t event, char* p_param) {
680695 * Returns bt_status_t
681696 *
682697 ******************************************************************************/
683-static bt_status_t init(bthf_callbacks_t* callbacks, int max_hf_clients) {
698+static bt_status_t init(bthf_callbacks_t* callbacks, int max_hf_clients,
699+ bool inband_ringing_supported) {
700+ bool inband_ringing_property_enable = inband_ringing_property_enabled();
701+ if (inband_ringing_supported && inband_ringing_property_enable) {
702+ btif_hf_features |= BTA_AG_FEAT_INBAND;
703+ } else {
704+ btif_hf_features &= ~BTA_AG_FEAT_INBAND;
705+ }
684706 btif_max_hf_clients = max_hf_clients;
685- BTIF_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btif_max_hf_clients);
686-
707+ BTIF_TRACE_DEBUG(
708+ "%s: btif_hf_features=%zu, max_hf_clients=%d, "
709+ "inband_ringing=[supported=%d, enabled=%d]",
710+ __func__, btif_hf_features, btif_max_hf_clients, inband_ringing_supported,
711+ inband_ringing_property_enable);
687712 bt_hf_callbacks = callbacks;
688713 memset(&btif_hf_cb, 0, sizeof(btif_hf_cb));
689714
@@ -1331,10 +1356,11 @@ static bt_status_t phone_state_change(int num_active, int num_held,
13311356 } break;
13321357
13331358 case BTHF_CALL_STATE_INCOMING:
1334- if (num_active || num_held)
1359+ if (num_active || num_held) {
13351360 res = BTA_AG_CALL_WAIT_RES;
1336- else
1361+ } else {
13371362 res = BTA_AG_IN_CALL_RES;
1363+ }
13381364 if (number) {
13391365 int xx = 0;
13401366 if ((type == BTHF_CALL_ADDRTYPE_INTERNATIONAL) && (*number != '+'))
@@ -1560,7 +1586,7 @@ bt_status_t btif_hf_execute_service(bool b_enable) {
15601586 /* Enable and register with BTA-AG */
15611587 BTA_AgEnable(BTA_AG_PARSE, bte_hf_evt);
15621588 for (i = 0; i < btif_max_hf_clients; i++) {
1563- BTA_AgRegister(BTIF_HF_SERVICES, BTIF_HF_SECURITY, BTIF_HF_FEATURES,
1589+ BTA_AgRegister(BTIF_HF_SERVICES, BTIF_HF_SECURITY, btif_hf_features,
15641590 p_service_names, bthf_hf_id[i]);
15651591 }
15661592 } else {