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

Commit df628c99 authored by Palash Ahuja's avatar Palash Ahuja
Browse files

BluetoothMetrics: Log User Confirmation Response

Test: m com.android.btservices and statsd_testdrive
Bug: 345564021
Flag: EXEMPT, metrics related changes
Change-Id: I7dd378576e4b4d0759f1a895bc23b598f5fcef1c
parent 64e96d8a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include "common/audit_log.h"
#include "common/strings.h"
#include "metrics/bluetooth_event.h"
#include "os/metrics.h"
#include "storage/device.h"

@@ -911,6 +912,7 @@ void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_vi
      log::assert_that(user_confirmation_request_reply.IsValid(),
                       "assert failed: user_confirmation_request_reply.IsValid()");
      address = user_confirmation_request_reply.GetBdAddr();
      bluetooth::metrics::LogUserConfirmationRequestResponse(address, true);
      break;
    }
    case OpCode::USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY: {
@@ -919,6 +921,7 @@ void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_vi
      log::assert_that(user_confirmation_request_negative_reply.IsValid(),
                       "assert failed: user_confirmation_request_negative_reply.IsValid()");
      address = user_confirmation_request_negative_reply.GetBdAddr();
      bluetooth::metrics::LogUserConfirmationRequestResponse(address, false);
      break;
    }
    case OpCode::USER_PASSKEY_REQUEST_REPLY: {
@@ -927,6 +930,7 @@ void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_vi
      log::assert_that(user_passkey_request_reply.IsValid(),
                       "assert failed: user_passkey_request_reply.IsValid()");
      address = user_passkey_request_reply.GetBdAddr();
      bluetooth::metrics::LogUserConfirmationRequestResponse(address, true);
      break;
    }
    case OpCode::USER_PASSKEY_REQUEST_NEGATIVE_REPLY: {
@@ -935,6 +939,7 @@ void log_classic_pairing_command_status(std::unique_ptr<CommandView>& command_vi
      log::assert_that(user_passkey_request_negative_reply.IsValid(),
                       "assert failed: user_passkey_request_negative_reply.IsValid()");
      address = user_passkey_request_negative_reply.GetBdAddr();
      bluetooth::metrics::LogUserConfirmationRequestResponse(address, false);
      break;
    }
    case OpCode::REMOTE_OOB_DATA_REQUEST_REPLY: {
+5 −0
Original line number Diff line number Diff line
@@ -82,5 +82,10 @@ void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS sta
  }
}

void LogUserConfirmationRequestResponse(const hci::Address& address, bool positive) {
  bluetooth::os::LogMetricBluetoothEvent(address, EventType::USER_CONF_REQUEST,
                                         positive ? State::SUCCESS : State::FAIL);
}

}  // namespace metrics
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -30,5 +30,7 @@ void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason,

void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status);

void LogUserConfirmationRequestResponse(const hci::Address& address, bool positive);

}  // namespace metrics
}  // namespace bluetooth