From: PF4Public@users.noreply.github.com
License: BSD
Subject: Fix building with use_bluez=false

This is a quick and dirty fix for building chromium with use_bluez=false
It prevents initialization and usage of Bluetooth by the browser
It is not supposed to be applied for use_bluez=true
WebAuthn is prevented from using Bluetooth, but it might still work with USB
see also https://github.com/PF4Public/gentoo-overlay/issues/254

---
--- a/chrome/browser/chrome_browser_main_linux.cc
+++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -65,8 +65,8 @@
 #endif  // BUILDFLAG(IS_CHROMEOS)
 
 #if !BUILDFLAG(IS_CHROMEOS)
-  bluez::BluezDBusManager::Initialize(
-      dbus_thread_linux::GetSharedSystemBus().get());
+  //bluez::BluezDBusManager::Initialize(
+  //    dbus_thread_linux::GetSharedSystemBus().get());
 
   // Set up crypt config. This needs to be done before anything starts the
   // network service, as the raw encryption key needs to be shared with the
@@ -133,7 +133,7 @@
 #if BUILDFLAG(IS_CHROMEOS)
   // No-op; per PostBrowserStart() comment, this is done elsewhere.
 #else
-  bluez::BluezDBusManager::Shutdown();
+  //bluez::BluezDBusManager::Shutdown();
 #endif  // BUILDFLAG(IS_CHROMEOS)
 
   ChromeBrowserMainPartsPosix::PostDestroyThreads();
--- a/device/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -40,6 +40,7 @@
 bool BluetoothAdapterFactory::IsBluetoothSupported() {
   // SetAdapterForTesting() may be used to provide a test or mock adapter
   // instance even on platforms that would otherwise not support it.
+  return false;
   if (Get()->adapter_)
     return true;
 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
@@ -51,6 +52,7 @@
 }
 
 bool BluetoothAdapterFactory::IsLowEnergySupported() {
+  return false;
   if (override_values_) {
     return override_values_->GetLESupported();
   }
--- a/chrome/browser/metrics/bluetooth_metrics_provider.cc
+++ b/chrome/browser/metrics/bluetooth_metrics_provider.cc
@@ -16,9 +16,7 @@

 bool BluetoothMetricsProvider::ProvideHistograms() {
   base::UmaHistogramEnumeration("Bluetooth.StackName",
-                                floss::features::IsFlossEnabled()
-                                    ? BluetoothStackName::kFloss
-                                    : BluetoothStackName::kBlueZ);
+                                BluetoothStackName::kBlueZ);
   return true;
 }

