OSDN Git Service

am f29a2fb..e07ad10 from mirror-m-wireless-internal-release
authorVinit Deshpande <vinitd@google.com>
Tue, 14 Apr 2015 23:00:10 +0000 (16:00 -0700)
committerVinit Deshpande <vinitd@google.com>
Tue, 14 Apr 2015 23:00:10 +0000 (16:00 -0700)
e07ad10 merge in m-wireless-internal-release history after reset to d232721ae5e5b6949a5249f0d116408b8a3c5f1d
d232721 L2CAP socket - fix merge errors
899b771 BR/EDR secure connections support
7fb0da6 Support numeric comparison in SMP
aa351f2 merge in m-wireless-internal-release history after reset to 399e89150b3df87172bdf92d54712b379324b149
399e891 Fix for AVRCP CTRL stops sending pass through command
daddea9 Free Avrcp Controller callbacks on Cleanup
764babe Protect reset of out stream with mutex
444a8da LE Privacy 1.2 and LE secure connections
8372aa5 L2CAP and SDP Search API for BT profiles (2/2)
fd422a7 Update Service Availability.
2a0652a merge in m-wireless-internal-release history after reset to 0b47e0a35c16f5b7d77c30ec1c095ed92ff4fd74
78d0f4c merge in m-wireless-internal-release history after reset to m-wireless-internal-dev
0b47e0a Avoid duplicate disconnection callbacks for fixed channel connections
5646973 Add a section on assertions to the style guide.
d768767 Merge "Avoid null-pointer dereference in l2c_release_lcb()" into m-wireless-dev
ef92b53 Avoid null-pointer dereference in l2c_release_lcb()
4bf68bf merge in m-wireless-internal-release history after reset to f538707fe64c62b1dbb8e4210e4a1bfa0bab2b56
de6ac86 Add a 'Bluedroid conventions' section to the style guide.
1b80439 Add a section to the style guide on variable declarations.
485f19e merge in m-wireless-internal-release history after reset to 4540f59bc447dc2b7b31a3e974b74a60b2417e7d
bef8940 merge in m-wireless-internal-release history after reset to 841c9103cad1898ceca87b734acd4d4537f9f452
ab4c38c merge in m-wireless-internal-release history after reset to a7e698f5a9e062f62e21bc435643975c30bab846
2807a74 merge in m-wireless-internal-release history after reset to a7e698f5a9e062f62e21bc435643975c30bab846
99dbe9a merge in m-wireless-internal-release history after reset to 78c0b060f29b7b7014adddb2f98bf6ae9755c488
f7f8399 merge in m-wireless-internal-release history after reset to a5371c238b4e874d8313ac56a23451e7345ff541
3aa60d7 Make A2DP audio HAL a shared library again
3256a31 Move unused include file out of hci_audio.h
b866b69 Add option for schedule_next_instance to force rescheduling
4ae5e3e Ensure alarms are called back when they expire in the past
a7bd03e Rewrite alarms to use a single posix timer instance
88e7b15 Resolved hardware error observed during SCO Connection setup

Change-Id: Ib9a0a2ffca1d4811a9a9e56674bf43275d8b2205

74 files changed:
MODULE_LICENSE_APACHE2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
bta/Android.mk
bta/av/bta_av_aact.c
bta/av/bta_av_api.c
bta/av/bta_av_cfg.c
bta/dm/bta_dm_act.c
bta/gatt/bta_gattc_utils.c
bta/gatt/bta_gatts_act.c
bta/hf_client/bta_hf_client_act.c
bta/hf_client/bta_hf_client_api.c
bta/hf_client/bta_hf_client_rfc.c
bta/hf_client/bta_hf_client_sdp.c
bta/hh/bta_hh_le.c
bta/hl/bta_hl_ci.c
bta/hl/bta_hl_utils.c
bta/include/bta_api.h
bta/jv/bta_jv_act.c
btcore/src/module.c
btif/co/bta_av_co.c
btif/co/bta_hh_co.c
btif/co/bta_pan_co.c
btif/src/btif_av.c
btif/src/btif_core.c
btif/src/btif_dm.c
btif/src/btif_gatt_client.c
btif/src/btif_gatt_multi_adv_util.c
btif/src/btif_gatt_util.c
btif/src/btif_hf.c
btif/src/btif_hf_client.c
btif/src/btif_hh.c
btif/src/btif_hl.c
btif/src/btif_media_task.c
btif/src/btif_pan.c
btif/src/btif_profile_queue.c
btif/src/btif_rc.c
btif/src/btif_sock_rfc.c
btif/src/btif_sock_sdp.c
btif/src/btif_sock_thread.c
btif/src/btif_storage.c
gki/Android.mk
hci/src/btsnoop.c
hci/src/hci_layer.c
hci/src/hci_packet_parser.c
main/Android.mk
osi/src/alarm.c
osi/src/list.c
osi/src/semaphore.c
osi/src/thread.c
stack/Android.mk
stack/avct/avct_lcb_act.c
stack/avrc/avrc_pars_ct.c
stack/btm/btm_acl.c
stack/btm/btm_ble.c
stack/btm/btm_ble_batchscan.c
stack/btm/btm_ble_gap.c
stack/btm/btm_ble_multi_adv.c
stack/btm/btm_inq.c
stack/btm/btm_sec.c
stack/btu/btu_hcif.c
stack/gatt/gatt_sr.c
stack/l2cap/l2c_main.c
stack/mcap/mca_dact.c
stack/pan/pan_utils.c
stack/rfcomm/port_api.c
stack/rfcomm/rfc_ts_frames.c
stack/sdp/sdp_api.c
stack/sdp/sdp_discovery.c
stack/sdp/sdp_server.c
test/bluedroidtest/Android.mk
test/suite/base.h
tools/bdtool/Android.mk
udrv/ulinux/uipc.c
utils/Android.mk

diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
index cb11643..9f3de3a 100644 (file)
@@ -7,8 +7,8 @@ LOCAL_CFLAGS += \
        -DBOARD_HAVE_BLUETOOTH_BCM
 endif
 LOCAL_CFLAGS += -DBUILDCFG $(bdroid_CFLAGS) -std=c99
+LOCAL_CLANG_CFLAGS += -Wno-error=gnu-variable-sized-type-not-at-end
 
-LOCAL_PRELINK_MODULE:=false
 LOCAL_SRC_FILES:= \
     ./dm/bta_dm_ci.c \
     ./dm/bta_dm_act.c \
index dd2feec..c394d66 100644 (file)
@@ -1118,7 +1118,6 @@ void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
     tAVDT_CFG            *p_evt_cfg = &p_data->str_msg.cfg;
     UINT8   psc_mask = (p_evt_cfg->psc_mask | p_scb->cfg.psc_mask);
     UINT8 local_sep;    /* sep type of local handle on which connection was received */
-    UINT8 count = 0;
     tBTA_AV_STR_MSG  *p_msg = (tBTA_AV_STR_MSG *)p_data;
     UNUSED(p_data);
 
index 7151ae7..ecc05e1 100644 (file)
@@ -255,9 +255,8 @@ void BTA_AvStart(void)
 *******************************************************************************/
 void BTA_AvEnable_Sink(int enable)
 {
-    BT_HDR  *p_buf;
-
 #if (BTA_AV_SINK_INCLUDED == TRUE)
+    BT_HDR  *p_buf;
     if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
     {
         p_buf->event = BTA_AV_API_SINK_ENABLE_EVT;
index e2978c1..d3776f4 100644 (file)
@@ -23,6 +23,8 @@
  *
  ******************************************************************************/
 
+#include <stddef.h>
+
 #include "bt_target.h"
 #include "gki.h"
 #include "bta_api.h"
index 062ae06..68d99d4 100644 (file)
@@ -102,7 +102,10 @@ extern tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void);
     #endif
 static void bta_dm_observe_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
 static void bta_dm_observe_cmpl_cb (void * p_result);
+
+#if BLE_VND_INCLUDED == TRUE
 static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
+#endif
 
 #ifndef BTA_DM_BLE_ADV_CHNL_MAP
 #define BTA_DM_BLE_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37|BTM_BLE_ADV_CHNL_38|BTM_BLE_ADV_CHNL_39)
@@ -4234,7 +4237,6 @@ static void bta_dm_observe_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir)
 ;
     tBTA_DM_SEARCH     result;
     tBTM_INQ_INFO      *p_inq_info;
-    UINT16             service_class;
     APPL_TRACE_DEBUG("bta_dm_observe_results_cb")
 
     bdcpy(result.inq_res.bd_addr, p_inq->remote_bd_addr);
