OSDN Git Service

Add config source to dumpsys output
[android-x86/system-bt.git] / btif / src / bluetooth.c
index 4bfebf7..f2eea9c 100644 (file)
@@ -27,6 +27,7 @@
 #define LOG_NDDEBUG 0
 #define LOG_TAG "bt_btif"
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "btif_debug.h"
 #include "btsnoop.h"
 #include "btsnoop_mem.h"
+#include "device/include/interop.h"
 #include "osi/include/allocation_tracker.h"
 #include "osi/include/alarm.h"
 #include "osi/include/log.h"
+#include "osi/include/metrics.h"
 #include "osi/include/osi.h"
 #include "osi/include/wakelock.h"
 #include "stack_manager.h"
 #include "btif/include/btif_media.h"
 
 /************************************************************************************
-**  Constants & Macros
-************************************************************************************/
-
-#define is_profile(profile, str) ((strlen(str) == strlen(profile)) && strncmp((const char *)profile, str, strlen(str)) == 0)
-
-/************************************************************************************
 **  Static variables
 ************************************************************************************/
 
@@ -115,6 +112,12 @@ static bool interface_ready(void) {
   return bt_hal_cbacks != NULL;
 }
 
+static bool is_profile(const char *p1, const char *p2) {
+  assert(p1);
+  assert(p2);
+  return strlen(p1) == strlen(p2) && strncmp(p1, p2, strlen(p2)) == 0;
+}
+
 /*****************************************************************************
 **
 **   BLUETOOTH HAL INTERFACE FUNCTIONS
@@ -323,10 +326,24 @@ static int read_energy_info()
     return BT_STATUS_SUCCESS;
 }
 
-static void dump(int fd, UNUSED_ATTR const char **arguments)
+static void dump(int fd, const char **arguments)
 {
+    if (arguments != NULL && arguments[0] != NULL) {
+      if (strncmp(arguments[0], "--proto-text", 12) == 0) {
+        btif_update_a2dp_metrics();
+        metrics_print(fd, true);
+        return;
+      }
+      if (strncmp(arguments[0], "--proto-bin", 11) == 0) {
+        btif_update_a2dp_metrics();
+        metrics_write(fd, true);
+        return;
+      }
+    }
     btif_debug_conn_dump(fd);
+    btif_debug_bond_event_dump(fd);
     btif_debug_a2dp_dump(fd);
+    btif_debug_config_dump(fd);
     wakelock_debug_dump(fd);
     alarm_debug_dump(fd);
 #if defined(BTSNOOP_MEM) && (BTSNOOP_MEM == TRUE)
@@ -438,7 +455,7 @@ static int set_os_callouts(bt_os_callouts_t *callouts) {
 }
 
 static int config_clear(void) {
-    LOG_INFO("%s", __func__);
+    LOG_INFO(LOG_TAG, "%s", __func__);
     return btif_config_clear() ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
 }
 
@@ -477,7 +494,9 @@ static const bt_interface_t bluetoothInterface = {
     set_os_callouts,
     read_energy_info,
     dump,
-    config_clear
+    config_clear,
+    interop_database_clear,
+    interop_database_add,
 };
 
 const bt_interface_t* bluetooth__get_bluetooth_interface ()