From 26d5055b13b63b422fc58f3ea8582c4ec277bab7 Mon Sep 17 00:00:00 2001 From: Anay Wadhera Date: Sat, 3 Aug 2024 11:07:20 -0700 Subject: [PATCH] Deprecate flag kIgnoreUpgradePathAvailableFrameForAdvertiser PiperOrigin-RevId: 659123571 --- connections/implementation/bwu_manager.cc | 5 +--- .../implementation/bwu_manager_test.cc | 29 ++----------------- .../flags/nearby_connections_feature_flags.h | 4 --- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/connections/implementation/bwu_manager.cc b/connections/implementation/bwu_manager.cc index 19b67930..6facce46 100644 --- a/connections/implementation/bwu_manager.cc +++ b/connections/implementation/bwu_manager.cc @@ -718,10 +718,7 @@ void BwuManager::ProcessBwuPathAvailableEvent( return; } - if (NearbyFlags::GetInstance().GetBoolFlag( - config_package_nearby::nearby_connections_feature:: - kIgnoreUpgradePathAvailableFrameForAdvertiser) && - client->IsIncomingConnection(endpoint_id)) { + if (client->IsIncomingConnection(endpoint_id)) { NEARBY_LOGS(INFO) << "ProcessBandwidthUpgradePathAvailableEvent ignored by Advertiser"; return; diff --git a/connections/implementation/bwu_manager_test.cc b/connections/implementation/bwu_manager_test.cc index d1210123..347ef579 100644 --- a/connections/implementation/bwu_manager_test.cc +++ b/connections/implementation/bwu_manager_test.cc @@ -1002,12 +1002,6 @@ TEST_F(BwuManagerTest, BlockBwuFrameBeforeAccept) { } TEST_F(BwuManagerTest, BlockBwuFrameFromAdvertiser) { - NearbyFlags::GetInstance().OverrideBoolFlagValue( - config_package_nearby::nearby_connections_feature:: - kIgnoreUpgradePathAvailableFrameForAdvertiser, - false); - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - ExceptionOr hotspot_path_available_frame = parser::FromBytes(parser::ForBwuWifiHotspotPathAvailable( /*ssid=*/"Direct-357a2d8c", /*password=*/"b592f7d3", @@ -1019,6 +1013,8 @@ TEST_F(BwuManagerTest, BlockBwuFrameFromAdvertiser) { sub_frame->set_event_type( BandwidthUpgradeNegotiationFrame::UPGRADE_PATH_AVAILABLE); auto* upgrade_path_info = sub_frame->mutable_upgrade_path_info(); + upgrade_path_info->set_supports_client_introduction_ack(false); + upgrade_path_info->set_supports_disabling_encryption(true); ConnectionResponseInfo response_info{ .remote_endpoint_info = ByteArray{"endpoint_name"}, @@ -1027,28 +1023,7 @@ TEST_F(BwuManagerTest, BlockBwuFrameFromAdvertiser) { .is_incoming_connection = true, }; ConnectionOptions connection_options; - client_.OnConnectionInitiated(std::string(kEndpointId1), response_info, - connection_options, {}, "token"); - client_.LocalEndpointAcceptedConnection(std::string(kEndpointId1), {}); - client_.RemoteEndpointAcceptedConnection(std::string(kEndpointId1)); - EXPECT_TRUE(client_.IsConnectionAccepted(std::string(kEndpointId1))); - client_.OnConnectionAccepted(std::string(kEndpointId1)); - EXPECT_TRUE(client_.IsConnectedToEndpoint(std::string(kEndpointId1))); - upgrade_path_info->set_supports_client_introduction_ack(false); - upgrade_path_info->set_supports_disabling_encryption(true); - bwu_manager_->OnIncomingFrame(frame, std::string(kEndpointId1), &client_, - Medium::BLUETOOTH, packet_meta_data_); - CountDownLatch latch(1); - // The BWU frame should not be drop, so the IsUpgradeOngoing should not be - // empty. - ASSERT_EQ(bwu_manager_->IsUpgradeOngoing(std::string(kEndpointId1)), true); - UnRegisterChannelForEndpoint(kEndpointId1); - - NearbyFlags::GetInstance().OverrideBoolFlagValue( - config_package_nearby::nearby_connections_feature:: - kIgnoreUpgradePathAvailableFrameForAdvertiser, - true); CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); client_.OnConnectionInitiated(std::string(kEndpointId2), response_info, diff --git a/connections/implementation/flags/nearby_connections_feature_flags.h b/connections/implementation/flags/nearby_connections_feature_flags.h index 2ee628a6..55f35217 100644 --- a/connections/implementation/flags/nearby_connections_feature_flags.h +++ b/connections/implementation/flags/nearby_connections_feature_flags.h @@ -74,10 +74,6 @@ constexpr auto kCheckIllegalCharacters = constexpr auto kEnableMultiplex = flags::Flag(kConfigPackage, "45627836", false); -// When true, allows to ignore the upgrade path available frame for advertiser. -constexpr auto kIgnoreUpgradePathAvailableFrameForAdvertiser = - flags::Flag(kConfigPackage, "45633895", false); - // When true, use the medium in connection info. constexpr auto kUseMediumInConnectionInfo = flags::Flag(kConfigPackage, "45635058", false);