PiperOrigin-RevId: 936797797
This commit is contained in:
Francis Tsui
2026-06-23 11:40:35 -07:00
committed by Copybara-Service
parent a24b2220fc
commit 1f71b0713b
5 changed files with 6 additions and 21 deletions
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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);
+1 -2
View File
@@ -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();
+1 -4
View File
@@ -141,10 +141,8 @@ class OutgoingShareSession : public ShareSession {
std::optional<TransferMetadata> 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<ThreadTimer> 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;
+2 -11
View File
@@ -676,11 +676,7 @@ TEST_F(OutgoingShareSessionTest, SendPayloads) {
Log(Matcher<const SharingLog&>(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<V1Frame> 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);