From: uazo Date: Mon, 8 Nov 2021 09:47:23 +0000 Subject: Disable Accessibility service by default Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html Change-Id: Ida939f6a15b540382ad60d90f65394acbee22e53 --- .../android/java/res/xml/accessibility_preferences.xml | 5 +++++ .../browser_ui/strings/android/browser_ui_strings.grd | 6 ++++++ .../browser/accessibility/WebContentsAccessibilityImpl.java | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml --- a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml +++ b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml @@ -7,6 +7,11 @@ found in the LICENSE file. + + Recommended when TalkBack or Switch Access are on + + Enable Accessibility Service + + + Activates or deactivates the communication of all user activities in ui to the Accessibility provider + Captions diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java --- a/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/WebContentsAccessibilityImpl.java @@ -933,6 +933,11 @@ public class WebContentsAccessibilityImpl extends AccessibilityNodeProviderCompa structure.setChildCount(0); return; } + // Do not collect accessibility tree if disabled + if (!ContextUtils.getAppSharedPreferences().getBoolean("enable_accessibility", false)) { + structure.setChildCount(0); + return; + } structure.setChildCount(1); final ViewStructure viewRoot = structure.asyncNewChild(0); viewRoot.setClassName(""); -- 2.40.1