OSDN Git Service

resolved conflicts for merge of 27c4e634 to mnc-dev-plus-aosp
authorAndre Eisenbach <eisenbach@google.com>
Mon, 13 Jul 2015 17:06:52 +0000 (10:06 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 13 Jul 2015 17:06:52 +0000 (10:06 -0700)
Change-Id: Id6d78e484d58042e93e4d4ea34522d15a6e1ba59

1  2 
btif/src/btif_dm.c
device/src/interop.c

diff --combined btif/src/btif_dm.c
  
  #include <hardware/bluetooth.h>
  
 +/**
 + * TODO(armansito): cutils/properties.h is only being used to pull-in runtime
 + * settings on Android. Remove this conditional include once we have a generic
 + * way to obtain system properties.
 + */
 +#if !defined(OS_GENERIC)
  #include <cutils/properties.h>
 -#include "gki.h"
 -#include "btu.h"
 -#include "btcore/include/bdaddr.h"
 +#endif  /* !defined(OS_GENERIC) */
 +
 +#include "bdaddr.h"
  #include "bta_api.h"
 +#include "bta_gatt_api.h"
  #include "btif_api.h"
 -#include "btif_util.h"
 +#include "btif_config.h"
  #include "btif_dm.h"
 -#include "btif_storage.h"
  #include "btif_hh.h"
 -#include "btif_config.h"
  #include "btif_sdp.h"
 +#include "btif_storage.h"
 +#include "btif_util.h"
 +#include "btu.h"
 +#include "gki.h"
+ #include "bta_gatt_api.h"
+ #include "device/include/interop.h"
+ #include "include/stack_config.h"
+ #include "osi/include/log.h"
  #include "osi/include/allocator.h"
 +#include "osi/include/log.h"
 +#include "stack_config.h"
  
  /******************************************************************************
- **  Device specific workarounds
- ******************************************************************************/
- /**
-  * The devices below have proven problematic during the pairing process, often
-  * requiring multiple retries to complete pairing. To avoid degrading the user
-  * experience for other devices, explicitely blacklist troubled devices here.
-  */
- static const UINT8 blacklist_pairing_retries[][3] = {
-     {0x9C, 0xDF, 0x03} // BMW car kits (Harman/Becker)
- };
- BOOLEAN blacklistPairingRetries(BD_ADDR bd_addr)
- {
-     const unsigned blacklist_size = sizeof(blacklist_pairing_retries)
-         / sizeof(blacklist_pairing_retries[0]);
-     for (unsigned i = 0; i != blacklist_size; ++i)
-     {
-         if (blacklist_pairing_retries[i][0] == bd_addr[0] &&
-             blacklist_pairing_retries[i][1] == bd_addr[1] &&
-             blacklist_pairing_retries[i][2] == bd_addr[2])
-             return TRUE;
-     }
-     return FALSE;
- }
- /******************************************************************************
  **  Constants & Macros
  ******************************************************************************/
  
@@@ -420,7 -386,7 +397,7 @@@ BOOLEAN check_cod(const bt_bdaddr_t *re
                                 sizeof(uint32_t), &remote_cod);
      if (btif_storage_get_remote_device_property((bt_bdaddr_t *)remote_bdaddr, &prop_name) == BT_STATUS_SUCCESS)
      {
 -        LOG_INFO("%s remote_cod = 0x%08x cod = 0x%08x", __func__, remote_cod, cod);
 +        LOG_INFO(LOG_TAG, "%s remote_cod = 0x%08x cod = 0x%08x", __func__, remote_cod, cod);
          if ((remote_cod & 0x7ff) == cod)
              return TRUE;
      }
@@@ -567,7 -533,7 +544,7 @@@ static void btif_update_remote_version_
      btm_status = BTM_ReadRemoteVersion(*(BD_ADDR*)p_bd, &lmp_ver,
                            &mfct_set, &lmp_subver);
  
 -    LOG_DEBUG("remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
 +    LOG_DEBUG(LOG_TAG, "remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
                 lmp_ver, mfct_set, lmp_subver);
  
      if (btm_status == BTM_SUCCESS)
@@@ -1030,7 -996,7 +1007,7 @@@ static void btif_dm_ssp_cfm_req_evt(tBT
      cod = devclass2uint(p_ssp_cfm_req->dev_class);
  
      if (cod == 0) {
 -        LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
 +        LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
          cod = COD_UNCLASSIFIED;
      }
  
@@@ -1065,7 -1031,7 +1042,7 @@@ static void btif_dm_ssp_key_notif_evt(t
      cod = devclass2uint(p_ssp_key_notif->dev_class);
  
      if (cod == 0) {
 -        LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
 +        LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
          cod = COD_UNCLASSIFIED;
      }
  
@@@ -1138,14 -1104,14 +1115,14 @@@ static void btif_dm_auth_cmpl_evt (tBTA
  
          if (check_sdp_bl(&bd_addr) && check_cod_hid(&bd_addr, COD_HID_MAJOR))
          {
 -            LOG_WARN("%s:skip SDP", __FUNCTION__);
 +            LOG_WARN(LOG_TAG, "%s:skip SDP", __FUNCTION__);
              skip_sdp = TRUE;
          }
          if(!pairing_cb.is_local_initiated && skip_sdp)
          {
              bond_state_changed(status, &bd_addr, state);
  
 -            LOG_WARN("%s: Incoming HID Connection",__FUNCTION__);
 +            LOG_WARN(LOG_TAG, "%s: Incoming HID Connection",__FUNCTION__);
              bt_property_t prop;
              bt_bdaddr_t bd_addr;
              bt_uuid_t  uuid;
          switch(p_auth_cmpl->fail_reason)
          {
              case HCI_ERR_PAGE_TIMEOUT:
-                 if (blacklistPairingRetries(bd_addr.address) && pairing_cb.timeout_retries)
+                 if (interop_match(INTEROP_AUTO_RETRY_PAIRING, &bd_addr)
+                     && pairing_cb.timeout_retries)
                  {
                      BTIF_TRACE_WARNING("%s() - Pairing timeout; retrying (%d) ...", __FUNCTION__, pairing_cb.timeout_retries);
                      --pairing_cb.timeout_retries;
@@@ -1328,7 -1295,7 +1306,7 @@@ static void btif_dm_search_devices_evt 
              cod = devclass2uint (p_search_data->inq_res.dev_class);
  
              if (cod == 0) {
 -                LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
 +                LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
                  cod = COD_UNCLASSIFIED;
              }
  
@@@ -1486,7 -1453,7 +1464,7 @@@ static void btif_dm_search_services_evt
                   {
                        char temp[256];
                        uuid_to_string_legacy((bt_uuid_t*)(p_data->disc_res.p_uuid_list + (i*MAX_UUID_SIZE)), temp);
 -                      LOG_INFO("%s index:%d uuid:%s", __func__, i, temp);
 +                      LOG_INFO(LOG_TAG, "%s index:%d uuid:%s", __func__, i, temp);
                   }
              }
  
                  }
  
                  uuid_to_string_legacy(&uuid, temp);
 -                LOG_INFO("%s uuid:%s", __func__, temp);
 +                LOG_INFO(LOG_TAG, "%s uuid:%s", __func__, temp);
  
                  bdcpy(bd_addr.address, p_data->disc_ble_res.bd_addr);
                  prop.type = BT_PROPERTY_UUIDS;
@@@ -2731,12 -2698,6 +2709,12 @@@ void btif_dm_set_oob_for_io_req(tBTA_OO
  #ifdef BTIF_DM_OOB_TEST
  void btif_dm_load_local_oob(void)
  {
 +  /**
 +   * TODO(armansito): On OSs other than Android, the sys/properties.h system
 +   * does not exist. Remove this conditional include once we have a generic way
 +   * to obtain system properties.
 +   */
 +#if !defined(OS_GENERIC)
      char prop_oob[PROPERTY_VALUE_MAX];
      property_get("service.brcm.bt.oob", prop_oob, "3");
      BTIF_TRACE_DEBUG("btif_dm_load_local_oob prop_oob = %s",prop_oob);
              BTIF_TRACE_DEBUG("btif_dm_load_local_oob: read OOB, call BTA_DmLocalOob()");
              BTA_DmLocalOob();
          }
 -#else
 +#else  /* (BTM_OOB_INCLUDED != TRUE) */
          BTIF_TRACE_ERROR("BTM_OOB_INCLUDED is FALSE!!(btif_dm_load_local_oob)");
 -#endif
 +#endif  /* (BTM_OOB_INCLUDED == TRUE) */
      }
 +#endif  /* !defined(OS_GENERIC) */
  }
  
  void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r)
  {
 +  /**
 +   * TODO(armansito): On OSs other than Android, the sys/properties.h system
 +   * does not exist. Remove this conditional include once we have a generic way
 +   * to obtain system properties.
 +   */
 +#if !defined(OS_GENERIC)
      FILE *fp;
      char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
      char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
              }
          }
      }
 +#endif  /* !defined(OS_GENERIC) */
  }
 +
  BOOLEAN btif_dm_proc_rmt_oob(BD_ADDR bd_addr,  BT_OCTET16 p_c, BT_OCTET16 p_r)
  {
 +  /**
 +   * TODO(armansito): On OSs other than Android, the sys/properties.h system
 +   * does not exist. Remove this conditional include once we have a generic way
 +   * to obtain system properties.
 +   */
 +#if !defined(OS_GENERIC)
      char t[128];
      FILE *fp;
      char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
      }
      BTIF_TRACE_DEBUG("btif_dm_proc_rmt_oob result=%d",result);
      return result;
 +#else  /* defined(OS_GENERIC) */
 +    return FALSE;
 +#endif  /* !defined(OS_GENERIC) */
  }
  #endif /*  BTIF_DM_OOB_TEST */
  #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
