OSDN Git Service

DO NOT MERGE ANYWHERE Spoof response to AT+CNUM if we don't get a reply from the...
authorSharvil Nanavati <sharvil@google.com>
Wed, 27 Jan 2016 17:43:16 +0000 (09:43 -0800)
committerSharvil Nanavati <sharvil@google.com>
Wed, 27 Jan 2016 17:43:16 +0000 (09:43 -0800)
The Huawei Honor 4X CHE1-CL10 phone doesn't reply to AT+CNUM so
we end up disconnecting the service level connection. In this CL,
I'm spoofing an OK response to AT+CNUM in case we time out waiting
for a reply.

Bug: 26504036
Change-Id: I91d5ab4ea91fd67b3f6c6f796c39fd0091bff5cf

bta/hf_client/bta_hf_client_at.c

index 4b239d9..755c5d6 100644 (file)
  *  limitations under the License.
  *
  ******************************************************************************/
+
+#define LOG_TAG "bt_hf_client"
+
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
 
 #include "bta_hf_client_api.h"
 #include "bta_hf_client_int.h"
+#include "osi/include/log.h"
 #include "port_api.h"
 
 /* Uncomment to enable AT traffic dumping */
@@ -145,9 +149,13 @@ static void bta_hf_client_at_resp_timer_cback (TIMER_LIST_ENT *p_tle)
     {
         bta_hf_client_cb.scb.at_cb.resp_timer_on = FALSE;
 
-        APPL_TRACE_ERROR("HFPClient: AT response timeout, disconnecting");
-
-        bta_hf_client_sm_execute(BTA_HF_CLIENT_API_CLOSE_EVT, NULL);
+        if (bta_hf_client_cb.scb.at_cb.current_cmd == BTA_HF_CLIENT_AT_CNUM) {
+          LOG_INFO("%s timed out waiting for AT+CNUM response; spoofing OK.", __func__);
+          bta_hf_client_handle_ok();
+        } else {
+          APPL_TRACE_ERROR("HFPClient: AT response timeout, disconnecting");
+          bta_hf_client_sm_execute(BTA_HF_CLIENT_API_CLOSE_EVT, NULL);
+        }
     }
 }