mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Deprecate flags that have been fully rolled out.
PiperOrigin-RevId: 678305598
This commit is contained in:
committed by
Copybara-Service
parent
d9b38e2efd
commit
3cd3614a4a
@@ -524,6 +524,7 @@ cc_test(
|
||||
"//sharing/internal/test:nearby_test",
|
||||
"//sharing/proto:enums_cc_proto",
|
||||
"@com_github_protobuf_matchers//protobuf-matchers",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/strings:string_view",
|
||||
"@com_google_absl//absl/synchronization",
|
||||
"@com_google_absl//absl/time",
|
||||
|
||||
@@ -32,21 +32,12 @@ namespace nearby_sharing_feature {
|
||||
// Time to delay the endpoint loss in milliseconds.
|
||||
constexpr auto kDelayEndpointLossMs =
|
||||
flags::Flag<int64_t>(kConfigPackage, "45632386", 500);
|
||||
// When true, delete the file payload which received unexpectedly.
|
||||
constexpr auto kDeleteUnexpectedReceivedFile =
|
||||
flags::Flag<bool>(kConfigPackage, "45627826", true);
|
||||
// Enable/disable the use of BLE as a connection medium.
|
||||
constexpr auto kEnableBleForTransfer =
|
||||
flags::Flag<bool>(kConfigPackage, "45427466", false);
|
||||
// Enable/disable certificates dump
|
||||
constexpr auto kEnableCertificatesDump =
|
||||
flags::Flag<bool>(kConfigPackage, "45409184", false);
|
||||
// Enable/disable dumping feature flags
|
||||
constexpr auto kEnableDumpingFeatureFlags =
|
||||
flags::Flag<bool>(kConfigPackage, "45415713", true);
|
||||
// Enable/disable logging additional system info metrics
|
||||
constexpr auto kEnableLoggingSystemInfoMetrics =
|
||||
flags::Flag<bool>(kConfigPackage, "45412418", true);
|
||||
// Enable/disable WebRTC medium in Nearby Share
|
||||
constexpr auto kEnableMediumWebRtc =
|
||||
flags::Flag<bool>(kConfigPackage, "45418905", false);
|
||||
@@ -79,12 +70,12 @@ constexpr auto kSenderSkipsConfirmation =
|
||||
// Enable/disable auto-update on settings page
|
||||
constexpr auto kShowAutoUpdateSetting =
|
||||
flags::Flag<bool>(kConfigPackage, "45409033", false);
|
||||
// When true, we only upgrade the bandwidth after accepting a connection.
|
||||
constexpr auto kUpgradeBandwidthAfterAccept =
|
||||
flags::Flag<bool>(kConfigPackage, "45627824", true);
|
||||
// When true, use gRpc client to access backend.
|
||||
constexpr auto kUseGrpcClient =
|
||||
flags::Flag<bool>(kConfigPackage, "45630055", false);
|
||||
// When true, dedup discovered endpoints.
|
||||
constexpr auto kApplyEndpointsDedup =
|
||||
flags::Flag<bool>(kConfigPackage, "45656298", false);
|
||||
// Enable/disable QR Code UI
|
||||
constexpr auto kEnableQrCodeUi =
|
||||
flags::Flag<bool>(kConfigPackage, "45417647", false);
|
||||
@@ -94,17 +85,11 @@ constexpr auto kShowAdminModeWarning =
|
||||
// Update track
|
||||
constexpr auto kUpdateTrack =
|
||||
flags::Flag<absl::string_view>(kConfigPackage, "45409861", "");
|
||||
// Apply endpoints de-duplication algorithms.
|
||||
constexpr auto kApplyEndpointsDedup =
|
||||
flags::Flag<bool>(kConfigPackage, "45656298", false);
|
||||
|
||||
inline absl::btree_map<int, const flags::Flag<bool>&> GetBoolFlags() {
|
||||
return {
|
||||
{45627826, kDeleteUnexpectedReceivedFile},
|
||||
{45427466, kEnableBleForTransfer},
|
||||
{45409184, kEnableCertificatesDump},
|
||||
{45415713, kEnableDumpingFeatureFlags},
|
||||
{45412418, kEnableLoggingSystemInfoMetrics},
|
||||
{45418905, kEnableMediumWebRtc},
|
||||
{45418906, kEnableMediumWifiLan},
|
||||
{45411589, kEnableRetryResumeTransfer},
|
||||
@@ -114,11 +99,10 @@ inline absl::btree_map<int, const flags::Flag<bool>&> GetBoolFlags() {
|
||||
{45411620, kEnableWebrtcMedium},
|
||||
{45411353, kSenderSkipsConfirmation},
|
||||
{45409033, kShowAutoUpdateSetting},
|
||||
{45627824, kUpgradeBandwidthAfterAccept},
|
||||
{45630055, kUseGrpcClient},
|
||||
{45656298, kApplyEndpointsDedup},
|
||||
{45417647, kEnableQrCodeUi},
|
||||
{45410558, kShowAdminModeWarning},
|
||||
{45656298, kApplyEndpointsDedup},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "sharing/common/nearby_share_enums.h"
|
||||
#include "sharing/constants.h"
|
||||
#include "sharing/flags/generated/nearby_sharing_feature_flags.h"
|
||||
#include "sharing/internal/api/bluetooth_adapter.h"
|
||||
#include "sharing/internal/base/encode.h"
|
||||
#include "sharing/internal/public/connectivity_manager.h"
|
||||
#include "sharing/internal/public/context.h"
|
||||
@@ -790,19 +789,15 @@ void NearbyConnectionsManagerImpl::OnPayloadReceived(
|
||||
void NearbyConnectionsManagerImpl::ProcessUnknownFilePathsToDelete(
|
||||
PayloadStatus status, PayloadContent::Type type,
|
||||
const std::filesystem::path& path) {
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
sharing::config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile)) {
|
||||
// Unknown payload comes as kInProgress and kCanceled status with kFile type
|
||||
// from NearbyConnections. Delete it.
|
||||
if ((status == PayloadStatus::kCanceled ||
|
||||
status == PayloadStatus::kInProgress) &&
|
||||
type == PayloadContent::Type::kFile) {
|
||||
NL_LOG(WARNING) << __func__
|
||||
<< ": Unknown payload has been canceled, removing.";
|
||||
MutexLock lock(&mutex_);
|
||||
file_paths_to_delete_.insert(path);
|
||||
}
|
||||
// Unknown payload comes as kInProgress and kCanceled status with kFile type
|
||||
// from NearbyConnections. Delete it.
|
||||
if ((status == PayloadStatus::kCanceled ||
|
||||
status == PayloadStatus::kInProgress) &&
|
||||
type == PayloadContent::Type::kFile) {
|
||||
NL_LOG(WARNING) << __func__
|
||||
<< ": Unknown payload has been canceled, removing.";
|
||||
MutexLock lock(&mutex_);
|
||||
file_paths_to_delete_.insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "gmock/gmock.h"
|
||||
#include "protobuf-matchers/protocol-buffer-matchers.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/synchronization/notification.h"
|
||||
#include "absl/time/time.h"
|
||||
@@ -1788,29 +1789,11 @@ TEST_F(NearbyConnectionsManagerImplTest,
|
||||
payload_listener_remote.payload_cb(kRemoteEndpointId,
|
||||
Payload(kPayloadId, InputFile(file)));
|
||||
|
||||
// Flag is off. Don't add unknown file paths to the list.
|
||||
NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile,
|
||||
false);
|
||||
auto unknown_file_paths =
|
||||
nearby_connections_manager_->GetUnknownFilePathsToDeleteForTesting();
|
||||
EXPECT_TRUE(unknown_file_paths.empty());
|
||||
nearby_connections_manager_->OnPayloadTransferUpdateForTesting(
|
||||
kRemoteEndpointId,
|
||||
PayloadTransferUpdate(kPayloadId, PayloadStatus::kCanceled, kTotalSize,
|
||||
/*bytes_transferred=*/kTotalSize));
|
||||
|
||||
// Flag is on. Add unknown file paths with kCanceled to the list.
|
||||
NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile,
|
||||
true);
|
||||
nearby_connections_manager_->OnPayloadTransferUpdateForTesting(
|
||||
kRemoteEndpointId,
|
||||
PayloadTransferUpdate(kPayloadId, PayloadStatus::kCanceled, kTotalSize,
|
||||
/*bytes_transferred=*/kTotalSize));
|
||||
unknown_file_paths =
|
||||
absl::flat_hash_set<std::filesystem::path> unknown_file_paths =
|
||||
nearby_connections_manager_->GetUnknownFilePathsToDeleteForTesting();
|
||||
EXPECT_EQ(unknown_file_paths.size(), 1);
|
||||
nearby_connections_manager_->GetAndClearUnknownFilePathsToDelete();
|
||||
@@ -1828,25 +1811,9 @@ TEST_F(NearbyConnectionsManagerImplTest,
|
||||
TEST_F(NearbyConnectionsManagerImplTest, ProcessUnknownFilePathsToDelete) {
|
||||
std::filesystem::path file(std::filesystem::temp_directory_path() /
|
||||
"file.jpg");
|
||||
// Flag is off. Don't add unknown file paths to the list.
|
||||
NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile,
|
||||
false);
|
||||
auto unknown_file_paths =
|
||||
nearby_connections_manager_->GetUnknownFilePathsToDeleteForTesting();
|
||||
nearby_connections_manager_->ProcessUnknownFilePathsToDeleteForTesting(
|
||||
PayloadStatus::kCanceled, PayloadContent::Type::kFile, file);
|
||||
EXPECT_TRUE(unknown_file_paths.empty());
|
||||
|
||||
// Flag is on. Add unknown file paths with kCanceled to the list.
|
||||
NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile,
|
||||
true);
|
||||
nearby_connections_manager_->ProcessUnknownFilePathsToDeleteForTesting(
|
||||
PayloadStatus::kCanceled, PayloadContent::Type::kFile, file);
|
||||
unknown_file_paths =
|
||||
absl::flat_hash_set<std::filesystem::path> unknown_file_paths =
|
||||
nearby_connections_manager_->GetUnknownFilePathsToDeleteForTesting();
|
||||
EXPECT_EQ(unknown_file_paths.size(), 1);
|
||||
nearby_connections_manager_->GetAndClearUnknownFilePathsToDelete();
|
||||
|
||||
@@ -2936,20 +2936,6 @@ void NearbySharingServiceImpl::OnReceivedIntroduction(
|
||||
session->session_id(), session->share_target(),
|
||||
/*referrer_package=*/std::nullopt, session->os_type());
|
||||
|
||||
// Controls BWU using a flag when receiving an introduction frame, since it
|
||||
// could be a problem before accepted by a user.
|
||||
if (!NearbyFlags::GetInstance().GetBoolFlag(
|
||||
sharing::config_package_nearby::nearby_sharing_feature::
|
||||
kUpgradeBandwidthAfterAccept)) {
|
||||
if (frame->has_start_transfer() && frame->start_transfer()) {
|
||||
if (session->TryUpgradeBandwidth()) {
|
||||
NL_LOG(INFO)
|
||||
<< __func__
|
||||
<< ": Upgrade bandwidth when receiving an introduction frame.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsOutOfStorage(device_info_,
|
||||
std::filesystem::u8path(settings_->GetCustomSavePath()),
|
||||
session->attachment_container().GetStorageSize())) {
|
||||
@@ -3251,16 +3237,12 @@ void NearbySharingServiceImpl::RemoveIncomingPayloads(
|
||||
NL_LOG(INFO) << __func__ << ": Cleaning up payloads due to transfer failure";
|
||||
nearby_connections_manager_->ClearIncomingPayloads();
|
||||
std::vector<std::filesystem::path> files_for_deletion;
|
||||
if (NearbyFlags::GetInstance().GetBoolFlag(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile)) {
|
||||
auto file_paths_to_delete =
|
||||
nearby_connections_manager_->GetAndClearUnknownFilePathsToDelete();
|
||||
for (auto it = file_paths_to_delete.begin();
|
||||
it != file_paths_to_delete.end(); ++it) {
|
||||
NL_VLOG(1) << __func__ << ": Has unknown file path to delete.";
|
||||
files_for_deletion.push_back(*it);
|
||||
}
|
||||
auto file_paths_to_delete =
|
||||
nearby_connections_manager_->GetAndClearUnknownFilePathsToDelete();
|
||||
for (auto it = file_paths_to_delete.begin();
|
||||
it != file_paths_to_delete.end(); ++it) {
|
||||
NL_VLOG(1) << __func__ << ": Has unknown file path to delete.";
|
||||
files_for_deletion.push_back(*it);
|
||||
}
|
||||
std::vector<std::filesystem::path> payload_file_path =
|
||||
session.GetPayloadFilePaths();
|
||||
|
||||
@@ -4893,10 +4893,6 @@ TEST_F(NearbySharingServiceImplTest, NoAdvertisingWhenHidden) {
|
||||
}
|
||||
|
||||
TEST_F(NearbySharingServiceImplTest, RemoveIncomingPayloads) {
|
||||
NearbyFlags::GetInstance().OverrideBoolFlagValue(
|
||||
config_package_nearby::nearby_sharing_feature::
|
||||
kDeleteUnexpectedReceivedFile,
|
||||
true);
|
||||
fake_nearby_connections_manager_->AddUnknownFilePathsToDeleteForTesting(
|
||||
"test1.txt");
|
||||
fake_nearby_connections_manager_->AddUnknownFilePathsToDeleteForTesting(
|
||||
|
||||
Reference in New Issue
Block a user