Loading system/gd/hci/acl_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -271,8 +271,8 @@ uint16_t AclManager::HACK_GetLeHandle(Address address) { return pimpl_->le_impl_->HACK_get_handle(address); } void AclManager::HACK_SetScoDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { pimpl_->classic_impl_->HACK_SetScoDisconnectCallback(callback); void AclManager::HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { pimpl_->classic_impl_->HACK_SetNonAclDisconnectCallback(callback); } void AclManager::HACK_SetAclTxPriority(uint8_t handle, bool high_priority) { Loading system/gd/hci/acl_manager.h +2 −2 Original line number Diff line number Diff line Loading @@ -138,8 +138,8 @@ private: virtual uint16_t HACK_GetHandle(const Address address); virtual uint16_t HACK_GetLeHandle(const Address address); // Hack for the shim to get SCO disconnect callback. Shim needs to post to their handler! virtual void HACK_SetScoDisconnectCallback(std::function<void(uint16_t /* handle */, uint8_t /* reason */)>); // Hack for the shim to get non-acl disconnect callback. Shim needs to post to their handler! virtual void HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t /* handle */, uint8_t /* reason */)>); virtual void HACK_SetAclTxPriority(uint8_t handle, bool high_priority); Loading system/gd/hci/acl_manager/classic_impl.h +5 −5 Original line number Diff line number Diff line Loading @@ -136,8 +136,8 @@ struct classic_impl : public security::ISecurityManagerListener { acl_connections_.erase(handle); } else { // This handle is probably for SCO, so we use the callback workaround. if (sco_disconnect_callback_ != nullptr) { sco_disconnect_callback_(handle, static_cast<uint8_t>(reason)); if (non_acl_disconnect_callback_ != nullptr) { non_acl_disconnect_callback_(handle, static_cast<uint8_t>(reason)); } } } Loading Loading @@ -674,8 +674,8 @@ struct classic_impl : public security::ISecurityManagerListener { return 0xFFFF; } void HACK_SetScoDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { sco_disconnect_callback_ = callback; void HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { non_acl_disconnect_callback_ = callback; } HciLayer* hci_layer_ = nullptr; Loading @@ -695,7 +695,7 @@ struct classic_impl : public security::ISecurityManagerListener { std::unique_ptr<security::SecurityManager> security_manager_; bool crash_on_unknown_handle_ = false; std::function<void(uint16_t, uint8_t)> sco_disconnect_callback_; std::function<void(uint16_t, uint8_t)> non_acl_disconnect_callback_; }; } // namespace acl_manager Loading system/gd/hci/acl_manager_mock.h +2 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,8 @@ class MockAclManager : public AclManager { (override)); // PRIVATE TO SHIM MOCK_METHOD(void, HACK_SetScoDisconnectCallback, (std::function<void(uint16_t /* handle */, uint8_t /* reason */)>)); MOCK_METHOD( void, HACK_SetNonAclDisconnectCallback, (std::function<void(uint16_t /* handle */, uint8_t /* reason */)>)); }; } // namespace testing Loading system/main/shim/acl.cc +6 −7 Original line number Diff line number Diff line Loading @@ -1054,10 +1054,15 @@ shim::legacy::Acl::Acl(os::Handler* handler, shim::RegisterDumpsysFunction(static_cast<void*>(this), [this](int fd) { Dump(fd); }); GetAclManager()->HACK_SetScoDisconnectCallback( GetAclManager()->HACK_SetNonAclDisconnectCallback( [this](uint16_t handle, uint8_t reason) { TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle, static_cast<tHCI_REASON>(reason)); // HACKCEPTION! LE ISO connections, just like SCO are not registered in // GD, so ISO can use same hack to get notified about disconnections TRY_POSTING_ON_MAIN(acl_interface_.connection.le.on_iso_disconnected, handle, static_cast<tHCI_REASON>(reason)); }); } Loading Loading @@ -1416,12 +1421,6 @@ bool shim::legacy::Acl::SniffSubrating(uint16_t hci_handle, return false; } void shim::legacy::Acl::HACK_OnScoDisconnected(uint16_t handle, uint8_t reason) { TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle, static_cast<tHCI_REASON>(reason)); } void shim::legacy::Acl::DumpConnectionHistory(int fd) const { pimpl_->DumpConnectionHistory(fd); } Loading Loading
system/gd/hci/acl_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -271,8 +271,8 @@ uint16_t AclManager::HACK_GetLeHandle(Address address) { return pimpl_->le_impl_->HACK_get_handle(address); } void AclManager::HACK_SetScoDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { pimpl_->classic_impl_->HACK_SetScoDisconnectCallback(callback); void AclManager::HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { pimpl_->classic_impl_->HACK_SetNonAclDisconnectCallback(callback); } void AclManager::HACK_SetAclTxPriority(uint8_t handle, bool high_priority) { Loading
system/gd/hci/acl_manager.h +2 −2 Original line number Diff line number Diff line Loading @@ -138,8 +138,8 @@ private: virtual uint16_t HACK_GetHandle(const Address address); virtual uint16_t HACK_GetLeHandle(const Address address); // Hack for the shim to get SCO disconnect callback. Shim needs to post to their handler! virtual void HACK_SetScoDisconnectCallback(std::function<void(uint16_t /* handle */, uint8_t /* reason */)>); // Hack for the shim to get non-acl disconnect callback. Shim needs to post to their handler! virtual void HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t /* handle */, uint8_t /* reason */)>); virtual void HACK_SetAclTxPriority(uint8_t handle, bool high_priority); Loading
system/gd/hci/acl_manager/classic_impl.h +5 −5 Original line number Diff line number Diff line Loading @@ -136,8 +136,8 @@ struct classic_impl : public security::ISecurityManagerListener { acl_connections_.erase(handle); } else { // This handle is probably for SCO, so we use the callback workaround. if (sco_disconnect_callback_ != nullptr) { sco_disconnect_callback_(handle, static_cast<uint8_t>(reason)); if (non_acl_disconnect_callback_ != nullptr) { non_acl_disconnect_callback_(handle, static_cast<uint8_t>(reason)); } } } Loading Loading @@ -674,8 +674,8 @@ struct classic_impl : public security::ISecurityManagerListener { return 0xFFFF; } void HACK_SetScoDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { sco_disconnect_callback_ = callback; void HACK_SetNonAclDisconnectCallback(std::function<void(uint16_t, uint8_t)> callback) { non_acl_disconnect_callback_ = callback; } HciLayer* hci_layer_ = nullptr; Loading @@ -695,7 +695,7 @@ struct classic_impl : public security::ISecurityManagerListener { std::unique_ptr<security::SecurityManager> security_manager_; bool crash_on_unknown_handle_ = false; std::function<void(uint16_t, uint8_t)> sco_disconnect_callback_; std::function<void(uint16_t, uint8_t)> non_acl_disconnect_callback_; }; } // namespace acl_manager Loading
system/gd/hci/acl_manager_mock.h +2 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,8 @@ class MockAclManager : public AclManager { (override)); // PRIVATE TO SHIM MOCK_METHOD(void, HACK_SetScoDisconnectCallback, (std::function<void(uint16_t /* handle */, uint8_t /* reason */)>)); MOCK_METHOD( void, HACK_SetNonAclDisconnectCallback, (std::function<void(uint16_t /* handle */, uint8_t /* reason */)>)); }; } // namespace testing Loading
system/main/shim/acl.cc +6 −7 Original line number Diff line number Diff line Loading @@ -1054,10 +1054,15 @@ shim::legacy::Acl::Acl(os::Handler* handler, shim::RegisterDumpsysFunction(static_cast<void*>(this), [this](int fd) { Dump(fd); }); GetAclManager()->HACK_SetScoDisconnectCallback( GetAclManager()->HACK_SetNonAclDisconnectCallback( [this](uint16_t handle, uint8_t reason) { TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle, static_cast<tHCI_REASON>(reason)); // HACKCEPTION! LE ISO connections, just like SCO are not registered in // GD, so ISO can use same hack to get notified about disconnections TRY_POSTING_ON_MAIN(acl_interface_.connection.le.on_iso_disconnected, handle, static_cast<tHCI_REASON>(reason)); }); } Loading Loading @@ -1416,12 +1421,6 @@ bool shim::legacy::Acl::SniffSubrating(uint16_t hci_handle, return false; } void shim::legacy::Acl::HACK_OnScoDisconnected(uint16_t handle, uint8_t reason) { TRY_POSTING_ON_MAIN(acl_interface_.connection.sco.on_disconnected, handle, static_cast<tHCI_REASON>(reason)); } void shim::legacy::Acl::DumpConnectionHistory(int fd) const { pimpl_->DumpConnectionHistory(fd); } Loading