64 lines
3.8 KiB
Diff
64 lines
3.8 KiB
Diff
|
From: uazo <uazo@users.noreply.github.com>
|
||
|
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.
|
||
|
|
||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||
|
|
||
|
+ <org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference
|
||
|
+ android:key="enable_accessibility"
|
||
|
+ android:summary="@string/enable_accessibility_summary"
|
||
|
+ android:title="@string/enable_accessibility_title" />
|
||
|
+
|
||
|
<org.chromium.components.browser_ui.accessibility.TextScalePreference
|
||
|
android:key="text_scale"
|
||
|
android:title="@string/font_size"
|
||
|
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||
|
--- a/components/browser_ui/strings/android/browser_ui_strings.grd
|
||
|
+++ b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||
|
@@ -960,6 +960,12 @@
|
||
|
<message name="IDS_ACCESSIBILITY_TAB_SWITCHER_SUMMARY" desc="Summary of the preference that allows the user to use a simplified tab switcher. The simplified tab switcher is recommended for use with TalkBack and Switch Access which are accessibility services provided by Android. TalkBack does not need to be translated. 'Switch Access' translation should match TC ID 382005103867249841.">
|
||
|
Recommended when TalkBack or Switch Access are on
|
||
|
</message>
|
||
|
+ <message name="IDS_ENABLE_ACCESSIBILITY_TITLE" desc="Title of enable accessibility settings, which allows the user to enable service. [CHAR_LIMIT=32]">
|
||
|
+ Enable Accessibility Service
|
||
|
+ </message>
|
||
|
+ <message name="IDS_ENABLE_ACCESSIBILITY_SUMMARY" desc="Summary of enable accessibility settings.">
|
||
|
+ Activates or deactivates the communication of all user activities in ui to the Accessibility provider
|
||
|
+ </message>
|
||
|
<message name="IDS_ACCESSIBILITY_CAPTIONS_TITLE" desc="Title of the preference that allows the user to update caption settings.">
|
||
|
Captions
|
||
|
</message>
|
||
|
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
|
||
|
|