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

Commit 556fb9b8 authored by Hui Peng's avatar Hui Peng Committed by Automerger Merge Worker
Browse files

Merge "Add implementation of IRedactableLoggable to ConnectAddressWithType"...

Merge "Add implementation of IRedactableLoggable to ConnectAddressWithType" am: 0472b987 am: ca909af5

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2271736



Change-Id: Ib1155e33be06e15777f95a64089a8c712f3bfacc
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 64f7cb2b ca909af5
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <unordered_set>

#include "btif/include/btif_hh.h"
#include "common/interfaces/ILoggable.h"
#include "device/include/controller.h"
#include "gd/common/bidi_queue.h"
#include "gd/common/bind.h"
@@ -76,18 +77,29 @@ bt_status_t do_in_main_thread(const base::Location& from_here,

using namespace bluetooth;

class ConnectAddressWithType {
class ConnectAddressWithType : public bluetooth::common::IRedactableLoggable {
 public:
  explicit ConnectAddressWithType(hci::AddressWithType address_with_type)
      : address_(address_with_type.GetAddress()),
        type_(address_with_type.ToFilterAcceptListAddressType()) {}

  // TODO: remove this method
  std::string const ToString() const {
    std::stringstream ss;
    ss << address_ << "[" << FilterAcceptListAddressTypeText(type_) << "]";
    ss << address_.ToString() << "[" << FilterAcceptListAddressTypeText(type_)
       << "]";
    return ss.str();
  }

  std::string ToStringForLogging() const override {
    return ToString();
  }
  std::string ToRedactedStringForLogging() const override {
    std::stringstream ss;
    ss << address_.ToRedactedStringForLogging() << "["
       << FilterAcceptListAddressTypeText(type_) << "]";
    return ss.str();
  }
  bool operator==(const ConnectAddressWithType& rhs) const {
    return address_ == rhs.address_ && type_ == rhs.type_;
  }