Commit 10f20608 authored by James Vecore's avatar James Vecore Committed by Chromium LUCI CQ

[Nearby] Add logging for bt mac address retrieval

Adds some additional logging for the Bluetooth mac address when
sending a file to understand what is causing nearby connections to skip
a BT classic connection attempt.

Bug: b:177697070
Change-Id: Ife98ad3a60680f22620186049c917781dc0596b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2639296
Auto-Submit: James Vecore <vecore@google.com>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845157}
parent e3718cf9
...@@ -3483,20 +3483,34 @@ base::Optional<std::vector<uint8_t>> ...@@ -3483,20 +3483,34 @@ base::Optional<std::vector<uint8_t>>
NearbySharingServiceImpl::GetBluetoothMacAddress( NearbySharingServiceImpl::GetBluetoothMacAddress(
const ShareTarget& share_target) { const ShareTarget& share_target) {
ShareTargetInfo* info = GetShareTargetInfo(share_target); ShareTargetInfo* info = GetShareTargetInfo(share_target);
if (!info) if (!info) {
NS_LOG(ERROR) << __func__ << ": No ShareTargetInfo found for "
<< "share target id: " << share_target.id;
return base::nullopt; return base::nullopt;
}
const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate = const base::Optional<NearbyShareDecryptedPublicCertificate>& certificate =
info->certificate(); info->certificate();
if (!certificate || if (!certificate) {
!certificate->unencrypted_metadata().has_bluetooth_mac_address()) { NS_LOG(ERROR) << __func__ << ": No decrypted public certificate found for "
<< "share target id: " << share_target.id;
return base::nullopt;
}
if (!certificate->unencrypted_metadata().has_bluetooth_mac_address()) {
NS_LOG(WARNING) << __func__ << ": Public certificate "
<< base::HexEncode(certificate->id()) << " did not contain "
<< "a Bluetooth mac address.";
return base::nullopt; return base::nullopt;
} }
std::string mac_address = std::string mac_address =
certificate->unencrypted_metadata().bluetooth_mac_address(); certificate->unencrypted_metadata().bluetooth_mac_address();
if (mac_address.size() != 6) if (mac_address.size() != 6) {
NS_LOG(ERROR) << __func__ << ": Invalid bluetooth mac address: '"
<< mac_address << "'";
return base::nullopt; return base::nullopt;
}
return std::vector<uint8_t>(mac_address.begin(), mac_address.end()); return std::vector<uint8_t>(mac_address.begin(), mac_address.end());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment