summaryrefslogtreecommitdiffstats
path: root/btif
diff options
context:
space:
mode:
authorGanesh Ganapathi Batta <ganeshg@broadcom.com>2012-09-25 11:41:14 -0700
committerMatthew Xie <mattx@google.com>2012-09-25 15:55:24 -0700
commitbc08278001ea3bdf9e08c2f754b129db34b09eb6 (patch)
treef29e8fba8709d3908b5a66522614e3bd3fa22673 /btif
parentf8768feb5fed62dc984fe6de7fd938726b3b2de4 (diff)
downloadexternal_bluetooth_bluedroid-bc08278001ea3bdf9e08c2f754b129db34b09eb6.zip
external_bluetooth_bluedroid-bc08278001ea3bdf9e08c2f754b129db34b09eb6.tar.gz
external_bluetooth_bluedroid-bc08278001ea3bdf9e08c2f754b129db34b09eb6.tar.bz2
Change the order of Local BDA read locations.
Look for Local BDA at ro.bdaddr_path before reading it from BT Local storage path Bug 7228514 Change-Id: Ib6d4b5321b1146d19f671d15c34df3a85b3a89d2
Diffstat (limited to 'btif')
-rwxr-xr-x[-rw-r--r--]btif/src/btif_core.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index 29e493d..3440685 100644..100755
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -342,17 +342,9 @@ static void btif_fetch_local_bdaddr(bt_bdaddr_t *local_addr)
{
char val[256];
uint8_t valid_bda = FALSE;
+ int val_size = 0;
const uint8_t null_bdaddr[BD_ADDR_LEN] = {0,0,0,0,0,0};
- BTIF_TRACE_DEBUG1("Look for bdaddr storage path in prop %s", PROPERTY_BT_BDADDR_PATH);
- int val_size = sizeof(val);
- if(btif_config_get_str("Local", "Adapter", "Address", val, &val_size))
- {
- str2bd(val, local_addr);
- BTIF_TRACE_DEBUG1("local bdaddr from bt_config.xml is %s", val);
- return;
- }
-
/* Get local bdaddr storage path from property */
if (property_get(PROPERTY_BT_BDADDR_PATH, val, NULL))
{
@@ -378,6 +370,18 @@ static void btif_fetch_local_bdaddr(bt_bdaddr_t *local_addr)
}
}
+ if(!valid_bda)
+ {
+ val_size = sizeof(val);
+ BTIF_TRACE_DEBUG1("Look for bdaddr storage path in prop %s", PROPERTY_BT_BDADDR_PATH);
+ if(btif_config_get_str("Local", "Adapter", "Address", val, &val_size))
+ {
+ str2bd(val, local_addr);
+ BTIF_TRACE_DEBUG1("local bdaddr from bt_config.xml is %s", val);
+ return;
+ }
+ }
+
/* No factory BDADDR found. Look for previously generated random BDA */
if ((!valid_bda) && \
(property_get(PERSIST_BDADDR_PROPERTY, val, NULL)))
@@ -416,6 +420,15 @@ static void btif_fetch_local_bdaddr(bt_bdaddr_t *local_addr)
//save the bd address to config file
bdstr_t bdstr;
bd2str(local_addr, &bdstr);
+ val_size = sizeof(val);
+ if (btif_config_get_str("Local", "Adapter", "Address", val, &val_size))
+ {
+ if (strcmp(bdstr, val) ==0)
+ {
+ // BDA is already present in the config file.
+ return;
+ }
+ }
btif_config_set_str("Local", "Adapter", "Address", bdstr);
btif_config_save();
}