Merge "RootCanal: Allow empty scan responses"
diff --git a/build.py b/build.py
index 3a2f72f..3fcb2fb 100755
--- a/build.py
+++ b/build.py
@@ -34,6 +34,7 @@
 import six
 import subprocess
 import sys
+import time
 
 # Use flags required by common-mk (find -type f | grep -nE 'use[.]' {})
 COMMON_MK_USES = [
diff --git a/system/bta/csis/csis_client.cc b/system/bta/csis/csis_client.cc
index af1e290..ffec50e 100644
--- a/system/bta/csis/csis_client.cc
+++ b/system/bta/csis/csis_client.cc
@@ -188,7 +188,7 @@
     if (device) RemoveCsisDevice(device, group_id);
   }
 
-  void onGroupAddFromStorageCb(const RawAddress& address,
+  void OnGroupAddFromStorageCb(const RawAddress& address,
                                const bluetooth::Uuid& uuid, int group_id) {
     auto device = FindDeviceByAddress(address);
     if (device == nullptr) return;
@@ -1806,10 +1806,10 @@
     if (instance) instance->OnGroupMemberRemovedCb(address, group_id);
   }
 
-  void onGroupAddFromStorage(const RawAddress& address,
+  void OnGroupAddFromStorage(const RawAddress& address,
                              const bluetooth::Uuid& uuid,
                              int group_id) override {
-    if (instance) instance->onGroupAddFromStorageCb(address, uuid, group_id);
+    if (instance) instance->OnGroupAddFromStorageCb(address, uuid, group_id);
   }
 };
 
diff --git a/system/bta/groups/groups.cc b/system/bta/groups/groups.cc
index 1eec4ff..5e5eadf 100644
--- a/system/bta/groups/groups.cc
+++ b/system/bta/groups/groups.cc
@@ -226,7 +226,7 @@
         if (group) add_to_group(addr, group);
 
         for (auto c : callbacks_) {
-          c->onGroupAddFromStorage(addr, Uuid::From128BitLE(uuid128), id);
+          c->OnGroupAddFromStorage(addr, Uuid::From128BitLE(uuid128), id);
         }
       }
     }
diff --git a/system/bta/groups/groups_test.cc b/system/bta/groups/groups_test.cc
index 1bdb7c2..8966284 100644
--- a/system/bta/groups/groups_test.cc
+++ b/system/bta/groups/groups_test.cc
@@ -65,7 +65,7 @@
               (const bluetooth::Uuid& uuid, int group_id), (override));
   MOCK_METHOD((void), OnGroupMemberRemoved,
               (const RawAddress& address, int group_id), (override));
-  MOCK_METHOD((void), onGroupAddFromStorage,
+  MOCK_METHOD((void), OnGroupAddFromStorage,
               (const RawAddress& address, const bluetooth::Uuid& uuid,
                int group_id),
               (override));
diff --git a/system/bta/include/bta_groups.h b/system/bta/include/bta_groups.h
index 41394ec..dd3ad65 100644
--- a/system/bta/include/bta_groups.h
+++ b/system/bta/include/bta_groups.h
@@ -51,7 +51,7 @@
                                     int group_id) = 0;
 
   /* Callback with group information added from storage */
-  virtual void onGroupAddFromStorage(const RawAddress& address,
+  virtual void OnGroupAddFromStorage(const RawAddress& address,
                                      const bluetooth::Uuid& group_uuid,
                                      int group_id) = 0;
 };
diff --git a/system/bta/test/common/btm_api_mock.cc b/system/bta/test/common/btm_api_mock.cc
index 0fde32d..308abfb 100644
--- a/system/bta/test/common/btm_api_mock.cc
+++ b/system/bta/test/common/btm_api_mock.cc
@@ -76,4 +76,15 @@
 void BTM_RequestPeerSCA(RawAddress const& bd_addr, tBT_TRANSPORT transport) {
   LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
   btm_interface->RequestPeerSCA(bd_addr, transport);
+}
+
+uint16_t BTM_GetHCIConnHandle(RawAddress const& bd_addr,
+                              tBT_TRANSPORT transport) {
+  LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
+  return btm_interface->GetHCIConnHandle(bd_addr, transport);
+}
+
+void acl_disconnect_from_handle(uint16_t handle, tHCI_STATUS reason) {
+  LOG_ASSERT(btm_interface) << "Mock btm interface not set!";
+  return btm_interface->AclDisconnectFromHandle(handle, reason);
 }
\ No newline at end of file
diff --git a/system/bta/test/common/btm_api_mock.h b/system/bta/test/common/btm_api_mock.h
index 34b8e40..3e40659 100644
--- a/system/bta/test/common/btm_api_mock.h
+++ b/system/bta/test/common/btm_api_mock.h
@@ -47,6 +47,9 @@
   virtual bool SecIsSecurityPending(const RawAddress& bd_addr) = 0;
   virtual void RequestPeerSCA(RawAddress const& bd_addr,
                               tBT_TRANSPORT transport) = 0;
+  virtual uint16_t GetHCIConnHandle(RawAddress const& bd_addr,
+                                    tBT_TRANSPORT transport) = 0;
+  virtual void AclDisconnectFromHandle(uint16_t handle, tHCI_STATUS reason) = 0;
   virtual ~BtmInterface() = default;
 };
 
@@ -79,6 +82,10 @@
               (override));
   MOCK_METHOD((void), RequestPeerSCA,
               (RawAddress const& bd_addr, tBT_TRANSPORT transport), (override));
+  MOCK_METHOD((uint16_t), GetHCIConnHandle,
+              (RawAddress const& bd_addr, tBT_TRANSPORT transport), (override));
+  MOCK_METHOD((void), AclDisconnectFromHandle,
+              (uint16_t handle, tHCI_STATUS reason), (override));
 };
 
 /**