mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Remove unnecessary dependencies.
PiperOrigin-RevId: 643374160
This commit is contained in:
committed by
Copybara-Service
parent
80cf0e50fd
commit
03dba4ae8b
+61
-11
@@ -73,6 +73,7 @@ cc_library(
|
||||
hdrs = [
|
||||
"advertisement.h",
|
||||
"attachment_info.h",
|
||||
"constants.h",
|
||||
"nearby_connection.h",
|
||||
"nearby_connections_manager.h",
|
||||
"nearby_sharing_decoder.h",
|
||||
@@ -94,6 +95,7 @@ cc_library(
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
@@ -120,10 +122,56 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nearby_sharing_decoder_impl",
|
||||
srcs = ["nearby_sharing_decoder_impl.cc"],
|
||||
hdrs = ["nearby_sharing_decoder_impl.h"],
|
||||
visibility = [
|
||||
"//sharing/fuzzing:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
":types",
|
||||
"//sharing/proto:wire_format_cc_proto",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "incoming_frame_reader",
|
||||
srcs = ["incoming_frames_reader.cc"],
|
||||
hdrs = ["incoming_frames_reader.h"],
|
||||
deps = [
|
||||
":types",
|
||||
"//internal/platform:types",
|
||||
"//sharing/internal/public:logging",
|
||||
"//sharing/internal/public:types",
|
||||
"//sharing/proto:wire_format_cc_proto",
|
||||
"@com_google_absl//absl/time",
|
||||
"@com_google_absl//absl/types:span",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "paired_key_verification_runner",
|
||||
srcs = ["paired_key_verification_runner.cc"],
|
||||
hdrs = ["paired_key_verification_runner.h"],
|
||||
deps = [
|
||||
":incoming_frame_reader",
|
||||
":types",
|
||||
"//internal/platform:types",
|
||||
"//proto:sharing_enums_cc_proto",
|
||||
"//sharing/certificates",
|
||||
"//sharing/internal/public:logging",
|
||||
"//sharing/proto:enums_cc_proto",
|
||||
"//sharing/proto:share_cc_proto",
|
||||
"//sharing/proto:wire_format_cc_proto",
|
||||
"@com_google_absl//absl/time",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "nearby_sharing_service",
|
||||
srcs = [
|
||||
"incoming_frames_reader.cc",
|
||||
"incoming_share_target_info.cc",
|
||||
"nearby_connection_impl.cc",
|
||||
"nearby_connections_manager.cc",
|
||||
@@ -134,7 +182,6 @@ cc_library(
|
||||
"nearby_connections_stream_buffer_manager.cc",
|
||||
"nearby_file_handler.cc",
|
||||
"nearby_share_profile_info_provider_impl.cc",
|
||||
"nearby_sharing_decoder_impl.cc",
|
||||
"nearby_sharing_service.cc",
|
||||
"nearby_sharing_service_extension.cc",
|
||||
"nearby_sharing_service_factory.cc",
|
||||
@@ -142,7 +189,6 @@ cc_library(
|
||||
"nearby_sharing_settings.cc",
|
||||
"nearby_sharing_util.cc",
|
||||
"outgoing_share_target_info.cc",
|
||||
"paired_key_verification_runner.cc",
|
||||
"payload_tracker.cc",
|
||||
"share_target_info.cc",
|
||||
"transfer_manager.cc",
|
||||
@@ -150,9 +196,7 @@ cc_library(
|
||||
],
|
||||
hdrs = [
|
||||
"connection_lifecycle_listener.h",
|
||||
"constants.h",
|
||||
"endpoint_discovery_listener.h",
|
||||
"incoming_frames_reader.h",
|
||||
"incoming_share_target_info.h",
|
||||
"nearby_connection_impl.h",
|
||||
"nearby_connections_manager_factory.h",
|
||||
@@ -162,7 +206,6 @@ cc_library(
|
||||
"nearby_connections_stream_buffer_manager.h",
|
||||
"nearby_file_handler.h",
|
||||
"nearby_share_profile_info_provider_impl.h",
|
||||
"nearby_sharing_decoder_impl.h",
|
||||
"nearby_sharing_service.h",
|
||||
"nearby_sharing_service_extension.h",
|
||||
"nearby_sharing_service_factory.h",
|
||||
@@ -170,7 +213,6 @@ cc_library(
|
||||
"nearby_sharing_settings.h",
|
||||
"nearby_sharing_util.h",
|
||||
"outgoing_share_target_info.h",
|
||||
"paired_key_verification_runner.h",
|
||||
"payload_listener.h",
|
||||
"payload_tracker.h",
|
||||
"share_target_discovered_callback.h",
|
||||
@@ -191,6 +233,9 @@ cc_library(
|
||||
deps = [
|
||||
":attachments",
|
||||
":connection_types",
|
||||
":incoming_frame_reader",
|
||||
":nearby_sharing_decoder_impl",
|
||||
":paired_key_verification_runner",
|
||||
":transfer_metadata",
|
||||
":types",
|
||||
"//connections:core",
|
||||
@@ -305,10 +350,11 @@ cc_test(
|
||||
size = "small",
|
||||
srcs = ["paired_key_verification_runner_test.cc"],
|
||||
deps = [
|
||||
":nearby_sharing_service",
|
||||
":incoming_frame_reader",
|
||||
":nearby_sharing_decoder_impl",
|
||||
":paired_key_verification_runner",
|
||||
":test_support",
|
||||
":types",
|
||||
"//internal/platform/implementation:types",
|
||||
"//internal/test",
|
||||
"//proto:sharing_enums_cc_proto",
|
||||
"//sharing/certificates",
|
||||
@@ -349,7 +395,8 @@ cc_test(
|
||||
name = "incoming_frames_reader_test",
|
||||
srcs = ["incoming_frames_reader_test.cc"],
|
||||
deps = [
|
||||
":nearby_sharing_service",
|
||||
":incoming_frame_reader",
|
||||
":nearby_sharing_decoder_impl",
|
||||
":test_support",
|
||||
"//internal/platform/implementation/g3", # fixdeps: keep
|
||||
"//internal/test",
|
||||
@@ -367,6 +414,8 @@ cc_test(
|
||||
name = "nearby_connection_impl_test",
|
||||
srcs = ["nearby_connection_impl_test.cc"],
|
||||
deps = [
|
||||
":incoming_frame_reader",
|
||||
":nearby_sharing_decoder_impl",
|
||||
":nearby_sharing_service",
|
||||
":test_support",
|
||||
"//internal/platform/implementation/g3", # fixdeps: keep
|
||||
@@ -623,11 +672,12 @@ cc_test(
|
||||
name = "share_target_info_test",
|
||||
srcs = ["share_target_info_test.cc"],
|
||||
deps = [
|
||||
":nearby_sharing_decoder_impl",
|
||||
":nearby_sharing_service",
|
||||
":paired_key_verification_runner",
|
||||
":test_support",
|
||||
":transfer_metadata",
|
||||
":types",
|
||||
"//internal/platform/implementation:types",
|
||||
"//internal/platform/implementation/g3", # fixdeps: keep
|
||||
"//sharing/certificates:test_support",
|
||||
"//sharing/internal/test:nearby_test",
|
||||
|
||||
@@ -163,6 +163,23 @@ bool ShouldBlockSurfaceRegistration(BlockedVendorId registering_vendor_id,
|
||||
registering_vendor_id != blocked_vendor_id;
|
||||
}
|
||||
|
||||
OSType ToProtoOsType(::nearby::api::DeviceInfo::OsType os_type) {
|
||||
switch (os_type) {
|
||||
case ::nearby::api::DeviceInfo::OsType::kAndroid:
|
||||
return OSType::ANDROID;
|
||||
case ::nearby::api::DeviceInfo::OsType::kChromeOs:
|
||||
return OSType::CHROME_OS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kWindows:
|
||||
return OSType::WINDOWS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kIos:
|
||||
return OSType::IOS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kMacOS:
|
||||
return OSType::MACOS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kUnknown:
|
||||
return OSType::UNKNOWN_OS_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
NearbySharingServiceImpl::NearbySharingServiceImpl(
|
||||
@@ -2623,7 +2640,7 @@ void NearbySharingServiceImpl::OnOutgoingConnection(
|
||||
std::optional<std::string> four_digit_token = TokenToFourDigitString(token);
|
||||
|
||||
info.RunPairedKeyVerification(
|
||||
context_, decoder_, device_info_.GetOsType(),
|
||||
context_, decoder_, ToProtoOsType(device_info_.GetOsType()),
|
||||
{
|
||||
.visibility = settings_->GetVisibility(),
|
||||
.last_visibility = settings_->GetLastVisibility(),
|
||||
@@ -3278,7 +3295,7 @@ void NearbySharingServiceImpl::OnIncomingDecryptedCertificate(
|
||||
std::optional<std::string> four_digit_token = TokenToFourDigitString(token);
|
||||
|
||||
share_target_info.RunPairedKeyVerification(
|
||||
context_, decoder_, device_info_.GetOsType(),
|
||||
context_, decoder_, ToProtoOsType(device_info_.GetOsType()),
|
||||
{
|
||||
.visibility = settings_->GetVisibility(),
|
||||
.last_visibility = settings_->GetLastVisibility(),
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/clock.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "proto/sharing_enums.pb.h"
|
||||
#include "sharing/certificates/common.h"
|
||||
#include "sharing/certificates/constants.h"
|
||||
@@ -82,25 +81,6 @@ std::vector<uint8_t> PadPrefix(char prefix, std::vector<uint8_t> bytes) {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
OSType ToProtoOsType(::nearby::api::DeviceInfo::OsType os_type) {
|
||||
switch (os_type) {
|
||||
case ::nearby::api::DeviceInfo::OsType::kAndroid:
|
||||
return OSType::ANDROID;
|
||||
case ::nearby::api::DeviceInfo::OsType::kChromeOs:
|
||||
return OSType::CHROME_OS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kWindows:
|
||||
return OSType::WINDOWS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kIos:
|
||||
return OSType::IOS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kMacOS:
|
||||
return OSType::MACOS;
|
||||
case ::nearby::api::DeviceInfo::OsType::kUnknown:
|
||||
break;
|
||||
}
|
||||
|
||||
return OSType::UNKNOWN_OS_TYPE;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
std::ostream& operator<<(
|
||||
@@ -112,11 +92,9 @@ std::ostream& operator<<(
|
||||
}
|
||||
|
||||
PairedKeyVerificationRunner::PairedKeyVerificationRunner(
|
||||
Clock* clock, nearby::api::DeviceInfo::OsType os_type,
|
||||
bool share_target_is_incoming,
|
||||
Clock* clock, OSType os_type, bool share_target_is_incoming,
|
||||
const VisibilityHistory& visibility_history,
|
||||
const std::vector<uint8_t>& token,
|
||||
NearbyConnection* connection,
|
||||
const std::vector<uint8_t>& token, NearbyConnection* connection,
|
||||
const std::optional<NearbyShareDecryptedPublicCertificate>& certificate,
|
||||
NearbyShareCertificateManager* certificate_manager,
|
||||
IncomingFramesReader* frames_reader, absl::Duration read_frame_timeout)
|
||||
@@ -270,7 +248,7 @@ void PairedKeyVerificationRunner::SendPairedKeyResultFrame(
|
||||
}
|
||||
|
||||
// Set OS type to allow remote device knowns the paring device OS type.
|
||||
result_frame->set_os_type(ToProtoOsType(os_type_));
|
||||
result_frame->set_os_type(os_type_);
|
||||
|
||||
std::vector<uint8_t> data(frame.ByteSizeLong());
|
||||
frame.SerializeToArray(data.data(), frame.ByteSizeLong());
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/clock.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "proto/sharing_enums.pb.h"
|
||||
#include "sharing/certificates/nearby_share_certificate_manager.h"
|
||||
#include "sharing/certificates/nearby_share_decrypted_public_certificate.h"
|
||||
@@ -57,7 +56,7 @@ class PairedKeyVerificationRunner
|
||||
};
|
||||
|
||||
PairedKeyVerificationRunner(
|
||||
Clock* clock, nearby::api::DeviceInfo::OsType os_type,
|
||||
Clock* clock, location::nearby::proto::sharing::OSType os_type,
|
||||
bool share_target_is_incoming,
|
||||
const VisibilityHistory& visibility_history,
|
||||
const std::vector<uint8_t>& token, NearbyConnection* connection,
|
||||
@@ -95,7 +94,7 @@ class PairedKeyVerificationRunner
|
||||
bool IsVisibilityRecentlyUpdated() const;
|
||||
|
||||
nearby::Clock* const clock_;
|
||||
const nearby::api::DeviceInfo::OsType os_type_;
|
||||
const location::nearby::proto::sharing::OSType os_type_;
|
||||
VisibilityHistory visibility_history_;
|
||||
std::vector<uint8_t> raw_token_;
|
||||
NearbyConnection* connection_;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "protobuf-matchers/protocol-buffer-matchers.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "internal/test/fake_clock.h"
|
||||
#include "proto/sharing_enums.pb.h"
|
||||
#include "sharing/certificates/fake_nearby_share_certificate_manager.h"
|
||||
@@ -204,10 +203,9 @@ class PairedKeyVerificationRunnerTest : public testing::Test {
|
||||
: std::nullopt;
|
||||
|
||||
auto runner = std::make_shared<PairedKeyVerificationRunner>(
|
||||
context_.GetClock(), nearby::api::DeviceInfo::OsType::kWindows,
|
||||
is_incoming, visibility_history, GetAuthToken(), &connection_,
|
||||
std::move(public_certificate), &certificate_manager_, &frames_reader_,
|
||||
kTimeout);
|
||||
context_.GetClock(), OSType::WINDOWS, is_incoming, visibility_history,
|
||||
GetAuthToken(), &connection_, std::move(public_certificate),
|
||||
&certificate_manager_, &frames_reader_, kTimeout);
|
||||
|
||||
runner->Run(
|
||||
[&, expected_result, expected_os_type](
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "sharing/certificates/nearby_share_certificate_manager.h"
|
||||
#include "sharing/constants.h"
|
||||
#include "sharing/incoming_frames_reader.h"
|
||||
@@ -92,8 +91,7 @@ bool ShareTargetInfo::OnConnected(absl::Time connect_start_time,
|
||||
}
|
||||
|
||||
void ShareTargetInfo::RunPairedKeyVerification(
|
||||
Context* context, NearbySharingDecoder* decoder,
|
||||
nearby::api::DeviceInfo::OsType os_type,
|
||||
Context* context, NearbySharingDecoder* decoder, OSType os_type,
|
||||
const PairedKeyVerificationRunner::VisibilityHistory& visibility_history,
|
||||
NearbyShareCertificateManager* certificate_manager,
|
||||
std::optional<std::vector<uint8_t>> token,
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "proto/sharing_enums.pb.h"
|
||||
#include "sharing/attachment_container.h"
|
||||
#include "sharing/certificates/nearby_share_certificate_manager.h"
|
||||
@@ -116,7 +115,7 @@ class ShareTargetInfo {
|
||||
|
||||
void RunPairedKeyVerification(
|
||||
Context* context, NearbySharingDecoder* decoder,
|
||||
nearby::api::DeviceInfo::OsType os_type,
|
||||
location::nearby::proto::sharing::OSType os_type,
|
||||
const PairedKeyVerificationRunner::VisibilityHistory& visibility_history,
|
||||
NearbyShareCertificateManager* certificate_manager,
|
||||
std::optional<std::vector<uint8_t>> token,
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "absl/synchronization/notification.h"
|
||||
#include "absl/time/clock.h"
|
||||
#include "absl/time/time.h"
|
||||
#include "internal/platform/implementation/device_info.h"
|
||||
#include "sharing/certificates/fake_nearby_share_certificate_manager.h"
|
||||
#include "sharing/fake_nearby_connection.h"
|
||||
#include "sharing/internal/test/fake_context.h"
|
||||
@@ -39,6 +38,8 @@
|
||||
namespace nearby::sharing {
|
||||
namespace {
|
||||
|
||||
using ::location::nearby::proto::sharing::OSType;
|
||||
|
||||
constexpr absl::string_view kEndpointId = "12345";
|
||||
|
||||
// A test class which makes ShareTargetInfo testable since the class is
|
||||
@@ -160,8 +161,7 @@ TEST(ShareTargetInfoTest, IncomingRunPairedKeyVerificationSuccess) {
|
||||
PairedKeyVerificationRunner::PairedKeyVerificationResult verification_result;
|
||||
|
||||
info.RunPairedKeyVerification(
|
||||
&context, &nearby_sharing_decoder,
|
||||
nearby::api::DeviceInfo::OsType::kWindows,
|
||||
&context, &nearby_sharing_decoder, OSType::WINDOWS,
|
||||
{
|
||||
.visibility = proto::DeviceVisibility::DEVICE_VISIBILITY_EVERYONE,
|
||||
.last_visibility =
|
||||
|
||||
Reference in New Issue
Block a user