@@@ -3262,12 -3205,6 +3240,12 @@@ void btif_dm_read_energy_info(
  }
  
  static char* btif_get_default_local_name() {
 +  /**
 +   * TODO(armansito): On OSs other than Android, the sys/properties.h system
 +   * does not exist. Remove this conditional include once we have a generic way
 +   * to obtain system properties.
 +   */
 +#if !defined(OS_GENERIC)
      if (btif_default_local_name[0] == '\0')
      {
          int max_len = sizeof(btif_default_local_name) - 1;
          }
          btif_default_local_name[max_len] = '\0';
      }
 +#endif  /* !defined(OS_GENERIC) */
      return btif_default_local_name;
  }
diff --combined device/src/interop.c
@@@ -30,6 -30,7 +30,7 @@@
  static const char* interop_feature_string(const interop_feature_t feature) {
    switch (feature) {
      CASE_RETURN_STR(INTEROP_DISABLE_LE_SECURE_CONNECTIONS)
+     CASE_RETURN_STR(INTEROP_AUTO_RETRY_PAIRING)
    }
  
    return "UNKNOWN";
@@@ -46,9 -47,8 +47,9 @@@ bool interop_match(const interop_featur
      if (feature == interop_database[i].feature &&
          memcmp(addr, &interop_database[i].addr, interop_database[i].len) == 0) {
        char bdstr[20] = {0};
 -      LOG_WARN("%s() Device %s is a match for interop workaround %s", __func__,
 -          bdaddr_to_string(addr, bdstr, sizeof(bdstr)), interop_feature_string(feature));
 +      LOG_WARN(LOG_TAG, "%s() Device %s is a match for interop workaround %s",
 +          __func__, bdaddr_to_string(addr, bdstr, sizeof(bdstr)),
 +                        interop_feature_string(feature));
        return true;
      }
    }