OSDN Git Service

Add layer of indirection to set hal_callbacks
authorChris Manton <cmanton@google.com>
Thu, 8 Apr 2021 23:16:53 +0000 (16:16 -0700)
committerChris Manton <cmanton@google.com>
Fri, 9 Apr 2021 02:18:44 +0000 (02:18 +0000)
Used for test injection

Bug: 163134718
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I1cfd4103bfe6b20aabff2885e5ace106e11b04e8

btif/src/bluetooth.cc

index fc6ea3f..eeb541d 100644 (file)
@@ -137,6 +137,7 @@ extern VolumeControlInterface* btif_volume_control_get_interface();
  ******************************************************************************/
 
 static bool interface_ready(void) { return bt_hal_cbacks != NULL; }
+void set_hal_cbacks(bt_callbacks_t* callbacks) { bt_hal_cbacks = callbacks; }
 
 static bool is_profile(const char* p1, const char* p2) {
   CHECK(p1);
@@ -167,7 +168,8 @@ static int init(bt_callbacks_t* callbacks, bool start_restricted,
   allocation_tracker_init();
 #endif
 
-  bt_hal_cbacks = callbacks;
+  set_hal_cbacks(callbacks);
+
   restricted_mode = start_restricted;
   common_criteria_mode = is_common_criteria_mode;
   common_criteria_config_compare_result = config_compare_result;