OSDN Git Service

Add dumpsys support for LE connection parameter updates
[android-x86/system-bt.git] / btif / src / bluetooth.c
index f2eea9c..6be1d19 100644 (file)
@@ -24,7 +24,6 @@
  *
  ***********************************************************************************/
 
-#define LOG_NDDEBUG 0
 #define LOG_TAG "bt_btif"
 
 #include <assert.h>
 #include "osi/include/wakelock.h"
 #include "stack_manager.h"
 #include "btif_config.h"
+#include "btif_storage.h"
 #include "btif/include/btif_debug_btsnoop.h"
 #include "btif/include/btif_debug_conn.h"
+#include "btif/include/btif_debug_l2c.h"
 #include "btif/include/btif_media.h"
 
 /************************************************************************************
@@ -69,6 +70,7 @@
 ************************************************************************************/
 
 bt_callbacks_t *bt_hal_cbacks = NULL;
+bool restricted_mode = FALSE;
 
 /************************************************************************************
 **  Externs
@@ -140,8 +142,10 @@ static int init(bt_callbacks_t *callbacks) {
   return BT_STATUS_SUCCESS;
 }
 
-static int enable(void) {
-  LOG_INFO(LOG_TAG, "%s", __func__);
+static int enable(bool start_restricted) {
+  LOG_INFO(LOG_TAG, "%s: start restricted = %d", __func__, start_restricted);
+
+  restricted_mode = start_restricted;
 
   if (!interface_ready())
     return BT_STATUS_NOT_READY;
@@ -162,6 +166,10 @@ static void cleanup(void) {
   stack_manager_get_interface()->clean_up_stack();
 }
 
+bool is_restricted_mode() {
+  return restricted_mode;
+}
+
 static int get_adapter_properties(void)
 {
     /* sanity check */
@@ -282,6 +290,9 @@ static int cancel_bond(const bt_bdaddr_t *bd_addr)
 
 static int remove_bond(const bt_bdaddr_t *bd_addr)
 {
+    if (is_restricted_mode() && !btif_storage_is_restricted_device(bd_addr))
+        return BT_STATUS_SUCCESS;
+
     /* sanity check */
     if (interface_ready() == FALSE)
         return BT_STATUS_NOT_READY;
@@ -343,6 +354,7 @@ static void dump(int fd, const char **arguments)
     btif_debug_conn_dump(fd);
     btif_debug_bond_event_dump(fd);
     btif_debug_a2dp_dump(fd);
+    btif_debug_l2c_dump(fd);
     btif_debug_config_dump(fd);
     wakelock_debug_dump(fd);
     alarm_debug_dump(fd);