diff --git a/connections/implementation/awdl_bwu_handler.cc b/connections/implementation/awdl_bwu_handler.cc index 07152eab..bb832ec5 100644 --- a/connections/implementation/awdl_bwu_handler.cc +++ b/connections/implementation/awdl_bwu_handler.cc @@ -233,7 +233,11 @@ ByteArray AwdlBwuHandler::HandleInitializeUpgradedMediumForEndpoint( << " and service_type: " << service_type << " and has password: " << (password.empty() ? "false" : "true"); - return parser::ForBwuAwdlPathAvailable(service_name, service_type, password); + // The AWDL upgraded medium is running under TLS, so we don't need to + // encryption for it again. + return parser::ForBwuAwdlPathAvailable( + service_name, service_type, password, + /*supports_disabling_encryption=*/true); } void AwdlBwuHandler::HandleRevertInitiatorStateForService( diff --git a/connections/implementation/offline_frames.cc b/connections/implementation/offline_frames.cc index f39bbf9a..277ac3ba 100644 --- a/connections/implementation/offline_frames.cc +++ b/connections/implementation/offline_frames.cc @@ -307,7 +307,8 @@ ByteArray ForBwuWifiLanPathAvailable(const std::string& ip_address, ByteArray ForBwuAwdlPathAvailable(const std::string& service_name, const std::string& service_type, - const std::string& password) { + const std::string& password, + bool supports_disabling_encryption) { OfflineFrame frame; frame.set_version(OfflineFrame::V1); @@ -319,6 +320,8 @@ ByteArray ForBwuAwdlPathAvailable(const std::string& service_name, auto* upgrade_path_info = sub_frame->mutable_upgrade_path_info(); upgrade_path_info->set_medium(UpgradePathInfo::AWDL); upgrade_path_info->set_supports_client_introduction_ack(true); + upgrade_path_info->set_supports_disabling_encryption( + supports_disabling_encryption); auto* awdl_socket = upgrade_path_info->mutable_awdl_credentials(); awdl_socket->set_service_name(service_name); awdl_socket->set_service_type(service_type); diff --git a/connections/implementation/offline_frames.h b/connections/implementation/offline_frames.h index 593b14c4..08c7f414 100644 --- a/connections/implementation/offline_frames.h +++ b/connections/implementation/offline_frames.h @@ -84,7 +84,8 @@ ByteArray ForBwuWifiLanPathAvailable(const std::string& ip_address, std::int32_t port); ByteArray ForBwuAwdlPathAvailable(const std::string& service_name, const std::string& service_type, - const std::string& password); + const std::string& password, + bool supports_disabling_encryption); ByteArray ForBwuWifiAwarePathAvailable(const std::string& service_id, const std::string& service_info, const std::string& password, diff --git a/connections/implementation/offline_frames_test.cc b/connections/implementation/offline_frames_test.cc index b084d81d..c3a0852b 100644 --- a/connections/implementation/offline_frames_test.cc +++ b/connections/implementation/offline_frames_test.cc @@ -447,11 +447,12 @@ TEST(OfflineFramesTest, CanGenerateBwuAwdlPathAvailable) { service_type: "nearby_upgrade" password: "password" > + supports_disabling_encryption: true > > >)pb"; - ByteArray bytes = - ForBwuAwdlPathAvailable("service_name", "nearby_upgrade", "password"); + ByteArray bytes = ForBwuAwdlPathAvailable("service_name", "nearby_upgrade", + "password", true); auto response = FromBytes(bytes); ASSERT_TRUE(response.ok()); OfflineFrame message = response.result();