Skip to content

Commit

Permalink
Remove bluetooth-advertisement-monitoring flag and associated cleanup
Browse files Browse the repository at this point in the history
Bug: https://b.corp.google.com/issues/225391566
Change-Id: I21f78a7c5c85ee5cc73f4202da1e4e58132f8baf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3635666
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Michael Hansen <hansenmichael@google.com>
Reviewed-by: Regan Hsu <hsuregan@chromium.org>
Commit-Queue: Josh Graydus <jgraydus@google.com>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001703}
  • Loading branch information
Josh Graydus authored and Chromium LUCI CQ committed May 10, 2022
1 parent dab1bec commit 84ef1a3
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 93 deletions.
7 changes: 0 additions & 7 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6130,13 +6130,6 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kSkiaRendererDescription, kOsAll,
FEATURE_VALUE_TYPE(features::kUseSkiaRenderer)},

#if BUILDFLAG(IS_CHROMEOS)
{"bluetooth-advertisement-monitoring",
flag_descriptions::kBluetoothAdvertisementMonitoringName,
flag_descriptions::kBluetoothAdvertisementMonitoringDescription, kOsCrOS,
FEATURE_VALUE_TYPE(chromeos::features::kBluetoothAdvertisementMonitoring)},
#endif // BUILDFLAG(IS_CHROMEOS)

