Deprecate ble_v2 in Nearby Sharing

PiperOrigin-RevId: 645522524
This commit is contained in:
Anay Wadhera
2024-06-21 15:43:20 -07:00
committed by Copybara-Service
parent 8ba443c7dc
commit 0ad19f3ce9
2 changed files with 8 additions and 38 deletions
@@ -38,9 +38,6 @@ constexpr auto kDeleteUnexpectedReceivedFile =
// Enable/disable the use of BLE as a connection medium.
constexpr auto kEnableBleForTransfer =
flags::Flag<bool>(kConfigPackage, "45427466", false);
// Disable/Enable BLE v2 in Nearby Sharing SDK.
constexpr auto kEnableBleV2 =
flags::Flag<bool>(kConfigPackage, "45401516", false);
// Enable/disable certificates dump
constexpr auto kEnableCertificatesDump =
flags::Flag<bool>(kConfigPackage, "45409184", false);
@@ -116,7 +113,7 @@ constexpr auto kShowAdminModeWarning =
flags::Flag<bool>(kConfigPackage, "45410558", false);
// Show/hide auto app start setting.
constexpr auto kShowAutoAppStartSetting =
flags::Flag<bool>(kConfigPackage, "45411601", false);
flags::Flag<bool>(kConfigPackage, "45411601", true);
// Enable/disable auto-update on settings page
constexpr auto kShowAutoUpdateSetting =
flags::Flag<bool>(kConfigPackage, "45409033", false);
@@ -137,7 +134,6 @@ inline absl::btree_map<int, const flags::Flag<bool>&> GetBoolFlags() {
return {
{45627826, kDeleteUnexpectedReceivedFile},
{45427466, kEnableBleForTransfer},
{45401516, kEnableBleV2},
{45409184, kEnableCertificatesDump},
{45412090, kEnableComponentsRefactor},
{45415713, kEnableDumpingFeatureFlags},
+7 -33
View File
@@ -231,42 +231,16 @@ void NearbyConnectionsManagerImpl::StartAdvertising(
OnBandwidthChanged(endpoint_id, medium);
};
// Check if BLE hardware supports Extended Advertising
bool extended_advertising_supported =
context_->GetBluetoothAdapter().IsExtendedAdvertisingSupported();
Uuid fast_advertisement_service_uuid;
if (NearbyFlags::GetInstance().GetBoolFlag(
config_package_nearby::nearby_sharing_feature::kEnableBleV2)) {
NL_LOG(INFO) << __func__
<< ": Nearby Sharing flag kEnableBleV2 is enabled.";
// Uses fast advertisement when advertisement data size is less than
// kMinimumAdvertisementSize. Nearby Connections will decide whether to use
// GATT server with this information.
if (endpoint_info.size() > kMinimumAdvertisementSize) {
fast_advertisement_service_uuid = Uuid("");
} else {
fast_advertisement_service_uuid = Uuid(kFastAdvertisementServiceUuid);
}
NL_LOG(INFO) << __func__ << ": Nearby Sharing flag kEnableBleV2 is enabled.";
// Uses fast advertisement when advertisement data size is less than
// kMinimumAdvertisementSize. Nearby Connections will decide whether to use
// GATT server with this information.
if (endpoint_info.size() > kMinimumAdvertisementSize) {
fast_advertisement_service_uuid = Uuid("");
} else {
NL_LOG(INFO) << __func__
<< ": Nearby Sharing flag kEnableBleV2 is disabled.";
// Only use Fast Advertisement if Extended Advertising is not supported
if (extended_advertising_supported) {
// Empty string to instruct Nearby Connection BLE not to use Fast
// Advertisement
fast_advertisement_service_uuid = Uuid("");
} else {
// Handle advertisement on device without BLE advertisement extension.
if (endpoint_info.size() > kMinimumAdvertisementSize) {
// cannot use Fast Advertisement, because the endpoint info size exceeds
// the limitation of Fast Advertisement.
fast_advertisement_service_uuid = Uuid("");
} else {
fast_advertisement_service_uuid = Uuid(kFastAdvertisementServiceUuid);
}
}
fast_advertisement_service_uuid = Uuid(kFastAdvertisementServiceUuid);
}
nearby_connections_service_->StartAdvertising(