mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Apply DCT flag in Nearby Connections
PiperOrigin-RevId: 756487383
This commit is contained in:
committed by
Copybara-Service
parent
5f3ce51cfd
commit
09ac8d8c58
+4
-1
@@ -223,6 +223,10 @@ NC_INSTANCE NcCreateService() {
|
||||
NcContext nc_context;
|
||||
|
||||
#if defined(NC_IOS_SDK)
|
||||
nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
::nearby::connections::config_package_nearby::nearby_connections_feature::
|
||||
kEnableDct,
|
||||
true);
|
||||
nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
::nearby::connections::config_package_nearby::nearby_connections_feature::
|
||||
kEnableAwdl,
|
||||
@@ -232,7 +236,6 @@ NC_INSTANCE NcCreateService() {
|
||||
::nearby::connections::config_package_nearby::nearby_connections_feature::
|
||||
kEnableStopBLEScanningOnWifiUpgrade,
|
||||
true);
|
||||
|
||||
#endif
|
||||
|
||||
nc_context.router = new ::nearby::connections::ServiceControllerRouter();
|
||||
|
||||
@@ -108,9 +108,10 @@ BwuManager::BwuManager(
|
||||
config_.allow_upgrade_to.wifi_direct = true;
|
||||
config_.allow_upgrade_to.wifi_lan = true;
|
||||
config_.allow_upgrade_to.wifi_hotspot = true;
|
||||
#if defined(NC_IOS_SDK)
|
||||
config_.allow_upgrade_to.awdl = true;
|
||||
#endif // defined(NC_IOS_SDK)
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
config_package_nearby::nearby_connections_feature::kEnableDct)) {
|
||||
config_.allow_upgrade_to.awdl = true;
|
||||
}
|
||||
}
|
||||
if (!handlers.empty()) {
|
||||
handlers_ = std::move(handlers);
|
||||
|
||||
@@ -90,6 +90,8 @@ bool IsFeatureUseStableEndpointIdEnabled() {
|
||||
ClientProxy::ClientProxy(::nearby::analytics::EventLogger* event_logger)
|
||||
: client_id_(Prng().NextInt64()) {
|
||||
NEARBY_LOGS(INFO) << "ClientProxy ctor event_logger=" << event_logger;
|
||||
is_dct_enabled_ = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
config_package_nearby::nearby_connections_feature::kEnableDct);
|
||||
analytics_recorder_ =
|
||||
std::make_unique<analytics::AnalyticsRecorder>(event_logger);
|
||||
error_code_recorder_ = std::make_unique<ErrorCodeRecorder>(
|
||||
@@ -1317,17 +1319,7 @@ void ClientProxy::SetWebRtcNonCellular(bool webrtc_non_cellular) {
|
||||
webrtc_non_cellular_ = webrtc_non_cellular;
|
||||
}
|
||||
|
||||
bool ClientProxy::IsDctEnabled() const {
|
||||
if (api::ImplementationPlatform::GetCurrentOS() != api::OSName::kApple) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(NC_IOS_SDK)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
bool ClientProxy::IsDctEnabled() const { return is_dct_enabled_; }
|
||||
|
||||
uint8_t ClientProxy::GetDctDedup() const { return dct_dedup_; }
|
||||
|
||||
|
||||
@@ -546,6 +546,8 @@ class ClientProxy final {
|
||||
std::int32_t local_safe_to_disconnect_version_;
|
||||
// Allowed to use WebRTC over non-cellular networks.
|
||||
bool webrtc_non_cellular_ = false;
|
||||
// Whether DCT is enabled.
|
||||
bool is_dct_enabled_ = false;
|
||||
};
|
||||
|
||||
} // namespace connections
|
||||
|
||||
@@ -32,11 +32,12 @@ P2pPointToPointPcpHandler::P2pPointToPointPcpHandler(
|
||||
std::vector<location::nearby::proto::connections::Medium>
|
||||
P2pPointToPointPcpHandler::GetConnectionMediumsByPriority() {
|
||||
std::vector<location::nearby::proto::connections::Medium> mediums;
|
||||
#if defined(NC_IOS_SDK)
|
||||
if (mediums_->GetAwdl().IsAvailable()) {
|
||||
mediums.push_back(location::nearby::proto::connections::AWDL);
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
config_package_nearby::nearby_connections_feature::kEnableDct)) {
|
||||
if (mediums_->GetAwdl().IsAvailable()) {
|
||||
mediums.push_back(location::nearby::proto::connections::AWDL);
|
||||
}
|
||||
}
|
||||
#endif // defined(NC_IOS_SDK)
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(location::nearby::proto::connections::WIFI_LAN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user