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

Commit 9d6fb3fd authored by Martin Brabham's avatar Martin Brabham Committed by Automerger Merge Worker
Browse files

Add in metrics calls am: 91b3ea5c am: 0ed85a4e am: 6e3f1524

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

Change-Id: I41b940e3f4e808ec5f2fa835e1526dfe9658fc0a
parents 2e81558b 6e3f1524
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <mutex>

#include "common/metric_id_allocator.h"
#include "common/time_util.h"
#include "device/include/controller.h"
#include "gd/common/callback.h"
@@ -36,6 +37,8 @@
#include "stack/btm/btm_int_types.h"
#include "types/raw_address.h"

using bluetooth::common::MetricIdAllocator;

#define BTIF_DM_DEFAULT_INQ_MAX_RESULTS 0
#define BTIF_DM_DEFAULT_INQ_MAX_DURATION 10

@@ -429,12 +432,21 @@ class ShimBondListener : public bluetooth::security::ISecurityManagerListener {
            bluetooth::ToRawAddress(device.GetAddress()), 0, name, BTM_SUCCESS);
      }
    }
    MetricIdAllocator::GetInstance().AllocateId(
        bluetooth::ToRawAddress(device.GetAddress()));
    if (!MetricIdAllocator::GetInstance().SaveDevice(
            bluetooth::ToRawAddress(device.GetAddress()))) {
      LOG(FATAL) << __func__ << ": Fail to save metric id for device "
                 << bluetooth::ToRawAddress(device.GetAddress());
    }
  }

  void OnDeviceUnbonded(bluetooth::hci::AddressWithType device) override {
    if (bta_callbacks_->p_bond_cancel_cmpl_callback) {
      (*bta_callbacks_->p_bond_cancel_cmpl_callback)(BTM_SUCCESS);
    }
    MetricIdAllocator::GetInstance().ForgetDevice(
        bluetooth::ToRawAddress(device.GetAddress()));
  }

  void OnDeviceBondFailed(bluetooth::hci::AddressWithType device) override {