#if BUILDFLAG(IS_CHROMEOS_ASH)
{"allow-disable-touchpad-haptic-feedback",
flag_descriptions::kAllowDisableTouchpadHapticFeedbackName,
Expand Down
5 changes: 0 additions & 5 deletions chrome/browser/flag-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,6 @@
"owners": [ "alancutter", "desktop-pwas-team@google.com" ],
"expiry_milestone": 110
},
{
"name": "bluetooth-advertisement-monitoring",
"owners": [ "cvandermerwe@google.com", "hansenmichael@google.com", "chromeos-cross-device-eng@google.com" ],
"expiry_milestone": 98
},
{
"name": "bluetooth-bond-on-demand",
"owners": [ "cmumford@chromium.org", "deviceapi-team@google.com" ],
Expand Down
11 changes: 1 addition & 10 deletions chrome/browser/flag_descriptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4471,9 +4471,7 @@ const char kEnableFakeKeyboardHeuristicDescription[] =
const char kFastPairName[] = "Enable Fast Pair";
const char kFastPairDescription[] =
"Enables Google Fast Pair service which uses BLE to discover supported "
"nearby Bluetooth devices and surfaces a notification for quick pairing. "
"Use along with #bluetooth-advertisement-monitoring to allow background "
"scanning.";
"nearby Bluetooth devices and surfaces a notification for quick pairing.";

const char kFastPairLowPowerName[] = "Enable Fast Pair Low Power mode";
const char kFastPairLowPowerDescription[] =
Expand Down Expand Up @@ -5551,13 +5549,6 @@ const char kAllowDefaultWebAppMigrationForChromeOsManagedUsersDescription[] =
"chrome://flags/#enable-migrate-default-chrome-app-to-web-apps-non-gsuite) "
"are ignored for managed ChromeOS users unless this feature is enabled.";

const char kBluetoothAdvertisementMonitoringName[] =
"Bluetooth Advertisement Monitoring";
const char kBluetoothAdvertisementMonitoringDescription[] =
"Advertisement monitoring allows applications to register low energy "
"scanners that filter low energy advertisements in a power-efficient "
"manner.";

const char kCrOSDspBasedAecAllowedName[] =
"Allow CRAS to use a DSP-based AEC if available";
const char kCrOSDspBasedAecAllowedDescription[] =
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/flag_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3183,9 +3183,6 @@ extern const char kAllowDefaultWebAppMigrationForChromeOsManagedUsersName[];
extern const char
kAllowDefaultWebAppMigrationForChromeOsManagedUsersDescription[];

extern const char kBluetoothAdvertisementMonitoringName[];
extern const char kBluetoothAdvertisementMonitoringDescription[];

extern const char kCrOSDspBasedAecAllowedName[];
extern const char kCrOSDspBasedAecAllowedDescription[];

Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/nearby_sharing/nearby_share_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ void NearbyShareSettings::OnEnabledPrefChanged() {
}

if (base::FeatureList::IsEnabled(
features::kNearbySharingBackgroundScanning) &&
chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
features::kNearbySharingBackgroundScanning)) {
ProcessFastInitiationNotificationParentPrefChanged(enabled);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ class NearbyShareSettingsTest : public ::testing::Test {
NearbyShareSettingsTest() : local_device_data_manager_(kDefaultDeviceName) {
scoped_feature_list_.InitWithFeatures(
/*enabled_features=*/{features::kNearbySharing,
features::kNearbySharingBackgroundScanning,
chromeos::features::
kBluetoothAdvertisementMonitoring},
features::kNearbySharingBackgroundScanning},
/*disabled_features=*/{});

RegisterNearbySharingPrefs(pref_service_.registry());
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ constexpr base::TimeDelta kNearbyVisibilityReminderTimerDelay = base::Days(180);

bool IsBackgroundScanningFeatureEnabled() {
return base::FeatureList::IsEnabled(
features::kNearbySharingBackgroundScanning) &&
chromeos::features::IsBluetoothAdvertisementMonitoringEnabled();
features::kNearbySharingBackgroundScanning);
}

std::string ReceiveSurfaceStateToString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,9 @@ void MultiDeviceSection::AddLoadTimeData(
NearbySharingServiceFactory::IsNearbyShareSupportedForBrowserContext(
profile()));
// Background scanning depends on Bluetooth Advertisement Monitoring.
html_source->AddBoolean(
"isNearbyShareBackgroundScanningEnabled",
chromeos::features::IsBluetoothAdvertisementMonitoringEnabled() &&
base::FeatureList::IsEnabled(
::features::kNearbySharingBackgroundScanning));
html_source->AddBoolean("isNearbyShareBackgroundScanningEnabled",
base::FeatureList::IsEnabled(
::features::kNearbySharingBackgroundScanning));
html_source->AddBoolean("isEcheAppEnabled", features::IsEcheSWAEnabled());
bool is_phone_screen_lock_enabled =
static_cast<phonehub::ScreenLockManager::LockStatus>(
Expand Down
10 changes: 0 additions & 10 deletions chromeos/constants/chromeos_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ const base::Feature kLacrosTtsSupport{"LacrosTtsSupport",

namespace features {

// Enables or disables the ability to use advertisement monitoring.
// Advertisement monitoring allows applications to register low energy scanners
// that filter low energy advertisements in a power-efficient manner.
const base::Feature kBluetoothAdvertisementMonitoring{
"BluetoothAdvertisementMonitoring", base::FEATURE_ENABLED_BY_DEFAULT};

// Enables or disables more filtering out of phones from the Bluetooth UI.
const base::Feature kBluetoothPhoneFilter{"BluetoothPhoneFilter",
base::FEATURE_ENABLED_BY_DEFAULT};
Expand All @@ -44,10 +38,6 @@ const base::Feature kQuickAnswersAlwaysTriggerForSingleWord{
const base::Feature kQuickAnswersForMoreLocales{
"QuickAnswersForMoreLocales", base::FEATURE_DISABLED_BY_DEFAULT};

bool IsBluetoothAdvertisementMonitoringEnabled() {
return base::FeatureList::IsEnabled(kBluetoothAdvertisementMonitoring);
}

bool IsDarkLightModeEnabled() {
return base::FeatureList::IsEnabled(kDarkLightMode);
}
Expand Down
4 changes: 0 additions & 4 deletions chromeos/constants/chromeos_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ namespace features {
// alongside the definition of their values in the .cc file. If a feature is
// being rolled out via Finch, add a comment in the .cc file.

COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBluetoothAdvertisementMonitoring;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBluetoothPhoneFilter;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDarkLightMode;
Expand All @@ -38,8 +36,6 @@ extern const base::Feature kQuickAnswersForMoreLocales;

// Keep alphabetized.

COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsBluetoothAdvertisementMonitoringEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsDarkLightModeEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsQuickAnswersV2TranslationDisabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
Expand Down
3 changes: 0 additions & 3 deletions device/bluetooth/bluetooth_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,6 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapter
// an identical scanning session, it should discard its newly invalidated
// BluetoothLowEnergyScanSession and create a new one by calling
// StartLowEnergyScanSession() again.
//
// Returns a nullptr if the BluetoothAdvertisementMonitoring chrome flag is
// not enabled.
virtual std::unique_ptr<BluetoothLowEnergyScanSession>
StartLowEnergyScanSession(
std::unique_ptr<BluetoothLowEnergyScanFilter> filter,
Expand Down
20 changes: 5 additions & 15 deletions device/bluetooth/bluez/bluetooth_adapter_bluez.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,10 @@ void BluetoothAdapterBlueZ::Init() {
DCHECK(agent_.get());

#if BUILDFLAG(IS_CHROMEOS)
if (chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
advertisement_monitor_application_provider_ =
BluetoothAdvertisementMonitorApplicationServiceProvider::Create(
system_bus,
dbus::ObjectPath(kAdvertisementMonitorApplicationObjectPath));
}
advertisement_monitor_application_provider_ =
BluetoothAdvertisementMonitorApplicationServiceProvider::Create(
system_bus,
dbus::ObjectPath(kAdvertisementMonitorApplicationObjectPath));
#endif // BUILDFLAG(IS_CHROMEOS)

std::vector<dbus::ObjectPath> object_paths = bluez::BluezDBusManager::Get()
Expand Down Expand Up @@ -1590,10 +1588,6 @@ std::unique_ptr<device::BluetoothLowEnergyScanSession>
BluetoothAdapterBlueZ::StartLowEnergyScanSession(
std::unique_ptr<device::BluetoothLowEnergyScanFilter> filter,
base::WeakPtr<device::BluetoothLowEnergyScanSession::Delegate> delegate) {
if (!chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
return nullptr;
}

DCHECK(filter);

dbus::ObjectPath monitor_path = dbus::ObjectPath(
Expand Down Expand Up @@ -1637,9 +1631,6 @@ BluetoothAdapterBlueZ::StartLowEnergyScanSession(

BluetoothAdapter::LowEnergyScanSessionHardwareOffloadingStatus
BluetoothAdapterBlueZ::GetLowEnergyScanSessionHardwareOffloadingStatus() {
if (!chromeos::features::IsBluetoothAdvertisementMonitoringEnabled())
return LowEnergyScanSessionHardwareOffloadingStatus::kNotSupported;

if (!IsPresent())
return LowEnergyScanSessionHardwareOffloadingStatus::kUndetermined;

Expand Down Expand Up @@ -2184,8 +2175,7 @@ void BluetoothAdapterBlueZ::UpdateDeviceBatteryLevelFromBatteryClient(
void BluetoothAdapterBlueZ::
RegisterAdvertisementMonitorApplicationServiceProvider() {
if (is_advertisement_monitor_application_provider_registered_ ||
!IsPresent() ||
!chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
!IsPresent()) {
return;
}
BLUETOOTH_LOG(EVENT) << __func__;
Expand Down
14 changes: 2 additions & 12 deletions device/bluetooth/bluez/bluetooth_bluez_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

#if BUILDFLAG(IS_CHROMEOS)
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "chromeos/constants/chromeos_features.h"
#include "device/bluetooth/bluetooth_low_energy_scan_filter.h"
Expand Down Expand Up @@ -262,14 +261,8 @@ class FakeBluetoothLowEnergyScanSessionDelegate

class BluetoothBlueZTest : public testing::Test {
public:
#if BUILDFLAG(IS_CHROMEOS)
BluetoothBlueZTest() {
scoped_feature_list_.InitWithFeatures(
/*enabled_features=*/{chromeos::features::
kBluetoothAdvertisementMonitoring},
/*disabled_features=*/{});
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS
BluetoothBlueZTest() = default;

static const char kGapUuid[];
static const char kGattUuid[];
static const char kPnpUuid[];
Expand Down Expand Up @@ -507,9 +500,6 @@ class BluetoothBlueZTest : public testing::Test {
if (base::RunLoop::IsRunningOnCurrentThread())
base::RunLoop::QuitCurrentWhenIdleDeprecated();
}
#if BUILDFLAG(IS_CHROMEOS)
base::test::ScopedFeatureList scoped_feature_list_;
#endif
};

// This class was created to test BluetoothDeviceBluez::Connect() and
Expand Down
12 changes: 4 additions & 8 deletions device/bluetooth/dbus/bluetooth_dbus_client_bundle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ BluetoothDBusClientBundle::BluetoothDBusClientBundle(bool use_fakes)
bluetooth_le_advertising_manager_client_.reset(
BluetoothLEAdvertisingManagerClient::Create());
#if BUILDFLAG(IS_CHROMEOS)
if (chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
bluetooth_advertisement_monitor_manager_client_ =
BluetoothAdvertisementMonitorManagerClient::Create();
}
bluetooth_advertisement_monitor_manager_client_ =
BluetoothAdvertisementMonitorManagerClient::Create();
#endif // BUILDFLAG(IS_CHROMEOS)
bluetooth_agent_manager_client_.reset(
BluetoothAgentManagerClient::Create());
Expand Down Expand Up @@ -86,10 +84,8 @@ BluetoothDBusClientBundle::BluetoothDBusClientBundle(bool use_fakes)
bluetooth_le_advertising_manager_client_ =
std::make_unique<FakeBluetoothLEAdvertisingManagerClient>();
#if BUILDFLAG(IS_CHROMEOS)
if (chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
bluetooth_advertisement_monitor_manager_client_ =
std::make_unique<FakeBluetoothAdvertisementMonitorManagerClient>();
}
bluetooth_advertisement_monitor_manager_client_ =
std::make_unique<FakeBluetoothAdvertisementMonitorManagerClient>();
#endif // BUILDFLAG(IS_CHROMEOS)
bluetooth_agent_manager_client_ =
std::make_unique<FakeBluetoothAgentManagerClient>();
Expand Down
6 changes: 2 additions & 4 deletions device/bluetooth/dbus/bluez_dbus_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ void BluezDBusManager::InitializeClients() {
client_bundle_->bluetooth_admin_policy_client()->Init(GetSystemBus(),
bluetooth_service_name);
#if BUILDFLAG(IS_CHROMEOS)
if (chromeos::features::IsBluetoothAdvertisementMonitoringEnabled()) {
client_bundle_->bluetooth_advertisement_monitor_manager_client()->Init(
GetSystemBus(), bluetooth_service_name);
}
client_bundle_->bluetooth_advertisement_monitor_manager_client()->Init(
GetSystemBus(), bluetooth_service_name);
#endif // BUILDFLAG(IS_CHROMEOS)
client_bundle_->bluetooth_agent_manager_client()->Init(
GetSystemBus(), bluetooth_service_name);
Expand Down

0 comments on commit 84ef1a3

Please sign in to comment.