Merge "Move ISecurityManagerListener out of internal namespace"
diff --git a/gd/security/internal/security_manager_impl.cc b/gd/security/internal/security_manager_impl.cc
index 21d8151..7b886f5 100644
--- a/gd/security/internal/security_manager_impl.cc
+++ b/gd/security/internal/security_manager_impl.cc
@@ -22,10 +22,12 @@
#include "os/log.h"
#include "security/pairing/classic_pairing_handler.h"
+#include "security/security_manager.h"
using namespace bluetooth::security::internal;
using bluetooth::hci::Device;
using bluetooth::hci::DeviceType;
+using bluetooth::security::ISecurityManagerListener;
using bluetooth::security::pairing::PairingHandler;
namespace {
diff --git a/gd/security/internal/security_manager_impl.h b/gd/security/internal/security_manager_impl.h
index 13d66b9..1e17770 100644
--- a/gd/security/internal/security_manager_impl.h
+++ b/gd/security/internal/security_manager_impl.h
@@ -24,44 +24,11 @@
namespace bluetooth {
namespace security {
+
+class ISecurityManagerListener;
+
namespace internal {
-/**
- * Interface for listening to the channel for SMP commands.
- */
-class ISecurityManagerListener {
- public:
- ISecurityManagerListener(os::Handler* handler) : handler_(handler) {}
- virtual ~ISecurityManagerListener() = default;
-
- /**
- * Called when a device is successfully bonded.
- *
- * @param device pointer to the bonded device
- */
- virtual void OnDeviceBonded(std::shared_ptr<bluetooth::hci::Device> device);
-
- /**
- * Called when a device is successfully un-bonded.
- *
- * @param device pointer to the device that is no longer bonded
- */
- virtual void OnDeviceUnbonded(std::shared_ptr<bluetooth::hci::Device> device);
-
- /**
- * Called as a result of a failure during the bonding process.
- *
- * @param device pointer to the device that is no longer bonded
- */
- virtual void OnDeviceBondFailed(std::shared_ptr<bluetooth::hci::Device> device);
-
- bool operator==(const ISecurityManagerListener& rhs) const {
- return &*this == &rhs;
- }
-
- os::Handler* handler_ = nullptr;
-};
-
class SecurityManagerImpl /*: public channel::ISecurityManagerChannelListener*/ {
public:
explicit SecurityManagerImpl(os::Handler* security_handler, l2cap::le::L2capLeModule* l2cap_le_module,
diff --git a/gd/security/security_manager.cc b/gd/security/security_manager.cc
index 9a7df85..da2b30b 100644
--- a/gd/security/security_manager.cc
+++ b/gd/security/security_manager.cc
@@ -44,14 +44,14 @@
std::forward<std::shared_ptr<hci::ClassicDevice>>(device)));
}
-void SecurityManager::RegisterCallbackListener(internal::ISecurityManagerListener* listener) {
+void SecurityManager::RegisterCallbackListener(ISecurityManagerListener* listener) {
security_handler_->Post(common::BindOnce(&internal::SecurityManagerImpl::RegisterCallbackListener,
common::Unretained(security_manager_impl_),
- std::forward<internal::ISecurityManagerListener*>(listener)));
+ std::forward<ISecurityManagerListener*>(listener)));
}
-void SecurityManager::UnregisterCallbackListener(internal::ISecurityManagerListener* listener) {
+void SecurityManager::UnregisterCallbackListener(ISecurityManagerListener* listener) {
security_handler_->Post(common::BindOnce(&internal::SecurityManagerImpl::UnregisterCallbackListener,
common::Unretained(security_manager_impl_),
- std::forward<internal::ISecurityManagerListener*>(listener)));
+ std::forward<ISecurityManagerListener*>(listener)));
}
diff --git a/gd/security/security_manager.h b/gd/security/security_manager.h
index bc09c00..6ccdd6e 100644
--- a/gd/security/security_manager.h
+++ b/gd/security/security_manager.h
@@ -29,6 +29,42 @@
namespace security {
/**
+ * Callback interface from SecurityManager.
+ */
+class ISecurityManagerListener {
+ public:
+ ISecurityManagerListener(os::Handler* handler) : handler_(handler) {}
+ virtual ~ISecurityManagerListener() = default;
+
+ /**
+ * Called when a device is successfully bonded.
+ *
+ * @param device pointer to the bonded device
+ */
+ virtual void OnDeviceBonded(std::shared_ptr<bluetooth::hci::Device> device);
+
+ /**
+ * Called when a device is successfully un-bonded.
+ *
+ * @param device pointer to the device that is no longer bonded
+ */
+ virtual void OnDeviceUnbonded(std::shared_ptr<bluetooth::hci::Device> device);
+
+ /**
+ * Called as a result of a failure during the bonding process.
+ *
+ * @param device pointer to the device that is no longer bonded
+ */
+ virtual void OnDeviceBondFailed(std::shared_ptr<bluetooth::hci::Device> device);
+
+ bool operator==(const ISecurityManagerListener& rhs) const {
+ return &*this == &rhs;
+ }
+
+ os::Handler* handler_ = nullptr;
+};
+
+/**
* Manages the security attributes, pairing, bonding of devices, and the
* encryption/decryption of communications.
*/
@@ -67,14 +103,14 @@
*
* @param listener ISecurityManagerListener instance to handle callbacks
*/
- void RegisterCallbackListener(internal::ISecurityManagerListener* listener);
+ void RegisterCallbackListener(ISecurityManagerListener* listener);
/**
* Unregister listener for callback events from SecurityManager
*
* @param listener ISecurityManagerListener instance to unregister
*/
- void UnregisterCallbackListener(internal::ISecurityManagerListener* listener);
+ void UnregisterCallbackListener(ISecurityManagerListener* listener);
protected:
SecurityManager(os::Handler* security_handler, internal::SecurityManagerImpl* security_manager_impl)