mirror of
https://github.com/ironfox-oss/IronFox.git
synced 2026-06-11 09:44:46 -04:00
269 lines
14 KiB
Diff
269 lines
14 KiB
Diff
From 4728d0def635131c5267b6dc099ab267ce29aa6b Mon Sep 17 00:00:00 2001
|
|
From: Akash Yadav <itsaky01@gmail.com>
|
|
Date: Mon, 28 Apr 2025 10:32:16 +0530
|
|
Subject: [PATCH] fix(patches): update
|
|
'disable-accessibility-services-by-default.patch' for
|
|
'FIREFOX_138_0_BUILD1'
|
|
|
|
Signed-off-by: Akash Yadav <itsaky01@gmail.com>
|
|
---
|
|
.../browser/engine/gecko/GeckoEngine.kt | 9 ++++++
|
|
.../components/concept/engine/Settings.kt | 6 ++++
|
|
.../java/org/mozilla/fenix/components/Core.kt | 1 +
|
|
.../fenix/settings/AccessibilityFragment.kt | 14 ++++++++
|
|
.../java/org/mozilla/fenix/utils/Settings.kt | 13 +++++++-
|
|
.../src/main/res/values/preference_keys.xml | 2 ++
|
|
.../res/xml/accessibility_preferences.xml | 5 +++
|
|
mobile/android/geckoview/api.txt | 3 ++
|
|
.../geckoview/GeckoRuntimeSettings.java | 32 +++++++++++++++++++
|
|
9 files changed, 84 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt b/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt
|
|
index d3bfbfa762..6f09eee718 100644
|
|
--- a/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt
|
|
+++ b/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt
|
|
@@ -1473,6 +1473,14 @@ class GeckoEngine(
|
|
override var postQuantumKeyExchangeEnabled: Boolean
|
|
get() = runtime.settings.postQuantumKeyExchangeEnabled
|
|
set(value) { runtime.settings.setPostQuantumKeyExchangeEnabled(value) }
|
|
+
|
|
+ override var accessibilityEnabled: Boolean
|
|
+ get() = runtime.settings.accessibilityEnabled
|
|
+ set(value) {
|
|
+ value.let {
|
|
+ runtime.settings.accessibilityEnabled = it
|
|
+ }
|
|
+ }
|
|
}.apply {
|
|
defaultSettings?.let {
|
|
this.javascriptEnabled = it.javascriptEnabled
|
|
@@ -1515,6 +1523,7 @@ class GeckoEngine(
|
|
this.cookieBehaviorOptInPartitioningPBM = it.cookieBehaviorOptInPartitioningPBM
|
|
this.certificateTransparencyMode = it.certificateTransparencyMode
|
|
this.postQuantumKeyExchangeEnabled = it.postQuantumKeyExchangeEnabled
|
|
+ this.accessibilityEnabled = it.accessibilityEnabled
|
|
}
|
|
}
|
|
|
|
diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt
|
|
index db66cbe503..76dde3a5bb 100644
|
|
--- a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt
|
|
+++ b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt
|
|
@@ -340,6 +340,11 @@ abstract class Settings {
|
|
* in TLS and HTTP/3.
|
|
*/
|
|
open var postQuantumKeyExchangeEnabled: Boolean by UnsupportedSetting()
|
|
+
|
|
+ /**
|
|
+ * Setting to control Accessibility Services.
|
|
+ */
|
|
+ open var accessibilityEnabled: Boolean by UnsupportedSetting()
|
|
}
|
|
|
|
/**
|
|
@@ -408,6 +413,7 @@ data class DefaultSettings(
|
|
override var cookieBehaviorOptInPartitioningPBM: Boolean = false,
|
|
override var certificateTransparencyMode: Int = 0,
|
|
override var postQuantumKeyExchangeEnabled: Boolean = false,
|
|
+ override var accessibilityEnabled: Boolean = false,
|
|
) : Settings() {
|
|
override val desktopModeEnabled: Boolean
|
|
get() = getDesktopMode()
|
|
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
|
|
index 9a9487a930..7358b9ccd7 100644
|
|
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
|
|
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
|
|
@@ -182,6 +182,7 @@ class Core(
|
|
parallelMarkingEnabled = FxNimbus.features.javascript.value().parallelMarkingEnabled,
|
|
certificateTransparencyMode = FxNimbus.features.pki.value().certificateTransparencyMode,
|
|
postQuantumKeyExchangeEnabled = FxNimbus.features.pqcrypto.value().postQuantumKeyExchangeEnabled,
|
|
+ accessibilityEnabled = context.settings().accessibilityEnabled,
|
|
)
|
|
|
|
// Apply fingerprinting protection overrides if the feature is enabled in Nimbus
|
|
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/AccessibilityFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/AccessibilityFragment.kt
|
|
index 1122dc0b0f..456f387812 100644
|
|
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/AccessibilityFragment.kt
|
|
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/AccessibilityFragment.kt
|
|
@@ -23,6 +23,20 @@ class AccessibilityFragment : PreferenceFragmentCompat() {
|
|
super.onResume()
|
|
showToolbar(getString(R.string.preferences_accessibility))
|
|
|
|
+ val accessibilityEnabledPreference = requirePreference<SwitchPreference>(
|
|
+ R.string.pref_key_accessibility_enabled,
|
|
+ )
|
|
+
|
|
+ accessibilityEnabledPreference.setOnPreferenceChangeListener<Boolean> { preference, accessibilityEnabled ->
|
|
+ val settings = preference.context.settings()
|
|
+ val components = preference.context.components
|
|
+
|
|
+ settings.accessibilityEnabled = accessibilityEnabled
|
|
+ components.core.engine.settings.accessibilityEnabled = accessibilityEnabled
|
|
+
|
|
+ true
|
|
+ }
|
|
+
|
|
val forceZoomPreference = requirePreference<SwitchPreference>(
|
|
R.string.pref_key_accessibility_force_enable_zoom,
|
|
)
|
|
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
|
index 8e271198b0..46baf40a56 100644
|
|
--- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
|
+++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
|
|
@@ -1074,6 +1074,11 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|
} else {
|
|
ToolbarPosition.TOP
|
|
}
|
|
+
|
|
+ var accessibilityEnabled by booleanPreference(
|
|
+ appContext.getPreferenceKey(R.string.pref_key_accessibility_enabled),
|
|
+ default = false,
|
|
+ )
|
|
|
|
/**
|
|
* Check each active accessibility service to see if it can perform gestures, if any can,
|
|
@@ -1081,6 +1086,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|
*/
|
|
val switchServiceIsEnabled: Boolean
|
|
get() {
|
|
+ if (!accessibilityEnabled) {
|
|
+ return false
|
|
+ }
|
|
val accessibilityManager =
|
|
appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
|
|
|
|
@@ -1097,6 +1105,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|
|
|
val touchExplorationIsEnabled: Boolean
|
|
get() {
|
|
+ if (!accessibilityEnabled) {
|
|
+ return false
|
|
+ }
|
|
val accessibilityManager =
|
|
appContext.getSystemService(Context.ACCESSIBILITY_SERVICE) as? AccessibilityManager
|
|
return accessibilityManager?.isTouchExplorationEnabled ?: false
|
|
@@ -1104,7 +1115,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|
|
|
val accessibilityServicesEnabled: Boolean
|
|
get() {
|
|
- return touchExplorationIsEnabled || switchServiceIsEnabled
|
|
+ return accessibilityEnabled && (touchExplorationIsEnabled || switchServiceIsEnabled)
|
|
}
|
|
|
|
fun getDeleteDataOnQuit(type: DeleteBrowsingDataOnQuitType): Boolean =
|
|
diff --git a/mobile/android/fenix/app/src/main/res/values/preference_keys.xml b/mobile/android/fenix/app/src/main/res/values/preference_keys.xml
|
|
index dbb7ece65c..12674ea37e 100644
|
|
--- a/mobile/android/fenix/app/src/main/res/values/preference_keys.xml
|
|
+++ b/mobile/android/fenix/app/src/main/res/values/preference_keys.xml
|
|
@@ -464,4 +464,6 @@
|
|
<string name="pref_key_setup_step_toolbar" translatable="false">pref_key_setup_step_toolbar</string>
|
|
<string name="pref_key_setup_step_theme" translatable="false">pref_key_setup_step_theme</string>
|
|
<string name="pref_key_setup_step_extensions" translatable="false">pref_key_setup_step_extensions</string>
|
|
+ <!-- Accessibility Services -->
|
|
+ <string name="pref_key_accessibility_enabled" translatable="false">pref_key_accessibility_enabled</string>
|
|
</resources>
|
|
diff --git a/mobile/android/fenix/app/src/main/res/xml/accessibility_preferences.xml b/mobile/android/fenix/app/src/main/res/xml/accessibility_preferences.xml
|
|
index a810f76208..f9381cbc86 100644
|
|
--- a/mobile/android/fenix/app/src/main/res/xml/accessibility_preferences.xml
|
|
+++ b/mobile/android/fenix/app/src/main/res/xml/accessibility_preferences.xml
|
|
@@ -4,6 +4,11 @@
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
+ <SwitchPreference
|
|
+ android:defaultValue="false"
|
|
+ android:key="@string/pref_key_accessibility_enabled"
|
|
+ android:summary="@string/preference_accessibility_enabled_summary"
|
|
+ android:title="@string/preference_accessibility_enabled" />
|
|
<SwitchPreference
|
|
android:defaultValue="true"
|
|
android:key="@string/pref_key_accessibility_auto_size"
|
|
diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt
|
|
index d1af0917aa..e49a901bf6 100644
|
|
--- a/mobile/android/geckoview/api.txt
|
|
+++ b/mobile/android/geckoview/api.txt
|
|
@@ -914,6 +914,7 @@ package org.mozilla.geckoview {
|
|
method @Nullable public Integer getWebContentIsolationStrategy();
|
|
method public boolean getWebFontsEnabled();
|
|
method public boolean getWebManifestEnabled();
|
|
+ method public boolean getAccessibilityEnabled();
|
|
method @NonNull public GeckoRuntimeSettings setAboutConfigEnabled(boolean);
|
|
method @NonNull public GeckoRuntimeSettings setAllowInsecureConnections(int);
|
|
method @NonNull public GeckoRuntimeSettings setAutomaticFontSizeAdjustment(boolean);
|
|
@@ -956,6 +957,7 @@ package org.mozilla.geckoview {
|
|
method @NonNull public GeckoRuntimeSettings setWebContentIsolationStrategy(@NonNull Integer);
|
|
method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean);
|
|
method @NonNull public GeckoRuntimeSettings setWebManifestEnabled(boolean);
|
|
+ method @NonNull public GeckoRuntimeSettings setAccessibilityEnabled(boolean);
|
|
field public static final int ALLOW_ALL = 0;
|
|
field public static final int COLOR_SCHEME_DARK = 1;
|
|
field public static final int COLOR_SCHEME_LIGHT = 0;
|
|
@@ -1016,6 +1018,7 @@ package org.mozilla.geckoview {
|
|
method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean);
|
|
method @NonNull public GeckoRuntimeSettings.Builder webFontsEnabled(boolean);
|
|
method @NonNull public GeckoRuntimeSettings.Builder webManifest(boolean);
|
|
+ method @NonNull public GeckoRuntimeSettings.Builder accessibilityEnabled(boolean);
|
|
method @NonNull protected GeckoRuntimeSettings newSettings(@Nullable GeckoRuntimeSettings);
|
|
}
|
|
|
|
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
|
|
index 30a300d9eb..36c025bfdc 100644
|
|
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
|
|
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
|
|
@@ -601,6 +601,17 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
|
getSettings().setLargeKeepaliveFactor(factor);
|
|
return this;
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Sets whether we should enable Accessibility Services.
|
|
+ *
|
|
+ * @param flag True if we should enable Accessibility Services, false otherwise.
|
|
+ * @return This Builder instance.
|
|
+ */
|
|
+ public @NonNull Builder accessibilityEnabled(final boolean flag) {
|
|
+ getSettings().mAccessibilityEnabled.set(flag ? 0 : 1);
|
|
+ return this;
|
|
+ }
|
|
}
|
|
|
|
private GeckoRuntime mRuntime;
|
|
@@ -704,6 +715,7 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
|
new Pref<Boolean>("security.tls.enable_kyber", false);
|
|
/* package */ final Pref<Boolean> mPostQuantumKeyExchangeHttp3Enabled =
|
|
new Pref<Boolean>("network.http.http3.enable_kyber", false);
|
|
+ /* package */ final Pref<Integer> mAccessibilityEnabled = new Pref<>("accessibility.force_disabled", 1);
|
|
|
|
/* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM;
|
|
|
|
@@ -2041,6 +2053,26 @@ public final class GeckoRuntimeSettings extends RuntimeSettings {
|
|
return mPostQuantumKeyExchangeTLSEnabled.get() && mPostQuantumKeyExchangeHttp3Enabled.get();
|
|
}
|
|
|
|
+ /**
|
|
+ * Get whether we should enable Accessibility Services.
|
|
+ *
|
|
+ * @return Whether we should enable Accessibility Services.
|
|
+ */
|
|
+ public boolean getAccessibilityEnabled() {
|
|
+ return mAccessibilityEnabled.get() == 0;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Set whether we should enable Accessibility Services.
|
|
+ *
|
|
+ * @param flag A flag determining whether we should enable Accessibility Services.
|
|
+ * @return This GeckoRuntimeSettings instance.
|
|
+ */
|
|
+ public @NonNull GeckoRuntimeSettings setAccessibilityEnabled(final boolean flag) {
|
|
+ mAccessibilityEnabled.commit(flag ? 0 : 1);
|
|
+ return this;
|
|
+ }
|
|
+
|
|
// For internal use only
|
|
/* protected */ @NonNull
|
|
GeckoRuntimeSettings setProcessCount(final int processCount) {
|
|
--
|
|
2.49.0
|
|
|