From 1f71b0713b298040a817012df797e97858e0c321 Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Tue, 23 Jun 2026 11:39:40 -0700 Subject: [PATCH] internal PiperOrigin-RevId: 936797797 --- sharing/analytics/analytics_recorder.h | 3 +-- sharing/nearby_sharing_service_impl.cc | 3 +-- sharing/outgoing_share_session.cc | 3 +-- sharing/outgoing_share_session.h | 5 +---- sharing/outgoing_share_session_test.cc | 13 ++----------- 5 files changed, 6 insertions(+), 21 deletions(-) diff --git a/sharing/analytics/analytics_recorder.h b/sharing/analytics/analytics_recorder.h index d1bbba4e..e8d0dc4d 100644 --- a/sharing/analytics/analytics_recorder.h +++ b/sharing/analytics/analytics_recorder.h @@ -142,8 +142,7 @@ class AnalyticsRecorder { const AttachmentContainer& attachments, int transfer_position, int concurrent_connections, - bool advanced_protection_enabled, - bool advanced_protection_mismatch) = 0; + bool advanced_protection_enabled) = 0; virtual void NewSendFastInitialization() = 0; diff --git a/sharing/nearby_sharing_service_impl.cc b/sharing/nearby_sharing_service_impl.cc index 03fb483b..b6fcd4e3 100644 --- a/sharing/nearby_sharing_service_impl.cc +++ b/sharing/nearby_sharing_service_impl.cc @@ -2588,8 +2588,7 @@ void NearbySharingServiceImpl::BeginOutgoingTransfer( bool protection_enabled = preference_manager_.GetBoolean(PrefNames::kAdvancedProtectionEnabled, /*default_value=*/false); - session.SetAdvancedProtectionStatus(protection_enabled, - /*advanced_protection_mismatch=*/false); + session.SetAdvancedProtectionStatus(protection_enabled); if (session.token().empty() || !protection_enabled) { // Auto accept if no token or if advanced protection is disabled. OutgoingSessionAccept(session); diff --git a/sharing/outgoing_share_session.cc b/sharing/outgoing_share_session.cc index 7b9b52a9..306eeb0c 100644 --- a/sharing/outgoing_share_session.cc +++ b/sharing/outgoing_share_session.cc @@ -372,8 +372,7 @@ void OutgoingShareSession::SendPayloads( analytics_recorder().NewSendAttachmentsStart( session_id(), attachment_container(), /*transfer_position=*/1, - /*concurrent_connections=*/1, advanced_protection_enabled_, - advanced_protection_mismatch_); + /*concurrent_connections=*/1, advanced_protection_enabled_); VLOG(1) << "The connection was accepted. Payloads are now being sent."; InitializePayloadTracker(std::move(payload_transder_update_callback)); SendNextPayload(); diff --git a/sharing/outgoing_share_session.h b/sharing/outgoing_share_session.h index fb28496a..401b04a3 100644 --- a/sharing/outgoing_share_session.h +++ b/sharing/outgoing_share_session.h @@ -141,10 +141,8 @@ class OutgoingShareSession : public ShareSession { std::optional ProcessPayloadTransferUpdates(); - void SetAdvancedProtectionStatus(bool advanced_protection_enabled, - bool advanced_protection_mismatch) { + void SetAdvancedProtectionStatus(bool advanced_protection_enabled) { advanced_protection_enabled_ = advanced_protection_enabled; - advanced_protection_mismatch_ = advanced_protection_mismatch; } // Returns true if the session is connected or in the process of connecting. @@ -210,7 +208,6 @@ class OutgoingShareSession : public ShareSession { // Timeout waiting for remote disconnect in order to complete transfer. std::unique_ptr disconnection_timeout_; bool advanced_protection_enabled_ = false; - bool advanced_protection_mismatch_ = false; bool is_connecting_ = false; // Session can be for transfer or pairing. bool is_transfer_session_ = false; diff --git a/sharing/outgoing_share_session_test.cc b/sharing/outgoing_share_session_test.cc index 21b01d6c..7843bfa6 100644 --- a/sharing/outgoing_share_session_test.cc +++ b/sharing/outgoing_share_session_test.cc @@ -676,11 +676,7 @@ TEST_F(OutgoingShareSessionTest, SendPayloads) { Log(Matcher(AllOf( (HasCategory(EventCategory::SENDING_EVENT), HasEventType(EventType::SEND_ATTACHMENTS_START), - ProtoField<"send_attachments_start", "session_id">(1234), - ProtoField<"send_attachments_start", "advanced_protection_enabled">( - false), - ProtoField<"send_attachments_start", "advanced_protection_mismatch">( - false)))))); + ProtoField<"send_attachments_start", "session_id">(1234)))))); NearbyConnectionImpl connection(device_info_); ConnectionSuccess(&connection); @@ -717,15 +713,12 @@ TEST_F(OutgoingShareSessionTest, SendPayloadsSetsAdvancedProtectionFlags) { HasEventType(EventType::SEND_ATTACHMENTS_START), ProtoField<"send_attachments_start", "session_id">(1234), ProtoField<"send_attachments_start", "advanced_protection_enabled">( - true), - ProtoField<"send_attachments_start", "advanced_protection_mismatch">( true)))))); NearbyConnectionImpl connection(device_info_); ConnectionSuccess(&connection); - session_.SetAdvancedProtectionStatus(/*advanced_protection_enabled=*/true, - /*advanced_protection_mismatch=*/true); + session_.SetAdvancedProtectionStatus(/*advanced_protection_enabled=*/true); session_.SendPayloads([](bool is_timeout, std::optional frame) {}, payload_transder_update_callback.AsStdFunction()); @@ -759,8 +752,6 @@ TEST_F(OutgoingShareSessionTest, SendNextPayload) { HasEventType(EventType::SEND_ATTACHMENTS_START), ProtoField<"send_attachments_start", "session_id">(1234), ProtoField<"send_attachments_start", "advanced_protection_enabled">( - false), - ProtoField<"send_attachments_start", "advanced_protection_mismatch">( false)))))); NearbyConnectionImpl connection(device_info_); ConnectionSuccess(&connection);