Don't upgrade bandwidth until the user accepts.

PiperOrigin-RevId: 625488273
This commit is contained in:
Eiden Kim
2024-04-16 16:28:26 -07:00
committed by Copybara-Service
parent c14dfebf60
commit e5279bfd49
+14 -8
View File
@@ -3613,14 +3613,20 @@ void NearbySharingServiceImpl::OnReceivedIntroduction(
return;
}
if (introduction_frame.has_start_transfer() &&
introduction_frame.start_transfer()) {
if (share_target.GetTotalAttachmentsSize() >=
kAttachmentsSizeThresholdOverHighQualityMedium) {
NL_LOG(INFO)
<< __func__
<< ": Upgrade bandwidth when receiving an introduction frame.";
nearby_connections_manager_->UpgradeBandwidth(info->endpoint_id());
// Controls BWU using a flag when receiving an introduction frame, since it
// could be a problem before accepted by a user.
if (!NearbyFlags::GetInstance().GetBoolFlag(
sharing::config_package_nearby::nearby_sharing_feature::
kUpgradeBandwidthAfterAccept)) {
if (introduction_frame.has_start_transfer() &&
introduction_frame.start_transfer()) {
if (share_target.GetTotalAttachmentsSize() >=
kAttachmentsSizeThresholdOverHighQualityMedium) {
NL_LOG(INFO)
<< __func__
<< ": Upgrade bandwidth when receiving an introduction frame.";
nearby_connections_manager_->UpgradeBandwidth(info->endpoint_id());
}
}
}