Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ac734fe authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

LE L2cap security enforcement interface minor fix am: cf1f61c3 am: bf3599ef am: d3715a71

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1546464

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7ef68bcc9e2eff7554f131bb0c5c513fd5fd9658
parents e0fc12f9 d3715a71
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -33,6 +33,20 @@ namespace le {

const ModuleFactory L2capLeModule::Factory = ModuleFactory([]() { return new L2capLeModule(); });

/**
 * A default implementation which cannot satisfy any security level except
 * NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK.
 */
class SecurityEnforcementRejectAllImpl : public SecurityEnforcementInterface {
 public:
  void Enforce(hci::AddressWithType remote, SecurityPolicy policy, ResultCallback result_callback) override {
    if (policy == SecurityPolicy::NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK) {
      result_callback.InvokeIfNotEmpty(true);
    } else {
      result_callback.InvokeIfNotEmpty(false);
    }
  }
};
static SecurityEnforcementRejectAllImpl default_security_module_impl_;

struct L2capLeModule::impl {
+0 −14
Original line number Diff line number Diff line
@@ -40,20 +40,6 @@ class SecurityEnforcementInterface {
  virtual void Enforce(hci::AddressWithType remote, SecurityPolicy policy, ResultCallback result_callback) = 0;
};

/**
 * A default implementation which cannot satisfy any security level except
 * NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK.
 */
class SecurityEnforcementRejectAllImpl : public SecurityEnforcementInterface {
 public:
  void Enforce(hci::AddressWithType remote, SecurityPolicy policy, ResultCallback result_callback) override {
    if (policy == SecurityPolicy::NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK) {
      result_callback.InvokeIfNotEmpty(true);
    } else {
      result_callback.InvokeIfNotEmpty(false);
    }
  }
};
}  // namespace le
}  // namespace l2cap
}  // namespace bluetooth