diff --git a/connections/connection_options.h b/connections/connection_options.h index 8d09e755..7132aed4 100644 --- a/connections/connection_options.h +++ b/connections/connection_options.h @@ -37,8 +37,6 @@ struct ConnectionInfo { std::int32_t keep_alive_interval_millis; std::int32_t keep_alive_timeout_millis; std::optional medium_role; - std::vector - supported_wifi_direct_auth_types; }; // Connection Options: used for both Advertising and Discovery. diff --git a/connections/implementation/base_pcp_handler.cc b/connections/implementation/base_pcp_handler.cc index 00a1e2b9..ba1a6247 100644 --- a/connections/implementation/base_pcp_handler.cc +++ b/connections/implementation/base_pcp_handler.cc @@ -29,7 +29,6 @@ #include "absl/container/flat_hash_set.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" -#include "absl/strings/str_join.h" #include "absl/strings/string_view.h" #include "absl/time/time.h" #include "absl/types/span.h" @@ -112,7 +111,6 @@ using ::location::nearby::connections::OsInfo; using ::location::nearby::connections::PresenceDevice; using ::location::nearby::connections::V1Frame; using ::location::nearby::proto::connections::OperationResultCode; -using ::location::nearby::proto::connections::WifiDirectAuthType; using ::securegcm::UKey2Handshake; BasePcpHandler::BasePcpHandler(Mediums* mediums, @@ -437,52 +435,6 @@ BooleanMediumSelector BasePcpHandler::ComputeIntersectionOfSupportedMediums( continue; } } - if (my_medium == - location::nearby::proto::connections::Medium::WIFI_DIRECT) { - auto remote_supported_wifi_direct_auth_types = - pending_connection_info.connection_options.connection_info - .supported_wifi_direct_auth_types; - LOG(INFO) << "Remote supported WifiDirect auth types: " - << absl::StrJoin( - remote_supported_wifi_direct_auth_types, ", ", - [](std::string* out, int auth_type) { - absl::StrAppend( - out, - WifiDirectAuthType_Name( - static_cast(auth_type))); - }); - auto local_supported_wifi_direct_auth_types = - mediums_->GetWifiDirect().GetSupportedWifiDirectAuthTypes(); - LOG(INFO) << "Local supported WifiDirect auth types: " - << absl::StrJoin( - local_supported_wifi_direct_auth_types, ", ", - [](std::string* out, int auth_type) { - absl::StrAppend( - out, - WifiDirectAuthType_Name( - static_cast(auth_type))); - }); - bool found_common_auth_type = false; - for (const auto& auth_type : local_supported_wifi_direct_auth_types) { - if (auth_type == WifiDirectAuthType::WIFI_DIRECT_TYPE_UNKNOWN) { - continue; - } - if (std::find(remote_supported_wifi_direct_auth_types.begin(), - remote_supported_wifi_direct_auth_types.end(), - auth_type) != - remote_supported_wifi_direct_auth_types.end()) { - LOG(INFO) << "Found common WifiDirect auth type: " - << WifiDirectAuthType_Name(auth_type); - mediums_->GetWifiDirect().SetPreferredWifiDirectAuthType(auth_type); - found_common_auth_type = true; - break; - } - } - if (!found_common_auth_type) { - LOG(INFO) << "No common WifiDirect auth type found, skip WifiDirect."; - continue; - } - } intersection.emplace(my_medium); } @@ -887,17 +839,6 @@ ConnectionInfo BasePcpHandler::FillConnectionInfo( } connection_info.supported_mediums = GetSupportedConnectionMediumsByPriority(connection_options); - if (NearbyFlags::GetInstance().GetBoolFlag( - config_package_nearby::nearby_connections_feature:: - kEnableWifiDirect)) { - connection_info.supported_wifi_direct_auth_types = - mediums_->GetWifiDirect().GetSupportedWifiDirectAuthTypes(); - VLOG(1) << "Set SupportedWifiDirectAuthTypes for WIFI_DIRECT: " - << absl::StrJoin(connection_info.supported_wifi_direct_auth_types, - ","); - } else { - connection_info.supported_wifi_direct_auth_types = {}; - } if (!NearbyFlags::GetInstance().GetBoolFlag( config_package_nearby::nearby_connections_feature:: @@ -2115,20 +2056,6 @@ Exception BasePcpHandler::OnIncomingConnection( << absl::BytesToHexString(connection_info.ip_address) << "; has no mediumRole"; } - connection_info.supported_wifi_direct_auth_types = - parser::MediumMetadataWFDAuthTypesToWFDAuthTypes(medium_metadata); - if (!connection_info.supported_wifi_direct_auth_types.empty()) { - LOG(INFO) << connection_request.endpoint_id() - << "'s supported WifiDirect auth types: " - << absl::StrJoin( - connection_info.supported_wifi_direct_auth_types, ", ", - [](std::string* out, int auth_type) { - absl::StrAppend( - out, - WifiDirectAuthType_Name( - static_cast(auth_type))); - }); - } // We've successfully connected to the device, and are now about to jump on to // the EncryptionRunner thread to start running our encryption protocol. We'll diff --git a/connections/implementation/mediums/wifi_direct.cc b/connections/implementation/mediums/wifi_direct.cc index 0bae2e66..874f9031 100644 --- a/connections/implementation/mediums/wifi_direct.cc +++ b/connections/implementation/mediums/wifi_direct.cc @@ -14,10 +14,8 @@ #include "connections/implementation/mediums/wifi_direct.h" -#include #include #include -#include #include "absl/strings/string_view.h" #include "internal/platform/cancellation_flag.h" @@ -33,13 +31,6 @@ namespace { using ::location::nearby::proto::connections::OperationResultCode; } // namespace -WifiDirect::WifiDirect() : is_go_started_(false), is_connected_to_go_(false) { - supported_wifi_direct_auth_types_ = medium_.GetSupportedWifiDirectAuthTypes(); - if (!supported_wifi_direct_auth_types_.empty()) { - preferred_wifi_direct_auth_type_ = - supported_wifi_direct_auth_types_.front(); - } -} WifiDirect::~WifiDirect() { while (!server_sockets_.empty()) { StopAcceptingConnections(server_sockets_.begin()->first); @@ -297,15 +288,5 @@ ErrorOr WifiDirect::Connect( return socket; } -bool WifiDirect::SetPreferredWifiDirectAuthType(WifiDirectAuthType auth_type) { - if (std::find(supported_wifi_direct_auth_types_.begin(), - supported_wifi_direct_auth_types_.end(), - auth_type) == supported_wifi_direct_auth_types_.end()) { - return false; - } - preferred_wifi_direct_auth_type_ = auth_type; - return true; -} - } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/wifi_direct.h b/connections/implementation/mediums/wifi_direct.h index e85d2e64..df2849b6 100644 --- a/connections/implementation/mediums/wifi_direct.h +++ b/connections/implementation/mediums/wifi_direct.h @@ -16,7 +16,6 @@ #define CORE_INTERNAL_MEDIUMS_WIFI_DIRECT_H_ #include -#include #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" @@ -37,10 +36,8 @@ class WifiDirect { // Callback that is invoked when a new connection is accepted. using AcceptedConnectionCallback = absl::AnyInvocable; - using WifiDirectAuthType = - ::location::nearby::proto::connections::WifiDirectAuthType; - WifiDirect(); + WifiDirect() : is_go_started_(false), is_connected_to_go_(false) {} ~WifiDirect(); // Not copyable or movable WifiDirect(const WifiDirect&) = delete; @@ -97,19 +94,6 @@ class WifiDirect { WifiDirectCredentials* GetCredentials(absl::string_view service_id) ABSL_LOCKS_EXCLUDED(mutex_); - // Returns the supported WifiDirect auth types. - std::vector GetSupportedWifiDirectAuthTypes() { - return supported_wifi_direct_auth_types_; - } - - // Returns the preferred WifiDirect auth type. - WifiDirectAuthType GetPreferredWifiDirectAuthType() { - return preferred_wifi_direct_auth_type_; - } - - // Sets the preferred WifiDirect auth type. - bool SetPreferredWifiDirectAuthType(WifiDirectAuthType auth_type); - private: mutable Mutex mutex_; static constexpr int kMaxConcurrentAcceptLoops = 5; @@ -134,10 +118,6 @@ class WifiDirect { // used from accept_loops_runner_, and thus require pointer stability. absl::flat_hash_map server_sockets_ ABSL_GUARDED_BY(mutex_); - // The supported WifiDirect auth types. - std::vector supported_wifi_direct_auth_types_; - WifiDirectAuthType preferred_wifi_direct_auth_type_ = - WifiDirectAuthType::WIFI_DIRECT_TYPE_UNKNOWN; }; } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/wifi_direct_test.cc b/connections/implementation/mediums/wifi_direct_test.cc index 358df01a..930f3df1 100644 --- a/connections/implementation/mediums/wifi_direct_test.cc +++ b/connections/implementation/mediums/wifi_direct_test.cc @@ -190,40 +190,6 @@ TEST_F(WifiDirectTest, CanStartGOTheOtherFailConnect) { EXPECT_TRUE(wifi_direct_a.StopWifiDirect()); } -TEST_F(WifiDirectTest, GetSupportedWifiDirectAuthTypes) { - WifiDirect wifi_direct; - auto supported_types = wifi_direct.GetSupportedWifiDirectAuthTypes(); - EXPECT_EQ(supported_types.size(), 1); - EXPECT_EQ(supported_types[0], - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); -} - -TEST_F(WifiDirectTest, GetPreferredWifiDirectAuthType_Default) { - WifiDirect wifi_direct; - // Default should be the first supported type, which is WIFI_DIRECT_WITH_PIN - EXPECT_EQ(wifi_direct.GetPreferredWifiDirectAuthType(), - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); -} - -TEST_F(WifiDirectTest, SetPreferredWifiDirectAuthType_Supported) { - WifiDirect wifi_direct; - // Attempt to set the preferred type to the already default/supported type. - EXPECT_TRUE(wifi_direct.SetPreferredWifiDirectAuthType( - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PIN)); - EXPECT_EQ(wifi_direct.GetPreferredWifiDirectAuthType(), - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); -} - -TEST_F(WifiDirectTest, SetPreferredWifiDirectAuthType_Unsupported) { - WifiDirect wifi_direct; - // Attempt to set an unsupported type. - EXPECT_FALSE(wifi_direct.SetPreferredWifiDirectAuthType( - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD)); - // Preferred type should remain the default. - EXPECT_EQ(wifi_direct.GetPreferredWifiDirectAuthType(), - WifiDirect::WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); -} - } // namespace } // namespace connections } // namespace nearby diff --git a/connections/implementation/offline_frames.cc b/connections/implementation/offline_frames.cc index 31611d69..1168a5cc 100644 --- a/connections/implementation/offline_frames.cc +++ b/connections/implementation/offline_frames.cc @@ -86,7 +86,7 @@ V1Frame::FrameType GetFrameType(const OfflineFrame& frame) { ByteArray ForConnectionRequestConnections( const location::nearby::connections::ConnectionsDevice& proto_connections_device, - const ConnectionInfo& connection_info) { + const ConnectionInfo& conection_info) { OfflineFrame frame; frame.set_version(OfflineFrame::V1); @@ -97,49 +97,42 @@ ByteArray ForConnectionRequestConnections( connection_request->mutable_connections_device()->MergeFrom( proto_connections_device); } - if (!connection_info.local_endpoint_id.empty()) { - connection_request->set_endpoint_id(connection_info.local_endpoint_id); + if (!conection_info.local_endpoint_id.empty()) { + connection_request->set_endpoint_id(conection_info.local_endpoint_id); } - if (!connection_info.local_endpoint_info.Empty()) { + if (!conection_info.local_endpoint_info.Empty()) { connection_request->set_endpoint_name( - connection_info.local_endpoint_info.string_data()); + conection_info.local_endpoint_info.string_data()); connection_request->set_endpoint_info( - connection_info.local_endpoint_info.string_data()); + conection_info.local_endpoint_info.string_data()); } - connection_request->set_nonce(connection_info.nonce); + connection_request->set_nonce(conection_info.nonce); auto* medium_metadata = connection_request->mutable_medium_metadata(); - medium_metadata->set_supports_5_ghz(connection_info.supports_5_ghz); - if (!connection_info.bssid.empty()) - medium_metadata->set_bssid(connection_info.bssid); - medium_metadata->set_ap_frequency(connection_info.ap_frequency); - if (!connection_info.ip_address.empty()) - medium_metadata->set_ip_address(connection_info.ip_address); + medium_metadata->set_supports_5_ghz(conection_info.supports_5_ghz); + if (!conection_info.bssid.empty()) + medium_metadata->set_bssid(conection_info.bssid); + medium_metadata->set_ap_frequency(conection_info.ap_frequency); + if (!conection_info.ip_address.empty()) + medium_metadata->set_ip_address(conection_info.ip_address); if (NearbyFlags::GetInstance().GetBoolFlag( config_package_nearby::nearby_connections_feature:: kEnableDynamicRoleSwitch) && - connection_info.medium_role.has_value()) { + conection_info.medium_role.has_value()) { medium_metadata->mutable_medium_role()->MergeFrom( - connection_info.medium_role.value()); + conection_info.medium_role.value()); } - if (!connection_info.supported_wifi_direct_auth_types.empty()) { - for (const auto& auth_type : - connection_info.supported_wifi_direct_auth_types) { - medium_metadata->add_supported_wifi_direct_auth_types( - WFDAuthTypeToMediumMetadataWFDAuthType(auth_type)); - } - } - if (!connection_info.supported_mediums.empty()) { - for (const auto& medium : connection_info.supported_mediums) { + if (!conection_info.supported_mediums.empty()) { + for (const auto& medium : conection_info.supported_mediums) { connection_request->add_mediums(MediumToConnectionRequestMedium(medium)); } } - if (connection_info.keep_alive_interval_millis > 0) { + if (conection_info.keep_alive_interval_millis > 0) { connection_request->set_keep_alive_interval_millis( - connection_info.keep_alive_interval_millis); + conection_info.keep_alive_interval_millis); } - if (connection_info.keep_alive_timeout_millis > 0) { + if (conection_info.keep_alive_timeout_millis > 0) { connection_request->set_keep_alive_timeout_millis( - connection_info.keep_alive_timeout_millis); + conection_info.keep_alive_timeout_millis); } return ToBytes(std::move(frame)); @@ -371,11 +364,14 @@ ByteArray ForBwuWifiAwarePathAvailable(const std::string& service_id, return ToBytes(std::move(frame)); } -ByteArray ForBwuWifiDirectPathAvailable( - const std::string& ssid, const std::string& password, std::int32_t port, - std::int32_t frequency, bool supports_disabling_encryption, - const std::string& gateway, const std::string& service_name, - const std::string& pin) { +ByteArray ForBwuWifiDirectPathAvailable(const std::string& ssid, + const std::string& password, + std::int32_t port, + std::int32_t frequency, + bool supports_disabling_encryption, + const std::string& gateway, + const std::string& service_name, + const std::string& pin) { OfflineFrame frame; frame.set_version(OfflineFrame::V1); @@ -739,44 +735,6 @@ std::vector ConnectionRequestMediumsToMediums( return result; } -MediumMetadata::WifiDirectAuthType WFDAuthTypeToMediumMetadataWFDAuthType( - WifiDirectAuthType wifi_direct_auth_type) { - switch (wifi_direct_auth_type) { - case WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD: - return MediumMetadata::WIFI_DIRECT_WITH_PASSWORD; - case WifiDirectAuthType::WIFI_DIRECT_WITH_PIN: - return MediumMetadata::WIFI_DIRECT_WITH_PIN; - default: - return MediumMetadata::WIFI_DIRECT_TYPE_UNKNOWN; - } -} - -WifiDirectAuthType MediumMetadataWFDAuthTypeToWFDAuthType( - MediumMetadata::WifiDirectAuthType wifi_direct_auth_type) { - switch (wifi_direct_auth_type) { - case MediumMetadata::WIFI_DIRECT_WITH_PASSWORD: - return WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD; - case MediumMetadata::WIFI_DIRECT_WITH_PIN: - return WifiDirectAuthType::WIFI_DIRECT_WITH_PIN; - default: - return WifiDirectAuthType::WIFI_DIRECT_TYPE_UNKNOWN; - } -} - -std::vector MediumMetadataWFDAuthTypesToWFDAuthTypes( - const MediumMetadata& medium_metadata) { - std::vector result; - for (const auto& int_wifi_direct_auth_type : - medium_metadata.supported_wifi_direct_auth_types()) { - // The int_wifi_direct_auth_type is guaranteed to be a valid - // MediumMetadata::WifiDirectAuthType by the proto spec. - result.push_back(MediumMetadataWFDAuthTypeToWFDAuthType( - static_cast( - int_wifi_direct_auth_type))); - } - return result; -} - } // namespace parser } // namespace connections } // namespace nearby diff --git a/connections/implementation/offline_frames.h b/connections/implementation/offline_frames.h index 0114d83f..bbf15dbe 100644 --- a/connections/implementation/offline_frames.h +++ b/connections/implementation/offline_frames.h @@ -32,9 +32,6 @@ namespace parser { using UpgradePathInfo = ::location::nearby::connections:: BandwidthUpgradeNegotiationFrame::UpgradePathInfo; -using MediumMetadata = ::location::nearby::connections::MediumMetadata; -using WifiDirectAuthType = - ::location::nearby::proto::connections::WifiDirectAuthType; // Serialize/Deserialize Nearby Connections Protocol messages. @@ -128,12 +125,7 @@ Medium ConnectionRequestMediumToMedium( std::vector ConnectionRequestMediumsToMediums( const location::nearby::connections::ConnectionRequestFrame& connection_request_frame); -MediumMetadata::WifiDirectAuthType WFDAuthTypeToMediumMetadataWFDAuthType( - WifiDirectAuthType wifi_direct_auth_type); -WifiDirectAuthType MediumMetadataWFDAuthTypeToWFDAuthType( - MediumMetadata::WifiDirectAuthType wifi_direct_auth_type); -std::vector MediumMetadataWFDAuthTypesToWFDAuthTypes( - const MediumMetadata& medium_metadata); + } // namespace parser } // namespace connections } // namespace nearby diff --git a/connections/implementation/offline_frames_test.cc b/connections/implementation/offline_frames_test.cc index 4f039d41..9ec2377e 100644 --- a/connections/implementation/offline_frames_test.cc +++ b/connections/implementation/offline_frames_test.cc @@ -42,12 +42,8 @@ using ::location::nearby::connections::OsInfo; using ::location::nearby::connections::PayloadTransferFrame; using ::location::nearby::connections::V1Frame; using Medium = ::location::nearby::proto::connections::Medium; -using WifiDirectAuthType = - ::location::nearby::proto::connections::WifiDirectAuthType; -using MediumMetadata = ::location::nearby::connections::MediumMetadata; using ::location::nearby::connections::MediumRole; using ::protobuf_matchers::EqualsProto; -using ::testing::Pointwise; constexpr absl::string_view kEndpointId{"ABC"}; constexpr absl::string_view kEndpointName{"XYZ"}; @@ -284,76 +280,6 @@ TEST(OfflineFramesTest, CanGeneratePresenceConnectionRequest) { EXPECT_THAT(message, EqualsProto(kExpected)); } -TEST(OfflineFramesTest, - ForConnectionRequestConnectionsPopulatesWifiDirectAuthTypes) { - constexpr absl::string_view kExpected = - R"pb( - version: V1 - v1: < - type: CONNECTION_REQUEST - connection_request: < - endpoint_id: "ABC" - endpoint_name: "XYZ" - endpoint_info: "XYZ" - nonce: 1234 - medium_metadata: < - supports_5_ghz: true - bssid: "FF:FF:FF:FF:FF:FF" - ip_address: "8xqT" - ap_frequency: 2412 - supported_wifi_direct_auth_types: WIFI_DIRECT_WITH_PIN - supported_wifi_direct_auth_types: WIFI_DIRECT_WITH_PASSWORD - > - mediums: MDNS - mediums: BLUETOOTH - mediums: WIFI_HOTSPOT - mediums: BLE - mediums: WIFI_LAN - mediums: WIFI_AWARE - mediums: NFC - mediums: WIFI_DIRECT - mediums: WEB_RTC - mediums: USB - mediums: AWDL - keep_alive_interval_millis: 1000 - keep_alive_timeout_millis: 5000 - connections_device { - endpoint_id: "ABC" - endpoint_type: CONNECTIONS_ENDPOINT - endpoint_info: "XYZ" - } - > - >)pb"; - - ConnectionInfo connection_info{std::string(kEndpointId), - ByteArray{std::string(kEndpointName)}, - kNonce, - kSupports5ghz, - std::string(kBssid), - kApFrequency, - std::string(kIp4Bytes), - std::vector>( - kMediums.begin(), kMediums.end()), - kKeepAliveIntervalMillis, - kKeepAliveTimeoutMillis}; - connection_info.supported_wifi_direct_auth_types = { - WifiDirectAuthType::WIFI_DIRECT_WITH_PIN, - WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD}; - - location::nearby::connections::ConnectionsDevice connections_device; - connections_device.set_endpoint_id("ABC"); - connections_device.set_endpoint_type( - location::nearby::connections::CONNECTIONS_ENDPOINT); - connections_device.set_endpoint_info("XYZ"); - - ByteArray bytes = - ForConnectionRequestConnections(connections_device, connection_info); - auto response = FromBytes(bytes); - ASSERT_TRUE(response.ok()); - OfflineFrame message = response.result(); - EXPECT_THAT(message, EqualsProto(kExpected)); -} - TEST(OfflineFramesTest, CanGenerateConnectionResponse) { constexpr absl::string_view kExpected = R"pb( @@ -804,49 +730,6 @@ TEST(OfflineFramesTest, CanGenerateBwuPathRequest) { EXPECT_THAT(message, EqualsProto(kExpected)); } -TEST(OfflineFramesTest, WFDAuthTypeToMediumMetadataWFDAuthType) { - EXPECT_EQ(WFDAuthTypeToMediumMetadataWFDAuthType( - WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD), - MediumMetadata::WIFI_DIRECT_WITH_PASSWORD); - EXPECT_EQ(WFDAuthTypeToMediumMetadataWFDAuthType( - WifiDirectAuthType::WIFI_DIRECT_WITH_PIN), - MediumMetadata::WIFI_DIRECT_WITH_PIN); - EXPECT_EQ(WFDAuthTypeToMediumMetadataWFDAuthType( - WifiDirectAuthType::WIFI_DIRECT_TYPE_UNKNOWN), - MediumMetadata::WIFI_DIRECT_TYPE_UNKNOWN); -} - -TEST(OfflineFramesTest, MediumMetadataWFDAuthTypeToWFDAuthType) { - EXPECT_EQ(MediumMetadataWFDAuthTypeToWFDAuthType( - MediumMetadata::WIFI_DIRECT_WITH_PASSWORD), - WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD); - EXPECT_EQ(MediumMetadataWFDAuthTypeToWFDAuthType( - MediumMetadata::WIFI_DIRECT_WITH_PIN), - WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); - EXPECT_EQ(MediumMetadataWFDAuthTypeToWFDAuthType( - MediumMetadata::WIFI_DIRECT_TYPE_UNKNOWN), - WifiDirectAuthType::WIFI_DIRECT_TYPE_UNKNOWN); -} - -TEST(OfflineFramesTest, MediumMetadataWFDAuthTypesToWFDAuthTypes) { - MediumMetadata medium_metadata; - medium_metadata.add_supported_wifi_direct_auth_types( - MediumMetadata::WIFI_DIRECT_WITH_PASSWORD); - medium_metadata.add_supported_wifi_direct_auth_types( - MediumMetadata::WIFI_DIRECT_WITH_PIN); - - std::vector expected = { - WifiDirectAuthType::WIFI_DIRECT_WITH_PASSWORD, - WifiDirectAuthType::WIFI_DIRECT_WITH_PIN}; - - EXPECT_THAT(MediumMetadataWFDAuthTypesToWFDAuthTypes(medium_metadata), - Pointwise(testing::Eq(), expected)); - - MediumMetadata empty_medium_metadata; - EXPECT_TRUE( - MediumMetadataWFDAuthTypesToWFDAuthTypes(empty_medium_metadata).empty()); -} - } // namespace } // namespace parser } // namespace connections diff --git a/internal/platform/implementation/g3/wifi_direct.h b/internal/platform/implementation/g3/wifi_direct.h index fe9ec31d..f53d1b7e 100644 --- a/internal/platform/implementation/g3/wifi_direct.h +++ b/internal/platform/implementation/g3/wifi_direct.h @@ -182,12 +182,6 @@ class WifiDirectMedium : public api::WifiDirectMedium { return std::nullopt; } - // Returns the supported WifiDirect auth types. - std::vector GetSupportedWifiDirectAuthTypes() - const override { - return {WifiDirectAuthType::WIFI_DIRECT_WITH_PIN}; - } - private: absl::Mutex mutex_; diff --git a/internal/platform/implementation/wifi_direct.h b/internal/platform/implementation/wifi_direct.h index adfcf55f..0d267b29 100644 --- a/internal/platform/implementation/wifi_direct.h +++ b/internal/platform/implementation/wifi_direct.h @@ -19,7 +19,6 @@ #include #include #include -#include #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -82,9 +81,6 @@ class WifiDirectServerSocket { // Container of operations that can be performed over the WifiLan medium. class WifiDirectMedium { public: - using WifiDirectAuthType = - ::location::nearby::proto::connections::WifiDirectAuthType; - virtual ~WifiDirectMedium() = default; // If the WiFi Adaptor supports to start a WifiDirect interface. @@ -123,10 +119,6 @@ class WifiDirectMedium { // Returns the port range as a pair of min and max port. virtual absl::optional> GetDynamicPortRange() = 0; - - // Returns the supported WifiDirect auth types. - virtual std::vector GetSupportedWifiDirectAuthTypes() - const = 0; }; } // namespace api diff --git a/internal/platform/implementation/windows/wifi_direct.h b/internal/platform/implementation/windows/wifi_direct.h index d2e71daf..154c13e1 100644 --- a/internal/platform/implementation/windows/wifi_direct.h +++ b/internal/platform/implementation/windows/wifi_direct.h @@ -25,7 +25,6 @@ #include #include #include -#include // Nearby connections headers #include "absl/base/nullability.h" @@ -211,10 +210,6 @@ class WifiDirectMedium : public api::WifiDirectMedium { return absl::nullopt; } - // Returns the supported WifiDirect auth types. - std::vector GetSupportedWifiDirectAuthTypes() - const override; - private: enum Value : char { kMediumStatusIdle = 0, diff --git a/internal/platform/implementation/windows/wifi_direct_medium.cc b/internal/platform/implementation/windows/wifi_direct_medium.cc index c09c81f0..c6ed7775 100644 --- a/internal/platform/implementation/windows/wifi_direct_medium.cc +++ b/internal/platform/implementation/windows/wifi_direct_medium.cc @@ -18,7 +18,6 @@ #include #include #include -#include #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" @@ -738,11 +737,5 @@ bool WifiDirectMedium::DisconnectWifiDirect() { return false; } -std::vector -WifiDirectMedium::GetSupportedWifiDirectAuthTypes() const { - // Windows only supports WifiDirect with Service Discovery, which uses a PIN. - return {WifiDirectAuthType::WIFI_DIRECT_WITH_PIN}; -} - } // namespace windows } // namespace nearby diff --git a/internal/platform/wifi_direct.h b/internal/platform/wifi_direct.h index b7d33398..33b6900f 100644 --- a/internal/platform/wifi_direct.h +++ b/internal/platform/wifi_direct.h @@ -19,7 +19,6 @@ #include #include #include -#include #include "absl/base/thread_annotations.h" #include "absl/strings/string_view.h" @@ -153,8 +152,6 @@ class WifiDirectServerSocket final { class WifiDirectMedium { public: using Platform = api::ImplementationPlatform; - using WifiDirectAuthType = - ::location::nearby::proto::connections::WifiDirectAuthType; WifiDirectMedium() : impl_(Platform::CreateWifiDirectMedium()) {} ~WifiDirectMedium() = default; @@ -201,14 +198,6 @@ class WifiDirectMedium { return *impl_; } - // Returns the supported WifiDirect auth types. - std::vector GetSupportedWifiDirectAuthTypes() - const { - // NOTE: This assumes that supported_wifi_direct_auth_types_ is populated - // during the constructor or at some other initialization phase. - return impl_->GetSupportedWifiDirectAuthTypes(); - } - private: Mutex mutex_; std::unique_ptr impl_; diff --git a/internal/platform/wifi_direct_test.cc b/internal/platform/wifi_direct_test.cc index 2139b0af..f8ecb636 100644 --- a/internal/platform/wifi_direct_test.cc +++ b/internal/platform/wifi_direct_test.cc @@ -282,15 +282,5 @@ TEST_F(WifiDirectMediumTest, CanStartDirectGOThatOtherFailConnect) { EXPECT_TRUE(wifi_direct_a.StopWifiDirect()); } -TEST_F(WifiDirectMediumTest, GetSupportedWifiDirectAuthTypes) { - WifiDirectMedium wifi_direct_a; - // g3 only supports WifiDirect with auth type of PIN. - auto supported_types = wifi_direct_a.GetSupportedWifiDirectAuthTypes(); - EXPECT_EQ(supported_types.size(), 1); - EXPECT_EQ(supported_types[0], - location::nearby::proto::connections:: - WifiDirectAuthType::WIFI_DIRECT_WITH_PIN); -} - } // namespace } // namespace nearby