@@ -4779,7 +4781,6 @@ void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data)
 void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data)
 {
     tBTM_STATUS btm_status = 0;
-    void *p_ref = NULL;
 
     bta_dm_cb.p_multi_adv_cback = p_data->ble_multi_adv_enb.p_cback;
     if(BTM_BleMaxMultiAdvInstanceCount() > 0 && NULL != p_data->ble_multi_adv_enb.p_ref)
@@ -5101,27 +5102,6 @@ static void bta_ble_scan_cfg_cmpl(tBTM_BLE_PF_ACTION action, tBTM_BLE_SCAN_COND_
 
 /*******************************************************************************
 **
-** Function         bta_ble_status_cmpl
-**
-** Description      ADV payload filtering enable / disable complete callback
-**
-**
-** Returns          None
-**
-*******************************************************************************/
-static void bta_ble_status_cmpl(tBTM_BLE_PF_ACTION action, tBTM_BLE_REF_VALUE ref_value,
-                                    tBTM_STATUS status)
-{
-    tBTA_STATUS st = (status == BTM_SUCCESS) ? BTA_SUCCESS: BTA_FAILURE;
-
-    APPL_TRACE_DEBUG("bta_ble_status_cmpl: %d, %d", action, status);
-
-    if(bta_dm_cb.p_scan_filt_status_cback)
-       bta_dm_cb.p_scan_filt_status_cback(action, ref_value, st);
-}
-
-/*******************************************************************************
-**
 ** Function         bta_dm_cfg_filter_cond
 **
 ** Description      This function configure adv payload filtering condition
@@ -5615,6 +5595,7 @@ static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
 
 #endif /* BTA_GATT_INCLUDED */
 
+#if BLE_VND_INCLUDED == TRUE
 /*******************************************************************************
 **
 ** Function         bta_dm_ctrl_features_rd_cmpl_cback
@@ -5638,6 +5619,6 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result)
     }
 
 }
-
+#endif /* BLE_VND_INCLUDED */
 
 #endif  /* BLE_INCLUDED */
index 946d8bf..bffbc4c 100644 (file)
@@ -947,7 +947,6 @@ tBTA_GATTC_CLCB * bta_gattc_find_int_conn_clcb(tBTA_GATTC_DATA *p_msg)
 tBTA_GATTC_CLCB * bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg)
 {
     tBTA_GATTC_CLCB         *p_clcb = NULL;
-    tGATT_DISCONN_REASON    reason = p_msg->int_conn.reason;
 
     bta_gattc_conn_dealloc(p_msg->int_conn.remote_bda);
     if ((p_clcb = bta_gattc_find_clcb_by_conn_id(p_msg->int_conn.hdr.layer_specific)) == NULL)
index 43befe5..bdd7f29 100644 (file)
@@ -152,7 +152,6 @@ void bta_gatts_enable(tBTA_GATTS_CB *p_cb)
 void bta_gatts_api_disable(tBTA_GATTS_CB *p_cb)
 {
     UINT8 i;
-    tBTA_GATT_STATUS    status = BTA_GATT_OK;
 
     if (p_cb->enabled)
     {
index 46f05ff..718f906 100644 (file)
@@ -264,7 +264,6 @@ void bta_hf_client_rfc_open(tBTA_HF_CLIENT_DATA *p_data)
 void bta_hf_client_rfc_acp_open(tBTA_HF_CLIENT_DATA *p_data)
 {
     UINT16          lcid;
-    int             i;
     BD_ADDR         dev_addr;
     int             status;
 
@@ -392,7 +391,6 @@ void bta_hf_client_open_fail(tBTA_HF_CLIENT_DATA *p_data)
 *******************************************************************************/
 void bta_hf_client_rfc_close(tBTA_HF_CLIENT_DATA *p_data)
 {
-    int i, num_active_conn = 0;
     UNUSED(p_data);
 
     /* reinitialize stuff */
index bb65f3e..62d8335 100644 (file)
@@ -59,7 +59,6 @@ static const tBTA_SYS_REG bta_hf_client_reg =
 tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK *p_cback)
 {
     tBTA_HF_CLIENT_API_ENABLE  *p_buf;
-    UINT8       idx;
 
     if (bta_sys_is_register (BTA_ID_HS))
     {
index aaa8d21..829c3a5 100644 (file)
@@ -144,7 +144,6 @@ void bta_hf_client_setup_port(UINT16 handle)
 *******************************************************************************/
 void bta_hf_client_start_server(void)
 {
-    int i;
     int port_status;
 
     if (bta_hf_client_cb.scb.serv_handle > 0)
index a19912c..fd55a6c 100644 (file)
@@ -94,7 +94,6 @@ BOOLEAN bta_hf_client_add_record(char *p_service_name, UINT8 scn,
     UINT16              version;
     UINT16              profile_uuid;
     BOOLEAN             result = TRUE;
-    BOOLEAN             codec_supported = FALSE;
     UINT8               buf[2];
     UINT16              sdp_features = 0;
 
index dd4be4f..fee2cda 100644 (file)
@@ -2409,7 +2409,6 @@ void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY *p_data)
 void bta_hh_le_open_fail(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
 {
     tBTA_HH_CONN            conn_dat ;
-    tBTA_HH_LE_HID_SRVC     *p_hid_srvc = &p_cb->hid_srvc[0];
 
     /* open failure in the middle of service discovery, clear all services */
     if (p_cb->disc_active & BTA_HH_LE_DISC_HIDS)
index 652a5c5..17e1e67 100644 (file)
@@ -22,6 +22,7 @@
  *  subsystem call-in functions.
  *
  ******************************************************************************/
+
 #include <stddef.h>
 #include "bta_api.h"
 #include "btm_api.h"
index 628f423..0a0f326 100644 (file)
@@ -1601,7 +1601,6 @@ void bta_hl_sort_cfg_time_idx(UINT8 app_idx, UINT8 *a, UINT8 n)
 *******************************************************************************/
 void  bta_hl_compact_mdl_cfg_time(UINT8 app_idx, UINT8 mdep_id)
 {
-    tBTA_HL_APP_CB      *p_acb = BTA_HL_GET_APP_CB_PTR(app_idx);
     tBTA_HL_MDL_CFG     *p_mdl;
     UINT8 i, time_min, cnt=0;
     UINT8   s_arr[BTA_HL_NUM_MDL_CFGS];
@@ -1700,8 +1699,6 @@ BOOLEAN  bta_hl_delete_mdl_cfg(UINT8 app_idx, BD_ADDR bd_addr,
     tBTA_HL_MDL_CFG     *p_mdl;
     BOOLEAN             success = FALSE;
     UINT8               i;
-    tBTA_HL_APP_CB      *p_acb= BTA_HL_GET_APP_CB_PTR(app_idx);
-    UINT8               app_id = p_acb->app_id;
 
     for (i = 0; i< BTA_HL_NUM_MDL_CFGS; i++)
     {
index 772f081..e6de6bb 100644 (file)
@@ -74,7 +74,7 @@ typedef UINT8 tBTA_STATUS;
 #define BTA_NAP_SERVICE_ID      15          /* PAN Network access point */
 #define BTA_GN_SERVICE_ID       16          /* PAN Group Ad-hoc networks */
 #define BTA_SAP_SERVICE_ID      17          /* SIM Access profile */
-#define BTA_A2DP_SERVICE_ID     18          /* A2DP Sink */
+#define BTA_A2DP_SINK_SERVICE_ID        18  /* A2DP Sink */
 #define BTA_AVRCP_SERVICE_ID    19          /* A/V remote control */
 #define BTA_HID_SERVICE_ID      20          /* HID */
 #define BTA_VDP_SERVICE_ID      21          /* Video distribution */
@@ -958,20 +958,10 @@ typedef UINT32 tBTA_DM_BLE_REF_VALUE;
 #define BTA_DM_BLE_PF_CONFIG_EVT       BTM_BLE_PF_CONFIG
 typedef UINT8 tBTA_DM_BLE_PF_EVT;
 
-typedef UINT8   tBTA_DM_BLE_PF_COND_TYPE;
-
-#define BTA_DM_BLE_PF_LOGIC_OR              0
-#define BTA_DM_BLE_PF_LOGIC_AND             1
-typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE;
-
 #define BTA_DM_BLE_PF_ENABLE       1
 #define BTA_DM_BLE_PF_CONFIG       2
 typedef UINT8 tBTA_DM_BLE_PF_ACTION;
 
-typedef UINT8 tBTA_DM_BLE_PF_FILT_INDEX;
-
-typedef UINT8 tBTA_DM_BLE_PF_AVBL_SPACE;
-
 /* Config callback */
 typedef void (tBTA_DM_BLE_PF_CFG_CBACK) (tBTA_DM_BLE_PF_ACTION action,
                                          tBTA_DM_BLE_PF_COND_TYPE cfg_cond,
index 46b8f7b..a182672 100644 (file)
@@ -1750,8 +1750,6 @@ static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle)
     tBTA_JV evt_data;
     BD_ADDR rem_bda;
     UINT16 lcid;
-    UINT8  num;
-    UINT32  si;
     APPL_TRACE_DEBUG("bta_jv_port_mgmt_sr_cback, code:%d, port_handle:%d", code, port_handle);
     if (NULL == p_cb || NULL == p_cb->p_cback)
     {
index 5f3902e..03ba91f 100644 (file)
@@ -21,6 +21,7 @@
 #include <assert.h>
 #include <dlfcn.h>
 #include <pthread.h>
+#include <string.h>
 
 #include "osi/include/allocator.h"
 #include "osi/include/hash_map.h"
@@ -66,8 +67,32 @@ void module_management_stop(void) {
   pthread_mutex_destroy(&metadata_lock);
 }
 
+/* TODO: remove these externs and explicit checks once dlsym is fixed */
+extern module_t bt_utils_module;
+extern module_t btif_config_module;
+extern module_t controller_module;
+extern module_t gki_module;
+extern module_t counter_module;
+extern module_t stack_config_module;
+extern module_t btsnoop_module;
+extern module_t hci_module;
+extern module_t bte_logmsg_module;
+
 const module_t *get_module(const char *name) {
-  return (module_t *)dlsym(RTLD_DEFAULT, name);
+  module_t* module = (module_t *)dlsym(RTLD_DEFAULT, name);
+  if (module) return module;
+
+  if (!strcmp(name, "bt_utils_module")) return &bt_utils_module;
+  if (!strcmp(name, "btif_config_module")) return &btif_config_module;
+  if (!strcmp(name, "controller_module")) return &controller_module;
+  if (!strcmp(name, "gki_module")) return &gki_module;
+  if (!strcmp(name, "counter_module")) return &counter_module;
+  if (!strcmp(name, "stack_config_module")) return &stack_config_module;
+  if (!strcmp(name, "btsnoop_module")) return &btsnoop_module;
+  if (!strcmp(name, "hci_module")) return &hci_module;
+  if (!strcmp(name, "bte_logmsg_module")) return &bte_logmsg_module;
+
+  return NULL;
 }
 
 bool module_init(const module_t *module) {
index a477664..1460fca 100644 (file)
@@ -463,7 +463,6 @@ UINT8 bta_av_audio_sink_getconfig(tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
     BOOLEAN supported;
     tBTA_AV_CO_PEER *p_peer;
     tBTA_AV_CO_SINK *p_src;
-    UINT8 codec_cfg[AVDT_CODEC_SIZE];
     UINT8 pref_cfg[AVDT_CODEC_SIZE];
     UINT8 index;
 
index 3ab2255..b0ab2e0 100644 (file)
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <linux/uhid.h>
+#include <unistd.h>
 #include "btif_hh.h"
 #include "bta_api.h"
 #include "bta_hh_api.h"
index 7070f1a..50e0d8c 100644 (file)
@@ -158,7 +158,6 @@ void bta_pan_co_close(UINT16 handle, UINT8 app_id)
 void bta_pan_co_tx_path(UINT16 handle, UINT8 app_id)
 {
     BT_HDR          *p_buf;
-    UINT8           i;
     BD_ADDR            src;
     BD_ADDR            dst;
     UINT16            protocol;
index ff29b19..5bec945 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <hardware/bluetooth.h>
 #include <system/audio.h>
+#include <string.h>
 #include "hardware/bt_av.h"
 
 #define LOG_TAG "bt_btif_av"
@@ -894,9 +895,13 @@ bt_status_t btif_av_init()
             return BT_STATUS_FAIL;
 
         btif_enable_service(BTA_A2DP_SOURCE_SERVICE_ID);
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+        btif_enable_service(BTA_A2DP_SINK_SERVICE_ID);
+#endif
 
         /* Also initialize the AV state machine */
-        btif_av_cb.sm_handle = btif_sm_init((const btif_sm_handler_t*)btif_av_state_handlers, BTIF_AV_STATE_IDLE);
+        btif_av_cb.sm_handle =
+                btif_sm_init((const btif_sm_handler_t*)btif_av_state_handlers, BTIF_AV_STATE_IDLE);
 
         btif_a2dp_on_init();
 
@@ -961,7 +966,6 @@ static bt_status_t init_sink(btav_callbacks_t* callbacks)
 
     if (status == BT_STATUS_SUCCESS) {
         bt_av_sink_callbacks = callbacks;
-        BTA_AvEnable_Sink(TRUE);
     }
 
     return status;
@@ -1040,7 +1044,10 @@ static void cleanup(void)
 
     btif_a2dp_stop_media_task();
 
-    btif_disable_service(BTA_A2DP_SERVICE_ID);
+    btif_disable_service(BTA_A2DP_SOURCE_SERVICE_ID);
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+    btif_disable_service(BTA_A2DP_SINK_SERVICE_ID);
+#endif
 
     /* Also shut down the AV state machine */
     btif_sm_shutdown(btif_av_cb.sm_handle);
@@ -1217,6 +1224,23 @@ bt_status_t btif_av_execute_service(BOOLEAN b_enable)
 
 /*******************************************************************************
 **
+** Function         btif_av_sink_execute_service
+**
+** Description      Initializes/Shuts down the service
+**
+** Returns          BT_STATUS_SUCCESS on success, BT_STATUS_FAIL otherwise
+**
+*******************************************************************************/
+bt_status_t btif_av_sink_execute_service(BOOLEAN b_enable)
+{
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+    BTA_AvEnable_Sink(b_enable);
+#endif
+    return BT_STATUS_SUCCESS;
+}
+
+/*******************************************************************************
+**
 ** Function         btif_av_get_src_interface
 **
 ** Description      Get the AV callback interface for A2DP source profile
index 1049673..99d7ad4 100644 (file)
@@ -804,8 +804,6 @@ static bt_status_t btif_in_get_remote_device_properties(bt_bdaddr_t *bd_addr)
 
 static void execute_storage_request(UINT16 event, char *p_param)
 {
-    uint8_t is_local;
-    int num_entries = 0;
     bt_status_t status = BT_STATUS_SUCCESS;
 
     BTIF_TRACE_EVENT("execute storage request event : %d", event);
@@ -1115,7 +1113,6 @@ bt_status_t btif_set_adapter_property(const bt_property_t *property)
 
     if (storage_req_id != BTIF_CORE_STORAGE_NO_ACTION)
     {
-        int btif_status;
         /* pass on to storage for updating local database */
 
         memset(&(req.write_req.bd_addr), 0, sizeof(bt_bdaddr_t));
index 54bcca8..aed6329 100644 (file)
@@ -243,6 +243,7 @@ static char* btif_get_default_local_name();
 extern UINT16 bta_service_id_to_uuid_lkup_tbl [BTA_MAX_SERVICE_ID];
 extern bt_status_t btif_hf_execute_service(BOOLEAN b_enable);
 extern bt_status_t btif_av_execute_service(BOOLEAN b_enable);
+extern bt_status_t btif_av_sink_execute_service(BOOLEAN b_enable);
 extern bt_status_t btif_hh_execute_service(BOOLEAN b_enable);
 extern bt_status_t btif_hf_client_execute_service(BOOLEAN b_enable);
 extern bt_status_t btif_sdp_execute_service(BOOLEAN b_enable);
@@ -270,6 +271,10 @@ bt_status_t btif_in_execute_service_request(tBTA_SERVICE_ID service_id,
          {
               btif_av_execute_service(b_enable);
          }break;
+         case BTA_A2DP_SINK_SERVICE_ID:
+         {
+            btif_av_sink_execute_service(b_enable);
+         }break;
          case BTA_HID_SERVICE_ID:
          {
               btif_hh_execute_service(b_enable);
@@ -442,13 +447,11 @@ BOOLEAN check_hid_le(const bt_bdaddr_t *remote_bdaddr)
 *******************************************************************************/
 BOOLEAN check_sdp_bl(const bt_bdaddr_t *remote_bdaddr)
 {
-    UINT8 i = 0;
     UINT16 manufacturer = 0;
     UINT8 lmp_ver = 0;
     UINT16 lmp_subver = 0;
     bt_property_t prop_name;
     bt_remote_version_t info;
-    bt_status_t status;
 
 
     if (remote_bdaddr == NULL)
@@ -698,7 +701,6 @@ static void btif_dm_cb_create_bond(bt_bdaddr_t *bd_addr, tBTA_TRANSPORT transpor
 *******************************************************************************/
 void btif_dm_cb_remove_bond(bt_bdaddr_t *bd_addr)
 {
-     bdstr_t bdstr;
      /*special handling for HID devices */
      /*  VUP needs to be sent if its a HID Device. The HID HOST module will check if there
      is a valid hid connection with this bd_addr. If yes VUP will be issued.*/
@@ -1234,11 +1236,9 @@ static void btif_dm_search_devices_evt (UINT16 event, char *p_param)
         {
             /* inquiry result */
             UINT32 cod;
-            UINT8 *p_eir_remote_name = NULL;
             bt_bdname_t bdname;
             bt_bdaddr_t bdaddr;
             UINT8 remote_name_len;
-            UINT8 *p_cached_name = NULL;
             tBTA_SERVICE_MASK services = 0;
             bdstr_t bdstr;
 
@@ -1392,9 +1392,8 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
     {
         case BTA_DM_DISC_RES_EVT:
         {
-            bt_uuid_t uuid_arr[BT_MAX_NUM_UUIDS]; /* Max 32 services */
             bt_property_t prop;
-            uint32_t i = 0,  j = 0;
+            uint32_t i = 0;
             bt_bdaddr_t bd_addr;
             bt_status_t ret;
 
@@ -1528,7 +1527,6 @@ static void btif_dm_remote_service_record_evt(UINT16 event, char *p_param)
         {
             bt_service_record_t rec;
             bt_property_t prop;
-            uint32_t i = 0;
             bt_bdaddr_t bd_addr;
 
             memset(&rec, 0, sizeof(bt_service_record_t));
@@ -1571,7 +1569,6 @@ static void btif_dm_remote_service_record_evt(UINT16 event, char *p_param)
 *******************************************************************************/
 static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
 {
-    tBTA_DM_SEC_EVT dm_event = (tBTA_DM_SEC_EVT)event;
     tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param;
     tBTA_SERVICE_MASK service_mask;
     uint32_t i;
@@ -2552,8 +2549,6 @@ bt_status_t btif_dm_ssp_reply(const bt_bdaddr_t *bd_addr,
 *******************************************************************************/
 bt_status_t btif_dm_get_adapter_property(bt_property_t *prop)
 {
-    bt_status_t status;
-
     BTIF_TRACE_EVENT("%s: type=0x%x", __FUNCTION__, prop->type);
     switch (prop->type)
     {
@@ -2934,8 +2929,6 @@ static void btif_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
 
 void    btif_dm_load_ble_local_keys(void)
 {
-    bt_status_t bt_status;
-
     memset(&ble_local_key_cb, 0, sizeof(btif_dm_local_key_cb_t));
 
     if (btif_storage_get_ble_local_key(BTIF_DM_LE_LOCAL_KEY_ER,(char*)&ble_local_key_cb.er[0],
index 3674edc..df766c1 100644 (file)
@@ -336,7 +336,6 @@ static void btif_gattc_init_dev_cb(void)
 
 static void btif_gattc_add_remote_bdaddr (BD_ADDR p_bda, uint8_t addr_type)
 {
-    BOOLEAN found=FALSE;
     uint8_t i;
     for (i = 0; i < BTIF_GATT_MAX_OBSERVED_DEV; i++)
     {
index ed564ff..4837474 100644 (file)
@@ -254,7 +254,6 @@ void btif_gattc_adv_data_packager(int client_if, bool set_scan_rsp,
 
 BOOLEAN btif_gattc_copy_datacb(int cbindex, btif_adv_data_t *p_adv_data, BOOLEAN bInstData)
 {
-    int i=0;
     btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
     if (NULL == p_multi_adv_data_cb || cbindex < 0)
        return false;
index 932592c..da3d712 100644 (file)
@@ -237,7 +237,6 @@ uint16_t get_uuid16(tBT_UUID *p_uuid)
 
 uint16_t set_read_value(btgatt_read_params_t *p_dest, tBTA_GATTC_READ *p_src)
 {
-    int i = 0;
     uint16_t descr_type = 0;
     uint16_t len = 0;
 
index dc1703d..f8c118b 100644 (file)
@@ -353,7 +353,7 @@ static bt_status_t btif_hf_check_if_slc_connected()
         int i;
         for (i = 0; i < btif_max_hf_clients; i++)
         {
-            if ((btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED))
+            if (btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED)
             {
                 BTIF_TRACE_EVENT("BTHF: %s: slc connected for idx = %d",
                                          __FUNCTION__, i);
@@ -389,7 +389,6 @@ static void btif_hf_upstreams_evt(UINT16 event, char* p_param)
 {
     tBTA_AG *p_data = (tBTA_AG *)p_param;
     bdstr_t bdstr;
-    bt_bdaddr_t addr;
     int idx = p_data->hdr.handle - 1;
 
     BTIF_TRACE_DEBUG("%s: event=%s", __FUNCTION__, dump_hf_event(event));
index e0a0b8d..ee78a8a 100644 (file)
@@ -138,7 +138,7 @@ static void btif_in_hf_client_generic_evt(UINT16 event, char *p_param)
     switch (event) {
         case BTIF_HF_CLIENT_CB_AUDIO_CONNECTING:
         {
-            HAL_CBACK(bt_hf_client_callbacks, audio_state_cb, BTHF_AUDIO_STATE_CONNECTING,
+            HAL_CBACK(bt_hf_client_callbacks, audio_state_cb, (bthf_client_audio_state_t)BTHF_AUDIO_STATE_CONNECTING,
                       &btif_hf_client_cb.connected_bda);
         } break;
         default:
@@ -368,8 +368,6 @@ static bt_status_t stop_voice_recognition()
 *******************************************************************************/
 static bt_status_t volume_control(bthf_client_volume_type_t type, int volume)
 {
-    BOOLEAN speaker;
-
     CHECK_BTHF_CLIENT_SLC_CONNECTED();
 
     switch (type)
index 20c8e3c..997f523 100644 (file)
@@ -67,7 +67,6 @@
 
 extern const int BT_UID;
 extern const int BT_GID;
-static int btif_hh_prev_keyevents=0; //The previous key events
 static int btif_hh_keylockstates=0; //The current key state of each key
 
 #define BTIF_HH_ID_1        0
@@ -623,7 +622,6 @@ bt_status_t btif_hh_connect(bt_bdaddr_t *bd_addr)
     char bda_str[20];
     int i;
     BD_ADDR *bda = (BD_ADDR*)bd_addr;
-    tBTA_HH_CONN conn;
     CHECK_BTHH_INIT();
     dev = btif_hh_find_dev_by_bda(bd_addr);
     BTIF_TRACE_DEBUG("Connect _hh");
@@ -687,7 +685,6 @@ bt_status_t btif_hh_connect(bt_bdaddr_t *bd_addr)
 
 void btif_hh_disconnect(bt_bdaddr_t *bd_addr)
 {
-    BD_ADDR *bda = (BD_ADDR*)bd_addr;
     btif_hh_device_t *p_dev;
     p_dev = btif_hh_find_connected_dev_by_bda(bd_addr);
     if (p_dev != NULL)
@@ -741,7 +738,6 @@ void btif_hh_setreport(btif_hh_device_t *p_dev, bthh_report_type_t r_type, UINT1
 static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
 {
     tBTA_HH *p_data = (tBTA_HH *)p_param;
-    bdstr_t bdstr;
     btif_hh_device_t *p_dev = NULL;
     int i;
     int len, tmplen;
@@ -1182,7 +1178,7 @@ static void btif_hh_handle_evt(UINT16 event, char *p_param)
 void btif_hh_tmr_hdlr(TIMER_LIST_ENT *tle)
 {
     btif_hh_device_t *p_dev;
-    UINT8               i,j;
+    UINT8               i;
     tBTA_HH_EVT event;
     tBTA_HH p_data;
     int param_len = 0;
index d11ba25..9d0c0d7 100644 (file)
@@ -916,7 +916,7 @@ BOOLEAN btif_hl_cch_open(UINT8 app_id, BD_ADDR bd_addr, UINT16 ctrl_psm,
     btif_hl_app_cb_t            *p_acb;
     btif_hl_mcl_cb_t            *p_mcb;
     btif_hl_pending_chan_cb_t   *p_pcb;
-    UINT8                       app_idx, mcl_idx, chan_idx;
+    UINT8                       app_idx, mcl_idx;
     BOOLEAN                     status = TRUE;
 
     BTIF_TRACE_DEBUG("%s app_id=%d ctrl_psm=%d mdep_cfg_idx=%d op=%d",
@@ -1295,7 +1295,6 @@ static  BOOLEAN btif_hl_find_mdep_cfg_idx(UINT8 app_idx,  tBTA_HL_MDEP_ID local_
 BOOLEAN btif_hl_find_mcl_idx(UINT8 app_idx, BD_ADDR p_bd_addr, UINT8 *p_mcl_idx){
     BOOLEAN found=FALSE;
     UINT8 i;
-    btif_hl_app_cb_t  *p_acb =BTIF_HL_GET_APP_CB_PTR(app_idx);
     btif_hl_mcl_cb_t  *p_mcb;
 
     *p_mcl_idx = 0;
@@ -1867,7 +1866,6 @@ BOOLEAN btif_hl_find_app_idx_using_deleted_mdl_id( UINT8 mdl_id,
 *******************************************************************************/
 static void btif_hl_stop_timer_using_handle( tBTA_HL_MCL_HANDLE mcl_handle){
     btif_hl_app_cb_t  *p_acb;
-    BOOLEAN         found=FALSE;
     UINT8 i,j;
 
     for (i=0; i<BTA_HL_NUM_APPS; i++)
@@ -1897,7 +1895,7 @@ BOOLEAN btif_hl_find_mcl_idx_using_app_idx( tBTA_HL_MCL_HANDLE mcl_handle,
                                            UINT8 p_app_idx, UINT8 *p_mcl_idx){
     btif_hl_app_cb_t  *p_acb;
     BOOLEAN         found=FALSE;
-    UINT8 i,j;
+    UINT8 j;
 
     p_acb =BTIF_HL_GET_APP_CB_PTR(p_app_idx);
     for (j=0; j < BTA_HL_NUM_MCLS ; j++)
@@ -1928,7 +1926,7 @@ void btif_hl_clean_mdls_using_app_idx( UINT8 app_idx){
     btif_hl_app_cb_t  *p_acb;
     btif_hl_mcl_cb_t  *p_mcb;
     btif_hl_mdl_cb_t  *p_dcb;
-    UINT8 i,j,x,y;
+    UINT8 j,x,y;
     bt_bdaddr_t     bd_addr;
 
         p_acb =BTIF_HL_GET_APP_CB_PTR(app_idx);
@@ -2121,7 +2119,6 @@ static void btif_hl_proc_dereg_cfm(tBTA_HL *p_data)
     UINT8                   app_idx;
     int                     app_id = 0;
     bthl_app_reg_state_t    state = BTHL_APP_REG_STATE_DEREG_SUCCESS;
-    bt_status_t             status            = BT_STATUS_SUCCESS;
 
     BTIF_TRACE_DEBUG("%s de-reg status=%d app_handle=%d", __FUNCTION__,
                 p_data->dereg_cfm.status, p_data->dereg_cfm.app_handle);
@@ -2161,7 +2158,6 @@ static void btif_hl_proc_reg_cfm(tBTA_HL *p_data){
     btif_hl_app_cb_t       *p_acb;
     UINT8                  app_idx;
     bthl_app_reg_state_t   state = BTHL_APP_REG_STATE_REG_SUCCESS;
-    bt_status_t            bt_status;
 
     BTIF_TRACE_DEBUG("%s reg status=%d app_handle=%d", __FUNCTION__, p_data->reg_cfm.status, p_data->reg_cfm.app_handle);
 
@@ -2465,7 +2461,7 @@ static void btif_hl_proc_cch_open_ind(tBTA_HL *p_data)
 
 {
     btif_hl_mcl_cb_t         *p_mcb;
-    UINT8                   app_idx, mcl_idx;
+    UINT8                   mcl_idx;
     int                     i;
 
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -2588,7 +2584,6 @@ static BOOLEAN btif_hl_proc_cch_open_cfm(tBTA_HL *p_data)
     btif_hl_mcl_cb_t         *p_mcb;
     UINT8                    app_idx, mcl_idx;
     BOOLEAN                  status = FALSE;
-    tBTA_HL_DCH_OPEN_PARAM   dch_open;
 
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
 
@@ -2657,7 +2652,6 @@ static void btif_hl_clean_mcb_using_handle( tBTA_HL_MCL_HANDLE mcl_handle){
 static void btif_hl_proc_cch_close_ind(tBTA_HL *p_data)
 
 {
-    UINT8                   app_idx, mcl_idx;
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
 
     btif_hl_clean_mcb_using_handle(p_data->cch_close_ind.mcl_handle);
@@ -2675,7 +2669,6 @@ static void btif_hl_proc_cch_close_ind(tBTA_HL *p_data)
 *******************************************************************************/
 static void btif_hl_proc_cch_close_cfm(tBTA_HL *p_data)
 {
-    UINT8                   app_idx, mcl_idx;
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
 
     btif_hl_clean_mcb_using_handle(p_data->cch_close_ind.mcl_handle);
@@ -2694,7 +2687,7 @@ static void btif_hl_proc_create_ind(tBTA_HL *p_data){
     btif_hl_app_cb_t         *p_acb;
     btif_hl_mcl_cb_t         *p_mcb;
     tBTA_HL_MDEP            *p_mdep;
-    UINT8                   app_idx, orig_app_idx, mcl_idx, mdep_cfg_idx;
+    UINT8                   orig_app_idx, mcl_idx, mdep_cfg_idx;
     BOOLEAN                 first_reliable_exist;
     BOOLEAN                 success = TRUE;
     tBTA_HL_DCH_CFG         rsp_cfg = BTA_HL_DCH_CFG_UNKNOWN;
@@ -2777,7 +2770,6 @@ static void btif_hl_proc_dch_open_ind(tBTA_HL *p_data)
 {
     btif_hl_mdl_cb_t         *p_dcb;
     UINT8                    orig_app_idx, mcl_idx, mdl_idx, mdep_cfg_idx;
-    UINT8                    dc_cfg;
     BOOLEAN close_dch = FALSE;
 
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -3006,7 +2998,7 @@ static void btif_hl_proc_dch_reconnect_ind(tBTA_HL *p_data)
 {
     btif_hl_app_cb_t        *p_acb;
     btif_hl_mdl_cb_t        *p_dcb;
-    UINT8                   app_idx, mcl_idx, mdl_idx, mdep_cfg_idx, dc_cfg;
+    UINT8                   app_idx, mcl_idx, mdl_idx, mdep_cfg_idx;
     BOOLEAN                 close_dch = FALSE;
 
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -3139,7 +3131,6 @@ static void btif_hl_proc_dch_close_cfm(tBTA_HL *p_data)
 *******************************************************************************/
 static void btif_hl_proc_abort_ind(tBTA_HL_MCL_HANDLE mcl_handle){
 
-    UINT8                   app_idx,mcl_idx;
     BTIF_TRACE_DEBUG("%s", __FUNCTION__ );
     btif_hl_app_cb_t  *p_acb;
     UINT8 i,j;
@@ -3172,8 +3163,6 @@ static void btif_hl_proc_abort_ind(tBTA_HL_MCL_HANDLE mcl_handle){
 **
 *******************************************************************************/
 static void btif_hl_proc_abort_cfm(tBTA_HL_MCL_HANDLE mcl_handle){
-    UINT8                   app_idx,mcl_idx;
-
     BTIF_TRACE_DEBUG("%s", __FUNCTION__ );
     btif_hl_app_cb_t  *p_acb;
     UINT8 i,j;
@@ -3260,9 +3249,6 @@ static void btif_hl_proc_dch_cong_ind(tBTA_HL *p_data)
 static void btif_hl_proc_reg_request(UINT8 app_idx, UINT8  app_id,
                                      tBTA_HL_REG_PARAM *p_reg_param,
                                      tBTA_HL_CBACK *p_cback){
-    bt_status_t status= BT_STATUS_SUCCESS;
-    UINT8 i;
-    btif_hl_app_data_t *p_data;
     UNUSED(p_cback);
 
     BTIF_TRACE_DEBUG("%s app_idx=%d app_id=%d", __FUNCTION__, app_idx, app_id);
@@ -3383,7 +3369,6 @@ static void btif_hl_upstreams_evt(UINT16 event, char* p_param){
     UINT8                 app_idx, mcl_idx;
     btif_hl_app_cb_t      *p_acb;
     btif_hl_mcl_cb_t      *p_mcb = NULL;
-    BD_ADDR               bd_addr;
     btif_hl_pend_dch_op_t  pending_op;
     BOOLEAN status;
 
@@ -4076,11 +4061,10 @@ static bt_status_t connect_channel(int app_id, bt_bdaddr_t *bd_addr, int mdep_cf
 **
 *******************************************************************************/
 static bt_status_t destroy_channel(int channel_id){
-    UINT8 app_idx, mcl_idx, mdl_idx, mdl_cfg_idx, app_id, mdep_cfg_idx = 0;
+    UINT8 app_idx, mcl_idx, mdl_cfg_idx, mdep_cfg_idx = 0;
     bt_status_t status = BT_STATUS_SUCCESS;
     btif_hl_mdl_cfg_t     *p_mdl;
     btif_hl_mcl_cb_t     *p_mcb;
-    btif_hl_mdl_cb_t     *p_dcb;
     btif_hl_app_cb_t     *p_acb;
 
     CHECK_BTHL_INIT();
@@ -4208,7 +4192,7 @@ static bt_status_t register_application(bthl_reg_param_t *p_reg_param, int *app_
     tBTA_HL_SUP_FEATURE         *p_sup;
     tBTA_HL_MDEP_CFG            *p_cfg;
     tBTA_HL_MDEP_DATA_TYPE_CFG  *p_data;
-    UINT8                       app_idx=0, i=0, pending_reg_idx=0;
+    UINT8                       app_idx=0, i=0;
     bthl_mdep_cfg_t             *p_mdep_cfg;
     bt_status_t                 status = BT_STATUS_SUCCESS;
     btif_hl_evt_cb_t            evt_param;
@@ -4338,7 +4322,7 @@ BOOLEAN  btif_hl_save_mdl_cfg(UINT8 mdep_id, UINT8 item_idx,
     BOOLEAN             success = FALSE;
     btif_hl_app_cb_t    *p_acb;
     btif_hl_mcl_cb_t    *p_mcb;
-    UINT8               app_idx, mcl_idx, mdl_idx, len;
+    UINT8               app_idx, mcl_idx, len;
     bt_status_t         bt_status;
     btif_hl_evt_cb_t    evt_param;
     int                 *p_channel_id;
@@ -4561,7 +4545,6 @@ void btif_hl_set_socket_state(btif_hl_soc_cb_t *p_scb, btif_hl_soc_state_t new_s
 **
 *******************************************************************************/
 void btif_hl_release_mcl_sockets(UINT8 app_idx, UINT8 mcl_idx){
-    btif_hl_soc_cb_t    *p_scb = NULL;
     UINT8               i;
     btif_hl_mdl_cb_t    *p_dcb;
     BOOLEAN             found= FALSE;
@@ -4617,7 +4600,6 @@ BOOLEAN btif_hl_create_socket(UINT8 app_idx, UINT8 mcl_idx, UINT8 mdl_idx){
     btif_hl_mcl_cb_t      *p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx);
     btif_hl_mdl_cb_t      *p_dcb = BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx);
     btif_hl_soc_cb_t      *p_scb = NULL;
-    UINT8                 soc_idx;
     BOOLEAN               status = FALSE;
 
     BTIF_TRACE_DEBUG("%s", __FUNCTION__);
index d1dac72..89ecddc 100644 (file)
@@ -924,7 +924,6 @@ void btif_reset_decoder(UINT8 *p_av)
 
 BOOLEAN btif_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start)
 {
-    tBTIF_STATUS status;
     BOOLEAN ack = FALSE;
 
     APPL_TRACE_EVENT("## ON A2DP STARTED ##");
@@ -978,8 +977,6 @@ BOOLEAN btif_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start)
 
 void btif_a2dp_ack_fail(void)
 {
-    tBTIF_STATUS status;
-
     APPL_TRACE_EVENT("## A2DP_CTRL_ACK_FAILURE ##");
     a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
 }
@@ -1089,7 +1086,7 @@ static void btif_media_task_avk_handle_timer(UNUSED_ATTR void *context)
     int num_sbc_frames;
     int num_frames_to_process;
 
-    count = btif_media_cb.RxSbcQ.count;
+    count = btif_media_cb.RxSbcQ._count;
     if (0 == count)
     {
         APPL_TRACE_DEBUG("  QUE  EMPTY ");
@@ -1113,7 +1110,7 @@ static void btif_media_task_avk_handle_timer(UNUSED_ATTR void *context)
             num_sbc_frames  = p_msg->num_frames_to_be_processed; /* num of frames in Que Packets */
             APPL_TRACE_DEBUG(" Frames left in topmost packet %d", num_sbc_frames);
             APPL_TRACE_DEBUG(" Remaining frames to process in tick %d", num_frames_to_process);
-            APPL_TRACE_DEBUG(" Num of Packets in Que %d", btif_media_cb.RxSbcQ.count);
+            APPL_TRACE_DEBUG(" Num of Packets in Que %d", btif_media_cb.RxSbcQ._count);
 
             if ( num_sbc_frames > num_frames_to_process) /*  Que Packet has more frames*/
             {
index 79b1fc7..8019636 100644 (file)
@@ -27,6 +27,7 @@
 #include <hardware/bluetooth.h>
 #include <hardware/bt_pan.h>
 #include <assert.h>
+#include <string.h>
 #include <signal.h>
 #include <ctype.h>
 #include <sys/select.h>
@@ -220,10 +221,9 @@ static tBTA_PAN_ROLE_INFO bta_pan_nap_info = {PAN_NAP_SERVICE_NAME, 1, PAN_SECUR
 
 static bt_status_t btpan_enable(int local_role)
 {
-    int bta_pan_role;
-    BTIF_TRACE_DEBUG("local_role:%d", local_role);
-    bta_pan_role = btpan_role_to_bta(local_role);
 #if BTA_PAN_INCLUDED == TRUE
+    BTIF_TRACE_DEBUG("%s - local_role: %d", __func__, local_role);
+    int bta_pan_role = btpan_role_to_bta(local_role);
     BTA_PanSetRole(bta_pan_role, &bta_panu_info, NULL, &bta_pan_nap_info);
     btpan_dev_local_role = local_role;
     return BT_STATUS_SUCCESS;
index 9fbd71a..86025ef 100644 (file)
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <string.h>
 #include <hardware/bluetooth.h>
+#include <string.h>
 
 #define LOG_TAG "bt_btif_queue"
 #include "btif_common.h"
index b8b02ae..07e0c2c 100644 (file)
@@ -173,11 +173,6 @@ static const struct {
  * For now, only the rc_white_addr_prefix is used in the code while
  * rc_black_addr_prefix is kept here for future long term solution.
  */
-static const UINT8 rc_black_addr_prefix[][3] = {
-    {0x0, 0x18, 0x6B}, // LG HBS-730
-    {0x0, 0x26, 0x7E}  // VW Passat
-};
-
 static const UINT8 rc_white_addr_prefix[][3] = {
     {0x94, 0xCE, 0x2C}, // Sony SBH50
     {0x30, 0x17, 0xC8} // Sony wm600
@@ -274,7 +269,7 @@ int uinput_driver_check()
 int uinput_create(char *name)
 {
     struct uinput_dev dev;
-    int fd, err, x = 0;
+    int fd, x = 0;
 
     for(x=0; x < MAX_UINPUT_PATHS; x++)
     {
@@ -422,8 +417,6 @@ void handle_rc_connect (tBTA_AV_RC_OPEN *p_rc_open)
 {
     BTIF_TRACE_DEBUG("%s: rc_handle: %d", __FUNCTION__, p_rc_open->rc_handle);
     bt_status_t result = BT_STATUS_SUCCESS;
-    int i;
-    char bd_str[18];
 #if (AVRC_CTLR_INCLUDED == TRUE)
     bt_bdaddr_t rc_addr;
 #endif
@@ -915,7 +908,6 @@ static void send_metamsg_rsp (UINT8 rc_handle, UINT8 label, tBTA_AV_CODE code,
     tAVRC_RESPONSE *pmetamsg_resp)
 {
     UINT8 ctype;
-    tAVRC_STS status;
 
     if (!pmetamsg_resp)
     {
@@ -1089,9 +1081,33 @@ static void btif_rc_upstreams_evt(UINT16 event, tAVRC_COMMAND *pavrc_cmd, UINT8
             }
             else
             {
-                num_attr = pavrc_cmd->get_elem_attrs.num_attr;
-                memcpy(element_attrs, pavrc_cmd->get_elem_attrs.attrs, sizeof(UINT32)
-                    *pavrc_cmd->get_elem_attrs.num_attr);
+                int attr_cnt, filled_attr_count;
+
+                num_attr = 0;
+                /* Attribute IDs from 1 to AVRC_MAX_NUM_MEDIA_ATTR_ID are only valid,
+                 * hence HAL definition limits the attributes to AVRC_MAX_NUM_MEDIA_ATTR_ID.
+                 * Fill only valid entries.
+                 */
+                for (attr_cnt = 0; (attr_cnt < pavrc_cmd->get_elem_attrs.num_attr) &&
+                    (num_attr < AVRC_MAX_NUM_MEDIA_ATTR_ID); attr_cnt++)
+                {
+                    if ((pavrc_cmd->get_elem_attrs.attrs[attr_cnt] > 0) &&
+                        (pavrc_cmd->get_elem_attrs.attrs[attr_cnt] <= AVRC_MAX_NUM_MEDIA_ATTR_ID))
+                    {
+                        /* Skip the duplicate entries : PTS sends duplicate entries for Fragment cases
+                         */
+                        for (filled_attr_count = 0; filled_attr_count < num_attr; filled_attr_count++)
+                        {
+                            if (element_attrs[filled_attr_count] == pavrc_cmd->get_elem_attrs.attrs[attr_cnt])
+                                break;
+                        }
+                        if (filled_attr_count == num_attr)
+                        {
+                            element_attrs[num_attr] = pavrc_cmd->get_elem_attrs.attrs[attr_cnt];
+                            num_attr++;
+                        }
+                    }
+                }
             }
             FILL_PDU_QUEUE(IDX_GET_ELEMENT_ATTR_RSP, ctype, label, TRUE);
             HAL_CBACK(bt_rc_callbacks, get_element_attr_cb, num_attr, element_attrs);
@@ -1251,7 +1267,6 @@ static bt_status_t get_play_status_rsp(btrc_play_status_t play_status, uint32_t
     uint32_t song_pos)
 {
     tAVRC_RESPONSE avrc_rsp;
-    UINT32 i;
     CHECK_RC_CONNECTED
     memset(&(avrc_rsp.get_play_status), 0, sizeof(tAVRC_GET_PLAY_STATUS_RSP));
     avrc_rsp.get_play_status.song_len = song_len;
@@ -1280,7 +1295,6 @@ static bt_status_t get_element_attr_rsp(uint8_t num_attr, btrc_element_attr_val_
 {
     tAVRC_RESPONSE avrc_rsp;
     UINT32 i;
-    uint8_t j;
     tAVRC_ATTR_ENTRY element_attrs[BTRC_MAX_ELEM_ATTR_SIZE];
     CHECK_RC_CONNECTED
     memset(element_attrs, 0, sizeof(tAVRC_ATTR_ENTRY) * num_attr);
@@ -1449,8 +1463,6 @@ static void register_volumechange (UINT8 lbl)
     tAVRC_COMMAND avrc_cmd = {0};
     BT_HDR *p_msg = NULL;
     tAVRC_STS BldResp=AVRC_STS_BAD_CMD;
-    UINT16 rv = 0;
-    bt_status_t tran_status;
     rc_transaction_t *p_transaction=NULL;
 
     BTIF_TRACE_DEBUG("%s called with label:%d",__FUNCTION__,lbl);
@@ -1612,7 +1624,6 @@ static bt_status_t send_passthrough_cmd(bt_bdaddr_t *bd_addr, uint8_t key_code,
                                                     key_code, key_state);
     if (btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG)
     {
-        tAVRC_MSG_PASS avrc_cmd;
         bt_status_t tran_status = get_transaction(&p_transaction);
         if(BT_STATUS_SUCCESS == tran_status && NULL != p_transaction)
         {
index 01326ab..b53bd7e 100644 (file)
@@ -90,11 +90,7 @@ typedef struct {
 static rfc_slot_t rfc_slots[MAX_RFC_CHANNEL];
 static uint32_t rfc_slot_id;
 static volatile int pth = -1; // poll thread handle
-#if __GLIBC__
 static pthread_mutex_t slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
-#endif
 
 static rfc_slot_t *find_free_slot(void);
 static void cleanup_rfc_slot(rfc_slot_t *rs);
index 375a3d3..61ea160 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdint.h>
 #include <stdbool.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <errno.h>
index 18d5fa0..459aeba 100644 (file)
@@ -109,11 +109,7 @@ static inline void close_cmd_fd(int h);
 
 static inline void add_poll(int h, int fd, int type, int flags, uint32_t user_id);
 
-#if __GLIBC__
 static pthread_mutex_t thread_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t thread_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
-#endif
 
 static inline void set_socket_blocking(int s, int blocking)
 {
@@ -244,7 +240,6 @@ int btsock_thread_init()
 }
 int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback)
 {
-    int ret = FALSE;
     asrt(callback || cmd_callback);
     pthread_mutex_lock(&thread_slot_lock);
     int h = alloc_thread_slot();
index 63508a9..bb640f0 100644 (file)
@@ -435,7 +435,6 @@ static int cfg2prop(bt_bdaddr_t *remote_bd_addr, bt_property_t *prop)
 static bt_status_t btif_in_fetch_bonded_device(const char *bdstr)
 {
     BOOLEAN bt_linkkey_file_found=FALSE;
-    int device_type;
 
         LINK_KEY link_key;
         size_t size = sizeof(link_key);
@@ -575,7 +574,6 @@ bt_status_t btif_storage_get_adapter_property(bt_property_t *property)
     /* Special handling for adapter BD_ADDR and BONDED_DEVICES */
     if (property->type == BT_PROPERTY_BDADDR)
     {
-        BD_ADDR addr;
         bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)property->val;
         /* This has been cached in btif. Just fetch it from there */
         memcpy(bd_addr, &btif_local_bd_addr, sizeof(bt_bdaddr_t));
@@ -819,7 +817,6 @@ bt_status_t btif_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr)
 *******************************************************************************/
 bt_status_t btif_storage_load_bonded_devices(void)
 {
-    char *fname;
     btif_bonded_devices_t bonded_devices;
     uint32_t i = 0;
     bt_property_t adapter_props[6];
@@ -1430,7 +1427,6 @@ bt_status_t btif_storage_load_bonded_hid_info(void)
 {
     bt_bdaddr_t bd_addr;
     tBTA_HH_DEV_DSCP_INFO dscp_info;
-    uint32_t i;
     uint16_t attr_mask;
     uint8_t  sub_class;
     uint8_t  app_id;
@@ -1516,8 +1512,6 @@ bt_status_t btif_storage_load_bonded_hid_info(void)
 *******************************************************************************/
 bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr)
 {
-    char *fname;
-    int ret;
     bdstr_t bdstr;
     bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
 
@@ -1641,10 +1635,8 @@ bt_status_t btif_storage_load_autopair_device_list() {
 BOOLEAN  btif_storage_is_device_autopair_blacklisted(bt_bdaddr_t *remote_bd_addr)
 {
     char *token;
-    int ret;
     bdstr_t bdstr;
     char *dev_name_str;
-    uint8_t i = 0;
     char value[BTIF_STORAGE_MAX_LINE_SZ];
     int value_size = sizeof(value);
 
@@ -1746,10 +1738,7 @@ bt_status_t btif_storage_add_device_to_autopair_blacklist(bt_bdaddr_t *remote_bd
 *******************************************************************************/
 BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr)
 {
-    int ret;
     bdstr_t bdstr;
-    char *dev_name_str;
-    uint8_t i = 0;
     char linebuf[BTIF_STORAGE_MAX_LINE_SZ];
 
     bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
index 3268540..76f5790 100644 (file)
@@ -20,7 +20,6 @@ LOCAL_CFLAGS += \
        -DBOARD_HAVE_BLUETOOTH_BCM
 endif
 
-LOCAL_PRELINK_MODULE := false
 LOCAL_SRC_FILES := \
        ./common/gki_buffer.c \
        ./ulinux/gki_ulinux.c
index d09dfcb..538fc95 100644 (file)
@@ -18,6 +18,7 @@
 
 #define LOG_TAG "bt_snoop"
 
+#include <arpa/inet.h>
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
index d73c42d..89d5cc9 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 #include <cutils/properties.h>
+#include <string.h>
 #include <signal.h>
 #include <string.h>
 #include <sys/types.h>
index 6ff3c3d..e25b7c4 100644 (file)
@@ -16,6 +16,8 @@
  *
  ******************************************************************************/
 
+#define LOG_TAG "bt_hci"
+
 #include <assert.h>
 
 #include "buffer_allocator.h"
@@ -23,6 +25,7 @@
 #include "hcimsgs.h"
 #include "hci_layer.h"
 #include "hci_packet_parser.h"
+#include "osi/include/log.h"
 
 static const command_opcode_t NO_OPCODE_CHECKING = 0;
 
@@ -45,6 +48,7 @@ static void parse_read_buffer_size_response(
     uint16_t *acl_buffer_count_ptr) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_READ_BUFFER_SIZE, 5 /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_UINT16(*data_size_ptr, stream);
   STREAM_SKIP_UINT8(stream); // skip the sco packet length
   STREAM_TO_UINT16(*acl_buffer_count_ptr, stream);
@@ -57,6 +61,7 @@ static void parse_read_local_version_info_response(
     bt_version_t *bt_version) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_VERSION_INFO, 8 /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_UINT8(bt_version->hci_version, stream);
   STREAM_TO_UINT16(bt_version->hci_revision, stream);
   STREAM_TO_UINT8(bt_version->lmp_version, stream);
@@ -71,6 +76,7 @@ static void parse_read_bd_addr_response(
     bt_bdaddr_t *address_ptr) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_READ_BD_ADDR, sizeof(bt_bdaddr_t) /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_BDADDR(address_ptr->address, stream);
 
   buffer_allocator->free(response);
@@ -82,6 +88,7 @@ static void parse_read_local_supported_commands_response(
     size_t supported_commands_length) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_SUPPORTED_CMDS, supported_commands_length /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_ARRAY(supported_commands_ptr, stream, (int)supported_commands_length);
 
   buffer_allocator->free(response);
@@ -95,11 +102,16 @@ static void parse_read_local_extended_features_response(
     size_t feature_pages_count) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_EXT_FEATURES, 2 + sizeof(bt_device_features_t) /* bytes after */);
-  STREAM_TO_UINT8(*page_number_ptr, stream);
-  STREAM_TO_UINT8(*max_page_number_ptr, stream);
-
-  assert(*page_number_ptr < feature_pages_count);
-  STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream, (int)sizeof(bt_device_features_t));
+  if (stream != NULL) {
+    STREAM_TO_UINT8(*page_number_ptr, stream);
+    STREAM_TO_UINT8(*max_page_number_ptr, stream);
+
+    assert(*page_number_ptr < feature_pages_count);
+    STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream, (int)sizeof(bt_device_features_t));
+  } else {
+    LOG_ERROR("%s() - WARNING: READING EXTENDED FEATURES FAILED. "
+                "THIS MAY INDICATE A FIRMWARE/CONTROLLER ISSUE.", __func__);
+  }
 
   buffer_allocator->free(response);
 }
@@ -109,6 +121,7 @@ static void parse_ble_read_white_list_size_response(
     uint8_t *white_list_size_ptr) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_WHITE_LIST_SIZE, 1 /* byte after */);
+  assert(stream != NULL);
   STREAM_TO_UINT8(*white_list_size_ptr, stream);
 
   buffer_allocator->free(response);
@@ -120,6 +133,7 @@ static void parse_ble_read_buffer_size_response(
     uint8_t *acl_buffer_count_ptr) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_BUFFER_SIZE, 3 /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_UINT16(*data_size_ptr, stream);
   STREAM_TO_UINT8(*acl_buffer_count_ptr, stream);
 
@@ -132,6 +146,7 @@ static void parse_ble_read_supported_states_response(
     size_t supported_states_size) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_SUPPORTED_STATES, supported_states_size /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_ARRAY(supported_states, stream, (int)supported_states_size);
 
   buffer_allocator->free(response);
@@ -142,6 +157,7 @@ static void parse_ble_read_local_supported_features_response(
     bt_device_features_t *supported_features) {
 
   uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_LOCAL_SPT_FEAT, sizeof(bt_device_features_t) /* bytes after */);
+  assert(stream != NULL);
   STREAM_TO_ARRAY(supported_features->as_array, stream, (int)sizeof(bt_device_features_t));
 
   buffer_allocator->free(response);
@@ -191,8 +207,9 @@ static uint8_t *read_command_complete_header(
 
   // Assume the next field is the status field
   STREAM_TO_UINT8(status, stream);
-  // Make sure it was successful
-  assert(status == HCI_SUCCESS);
+
+  if (status != HCI_SUCCESS)
+    return NULL;
 
   return stream;
 }
index d0c4956..9f07e37 100644 (file)
@@ -153,4 +153,7 @@ LOCAL_REQUIRED_MODULES := \
 
 LOCAL_MULTILIB := 32
 
+LOCAL_CLANG_CFLAGS := -Wno-error=gnu-variable-sized-type-not-at-end
+LOCAL_CLANG_CFLAGS += -Wno-typedef-redefinition
+
 include $(BUILD_SHARED_LIBRARY)
index 225948d..1ce58bc 100644 (file)
@@ -22,8 +22,9 @@
 #include <errno.h>
 #include <hardware/bluetooth.h>
 #include <inttypes.h>
-#include <signal.h>
+#include <malloc.h>
 #include <string.h>
+#include <signal.h>
 #include <time.h>
 
 #include "osi/include/alarm.h"
index a9701aa..f5f5889 100644 (file)
@@ -4,10 +4,10 @@
 #include "osi/include/list.h"
 #include "osi/include/osi.h"
 
-typedef struct list_node_t {
+struct list_node_t {
   struct list_node_t *next;
   void *data;
-} list_node_t;
+};
 
 typedef struct list_t {
   list_node_t *head;
index b8dddcf..5ee9926 100644 (file)
@@ -21,6 +21,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <malloc.h>
 #include <string.h>
 #include <sys/eventfd.h>
 
index 524b28d..c6c8979 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <malloc.h>
 #include <pthread.h>
 #include <string.h>
 #include <sys/prctl.h>
index 10eb446..ccb5dc6 100644 (file)
@@ -43,7 +43,6 @@ LOCAL_CFLAGS += \
        -DBOARD_HAVE_BLUETOOTH_BCM
 endif
 
-LOCAL_PRELINK_MODULE:=false
 LOCAL_SRC_FILES:= \
     ./a2dp/a2d_api.c \
     ./a2dp/a2d_sbc.c \
@@ -167,5 +166,9 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 LOCAL_STATIC_LIBRARIES := libbt-hci
 LOCAL_SHARED_LIBRARIES := libcutils libc
 LOCAL_MULTILIB := 32
+# gnu-variable-sized-type-not-at-end is needed for a variable-size header in
+# a struct.
+# const-logical-operand is needed for code in l2c_utils.c that looks intentional.
+LOCAL_CLANG_CFLAGS += -Wno-error=gnu-variable-sized-type-not-at-end -Wno-error=constant-logical-operand
 
 include $(BUILD_STATIC_LIBRARY)
index 3b28146..589af0b 100644 (file)
@@ -89,17 +89,35 @@ static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf)
             GKI_freebuf(p_lcb->p_rx_msg);
             AVCT_TRACE_WARNING("Got start during reassembly");
         }
-        p_lcb->p_rx_msg = p_buf;
+        /* Allocate bigger buffer for reassembly. As lower layers are
+         * not aware of possible packet size after reassembly they
+         * would have allocated smaller buffer.
+         */
+        p_lcb->p_rx_msg = (BT_HDR*)GKI_getbuf(GKI_MAX_BUF_SIZE);
+        if (p_lcb->p_rx_msg == NULL)
+        {
+            AVCT_TRACE_ERROR ("Cannot alloc buffer for reassembly !!");
+            GKI_freebuf(p_buf);
+        }
+        else
+        {
+            memcpy (p_lcb->p_rx_msg, p_buf,
+                sizeof(BT_HDR) + p_buf->offset + p_buf->len);
+            /* Free original buffer */
+            GKI_freebuf(p_buf);
 
-        /* copy first header byte over nosp */
-        *(p + 1) = *p;
+            /* update p to point to new buffer */
+            p = (UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset;
 
-        /* set offset to point to where to copy next */
-        p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len;
+            /* copy first header byte over nosp */
+            *(p + 1) = *p;
 
-        /* adjust length for packet header */
-        p_lcb->p_rx_msg->len -= 1;
+            /* set offset to point to where to copy next */
+            p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len;
 
+            /* adjust length for packet header */
+            p_lcb->p_rx_msg->len -= 1;
+        }
         p_ret = NULL;
     }
     /* continue or end */
index 143ce81..f268800 100644 (file)
@@ -45,14 +45,6 @@ static tAVRC_STS avrc_pars_vendor_rsp(tAVRC_MSG_VENDOR *p_msg, tAVRC_RESPONSE *p
     tAVRC_STS  status = AVRC_STS_NO_ERROR;
     UINT8   *p = p_msg->p_vendor_data;
     UINT16  len;
-    UINT8   xx, yy;
-    tAVRC_NOTIF_RSP_PARAM   *p_param;
-    tAVRC_APP_SETTING       *p_app_set;
-    tAVRC_APP_SETTING_TEXT  *p_app_txt;
-    tAVRC_ATTR_ENTRY        *p_entry;
-    UINT32  *p_u32;
-    UINT8   *p_u8;
-    UINT16  size_needed;
     UINT8 eventid=0;
 
     BE_STREAM_TO_UINT8 (p_result->pdu, p);
index a6c7659..3fb8e7b 100644 (file)
@@ -210,7 +210,6 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
                       UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport)
 {
     tBTM_SEC_DEV_REC *p_dev_rec = NULL;
-    UINT8             yy;
     tACL_CONN        *p;
     UINT8             xx;
 
@@ -1573,8 +1572,6 @@ UINT8 BTM_AllocateSCN(void)
 
 BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
 {
-    UINT8   x;
-
     /* Make sure we don't exceed max port range.
      * Stack reserves scn 1 for HFP, HSP we still do the correct way.
      */
index eaaa115..e492b1f 100644 (file)
@@ -719,7 +719,6 @@ void BTM_BleTestEnd(tBTM_CMPL_CB *p_cmd_cmpl_cback)
 void btm_ble_test_command_complete(UINT8 *p)
 {
     tBTM_CMPL_CB   *p_cb = btm_cb.devcb.p_le_test_cmd_cmpl_cb;
-    UINT8           status;
 
     btm_cb.devcb.p_le_test_cmd_cmpl_cb = NULL;
 
index 24d1df5..d8add82 100644 (file)
@@ -359,7 +359,6 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
     UINT8  *p = p_params->p_param_buf;
     UINT16  len = p_params->param_len;
     tBTM_BLE_REF_VALUE ref_value = 0;
-    int index = 0;
 
     UINT8  status = 0, subcode = 0, opcode = 0;
     UINT8 report_format = 0, num_records = 0, cb_evt = 0;
@@ -842,7 +841,7 @@ tBTM_STATUS BTM_BleReadScanReports(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
     tBTM_STATUS     status = BTM_NO_RESOURCES;
     tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
     UINT8 read_scan_mode = 0;
-    UINT8  *p_data = NULL, report_format = 0, num_records = 0;
+    UINT8  *p_data = NULL, num_records = 0;
     UINT16 data_len = 0;
 
     BTM_TRACE_EVENT (" BTM_BleReadScanReports; %d, %d", scan_mode, ref_value);
index fc6dae0..e77f701 100644 (file)
@@ -55,8 +55,9 @@
 #define MIN_ADV_LENGTH                       2
 #define BTM_NEW_VSC_CHIP_CAPBLTY_RSP_LEN    13
 
-static tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
+#if BLE_VND_INCLUDED == TRUE
 static tBTM_BLE_CTRL_FEATURES_CBACK    *p_ctrl_le_feature_rd_cmpl_cback = NULL;
+#endif
 
 /*******************************************************************************
 **  Local functions
@@ -423,6 +424,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
     return status;
 }
 
+#if BLE_VND_INCLUDED == TRUE
 /*******************************************************************************
 **
 ** Function         btm_vsc_brcm_features_complete
@@ -434,7 +436,6 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
 *******************************************************************************/
 static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_params)
 {
-#if BLE_VND_INCLUDED == TRUE
     UINT8  status = 0xFF, *p;
 
     BTM_TRACE_DEBUG("btm_ble_vendor_capability_vsc_cmpl_cback");
@@ -490,11 +491,8 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_
 
     if (p_ctrl_le_feature_rd_cmpl_cback != NULL)
         p_ctrl_le_feature_rd_cmpl_cback(status);
-
-#else
-    UNUSED(p_vcs_cplt_params);
-#endif
 }
+#endif
 
 /*******************************************************************************
 **
@@ -3257,8 +3255,6 @@ void btm_ble_init (void)
 BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask)
 {
     BOOLEAN rt = FALSE;
-    UINT32  llt_mask = 0;
-    UINT8   *p;
 
     UINT8   state_offset = 0;
     UINT16  cur_states = btm_cb.ble_ctr_cb.cur_states;
index 7055ba9..1e90f0d 100644 (file)
@@ -380,7 +380,6 @@ tBTM_STATUS btm_ble_multi_adv_write_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst, BD_ADD
 void btm_ble_multi_adv_gen_rpa_cmpl(tBTM_RAND_ENC *p)
 {
 #if (SMP_INCLUDED == TRUE)
-    tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
     tSMP_ENC    output;
     UINT8 index = 0;
     tBTM_BLE_MULTI_ADV_INST *p_inst = NULL;
index c680baa..a668f85 100644 (file)
@@ -2360,7 +2360,7 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
          /* Note: If part of the inquiry, the name is not stored, and the    */
          /*       inquiry complete callback is called.                       */
 
-        if ((hci_status == HCI_SUCCESS))
+        if (hci_status == HCI_SUCCESS)
         {
             /* Copy the name from the data stream into the return structure */
             /* Note that even if it is not being returned, it is used as a  */
index b62cef8..c806782 100644 (file)
@@ -5819,7 +5819,7 @@ static char *btm_pair_state_descr (tBTM_PAIRING_STATE state)
 
     return("???");
 #else
-    sprintf(btm_cb.state_temp_buffer,"%hu",state);
+    sprintf(btm_cb.state_temp_buffer,"%hhu",state);
 
     return(btm_cb.state_temp_buffer);
 #endif
index 4477dff..e3f6139 100644 (file)
@@ -380,7 +380,9 @@ void btu_hcif_send_cmd (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_buf)
       btu_hcif_command_status_evt,
       vsc_callback);
 
+#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
     btu_check_bt_sleep ();
+#endif
 }
 
 
index 439666b..d4323c7 100755 (executable)
@@ -123,7 +123,7 @@ void gatt_dequeue_sr_cmd (tGATT_TCB *p_tcb)
 static BOOLEAN process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status,
                                        tGATTS_RSP *p_msg, UINT16 mtu)
 {
-    tGATTS_RSP       *p_rsp;
+    tGATTS_RSP       *p_rsp = NULL;
     UINT16          ii, total_len, len;
     BT_HDR          *p_buf = (BT_HDR *)GKI_getbuf((UINT16)sizeof(tGATTS_RSP));
     UINT8           *p;
@@ -332,7 +332,6 @@ void gatt_process_exec_write_req (tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, U
 {
     UINT8   *p = p_data, flag, i = 0;
     UINT32  trans_id = 0;
-    BT_HDR  *p_buf;
     tGATT_IF gatt_if;
     UINT16  conn_id;
 
index ef8f4bc..634f1cd 100644 (file)
@@ -323,7 +323,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
     tL2CAP_CFG_INFO cfg_info;
     UINT16          rej_reason, rej_mtu, lcid, rcid, info_type;
     tL2C_CCB        *p_ccb;
-    tL2C_RCB        *p_rcb, *p_rcb2;
+    tL2C_RCB        *p_rcb;
     BOOLEAN         cfg_rej, pkt_size_rej = FALSE;
     UINT16          cfg_rej_len, cmd_len;
     UINT16          result;
index d30db79..6700dd7 100644 (file)
@@ -22,6 +22,7 @@
  *  Functions.
  *
  ******************************************************************************/
+
 #include <stddef.h>
 #include "bt_target.h"
 #include "bt_utils.h"
index 7a550fa..3c1f8b3 100644 (file)
@@ -63,7 +63,6 @@ UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p
     UINT32  sdp_handle;
     UINT16  browse_list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
     UINT16  security = 0;
-    UINT8   availability;
     UINT32  proto_len = (UINT32)pan_proto_elem_data[1];
 
     /* Create a record */
index f1225c0..3f38a71 100644 (file)
@@ -1523,7 +1523,6 @@ int PORT_WriteDataCO (UINT16 handle, int* p_len)
     UINT16     length;
 
     RFCOMM_TRACE_API ("PORT_WriteDataCO() handle:%d", handle);
-    int written;
     *p_len = 0;
 
     /* Check if handle is valid to avoid crashing */
index f546e16..8120893 100644 (file)
@@ -21,6 +21,7 @@
  *  This file contains functions to send TS 07.10 frames
  *
  ******************************************************************************/
+
 #include <stddef.h>
 #include "bt_target.h"
 #include "btcore/include/counter.h"
index 890f808..6e84ded 100644 (file)
@@ -425,7 +425,7 @@ BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
 BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
 {
 #if SDP_CLIENT_ENABLED == TRUE
-    tSDP_DISC_ATTR  *p_attr, *p_sattr, *p_extra_sattr;
+    tSDP_DISC_ATTR  *p_attr, *p_sattr;
 
     p_attr = p_rec->p_first_attr;
 
@@ -590,7 +590,7 @@ tSDP_DISC_REC *SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC
 {
 #if SDP_CLIENT_ENABLED == TRUE
     tSDP_DISC_REC   *p_rec;
-    tSDP_DISC_ATTR  *p_attr, *p_sattr, *p_extra_sattr;
+    tSDP_DISC_ATTR  *p_attr, *p_sattr;
 
     /* Must have a valid database */
     if (p_db == NULL)
index c56459d..646a62d 100644 (file)
@@ -352,7 +352,6 @@ static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset)
     UINT32          list_len;
     UINT8           *p;
     UINT8           type;
-    UINT32          delta_len = 0;
 
 #if (SDP_DEBUG_RAW == TRUE)
     UINT8 num_array[SDP_MAX_LIST_BYTE_COUNT];
index de128a6..e11e602 100644 (file)
@@ -241,6 +241,7 @@ static void process_service_search (tCONN_CB *p_ccb, UINT16 trans_num,
     {
         rem_handles = num_rsp_handles;
         cont_offset = 0;
+        p_ccb->cont_offset = 0;
     }
 
     /* Calculate how many handles will fit in one PDU */
index 8196546..2aa3bb2 100644 (file)
@@ -33,7 +33,6 @@ LOCAL_MODULE_TAGS := eng
 LOCAL_MODULE:= bdt
 
 LOCAL_SHARED_LIBRARIES += libcutils   \
-                          libutils    \
                           libhardware \
                           libhardware_legacy
 
index 0aa7979..935ff17 100644 (file)
@@ -18,6 +18,7 @@
 
 #pragma once
 
+#include <malloc.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <string.h>
index afeb071..7ed5c4a 100644 (file)
@@ -25,6 +25,7 @@ LOCAL_SRC_FILES := \
   adapter.c \
   bdtool.c \
   ../../test/suite/support/callbacks.c \
+  ../../test/suite/support/gatt.c \
   ../../test/suite/support/hal.c \
   ../../test/suite/support/pan.c
 
index 36e37fc..c3f8527 100644 (file)
@@ -706,7 +706,6 @@ BOOLEAN UIPC_SendBuf(tUIPC_CH_ID ch_id, BT_HDR *p_msg)
 BOOLEAN UIPC_Send(tUIPC_CH_ID ch_id, UINT16 msg_evt, UINT8 *p_buf,
         UINT16 msglen)
 {
-    int n;
     UNUSED(msg_evt);
 
     BTIF_TRACE_DEBUG("UIPC_Send : ch_id:%d %d bytes", ch_id, msglen);
index 6425802..8e3fe39 100644 (file)
@@ -12,7 +12,6 @@ LOCAL_C_INCLUDES := \
 
 LOCAL_CFLAGS += $(bdroid_CFLAGS) -std=c99
 
-LOCAL_PRELINK_MODULE :=false
 LOCAL_SRC_FILES := \
        ./src/bt_utils.c