From 9ef62194811784bd167b78193d248be3a7e72364 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Wed, 10 Sep 2025 11:57:10 +0200 Subject: [PATCH] Disable Device Attributes API: keep the feature disabled in the (unlikely) event that it is activated in Chromium --- build/cromite_patches_list.txt | 1 + .../Disable-Device-Attributes-API.patch | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 build/patches/Disable-Device-Attributes-API.patch diff --git a/build/cromite_patches_list.txt b/build/cromite_patches_list.txt index 4de42d76..878cc5de 100644 --- a/build/cromite_patches_list.txt +++ b/build/cromite_patches_list.txt @@ -303,6 +303,7 @@ Add-cromite-test-support.patch Android-Pixel-Perfect-Mode.patch Set-caret-blink-interval-to-default.patch Set-the-screen-frame-rate-to-60-Hz.patch +Disable-Device-Attributes-API.patch Temp-disable-UseContextSnapshot.patch # temporary or wip patches diff --git a/build/patches/Disable-Device-Attributes-API.patch b/build/patches/Disable-Device-Attributes-API.patch new file mode 100644 index 00000000..5d45f8fb --- /dev/null +++ b/build/patches/Disable-Device-Attributes-API.patch @@ -0,0 +1,32 @@ +From: uazo +Date: Wed, 10 Sep 2025 07:46:17 +0000 +Subject: Disable Device Attributes API + +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + chrome/browser/device_api/device_service_impl.cc | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/chrome/browser/device_api/device_service_impl.cc b/chrome/browser/device_api/device_service_impl.cc +--- a/chrome/browser/device_api/device_service_impl.cc ++++ b/chrome/browser/device_api/device_service_impl.cc +@@ -166,6 +166,7 @@ bool IsPermissionsPolicyFeatureEnabled() { + + bool IsTrustedContext(content::RenderFrameHost& host, + const url::Origin& origin) { ++ if ((true)) return false; + // Do not create the service for the incognito mode. + if (GetProfile(host)->IsIncognitoProfile()) { + return false; +@@ -361,6 +362,10 @@ void DeviceServiceImpl::GetAnnotatedLocation( + void DeviceServiceImpl::GetDeviceAttribute( + void (DeviceAttributeApi::*method)(DeviceAttributeCallback callback), + DeviceAttributeCallback callback) { ++ if ((true)) { ++ device_attribute_api_->ReportNotAllowedError(std::move(callback)); ++ return; ++ } + if (!IsAffiliatedUser()) { + device_attribute_api_->ReportNotAffiliatedError(std::move(callback)); + return; +--