Loading mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt +7 −0 Original line number Diff line number Diff line Loading @@ -1863,6 +1863,12 @@ class GeckoEngine( value?.let { runtime.settings.setBaselineFingerprintingProtectionOverrides(it) } } override var torSecurityLevel: Int get() = runtime.settings.torSecurityLevel set(value) { runtime.settings.torSecurityLevel = value } override var spoofEnglish: Boolean get() = runtime.settings.spoofEnglish set(value) { Loading Loading @@ -2028,6 +2034,7 @@ class GeckoEngine( this.userCharacteristicPingCurrentVersion = it.userCharacteristicPingCurrentVersion this.baselineFingerprintingProtection = it.baselineFingerprintingProtection this.baselineFingerprintingProtectionOverrides = it.baselineFingerprintingProtectionOverrides this.torSecurityLevel = it.torSecurityLevel this.spoofEnglish = it.spoofEnglish this.webContentIsolationStrategy = it.webContentIsolationStrategy this.fetchPriorityEnabled = it.fetchPriorityEnabled Loading mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt +12 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,17 @@ abstract class Settings { */ open var userCharacteristicPingCurrentVersion: Int by UnsupportedSetting() /** * Setting to control the current security level * * 4 -> STANDARD * * 2 -> SAFER * * 1 -> SAFEST */ open var torSecurityLevel: Int by UnsupportedSetting() open var spoofEnglish: Boolean by UnsupportedSetting() /** Loading Loading @@ -506,6 +517,7 @@ data class DefaultSettings( override var useContentBlockingDatabase: Boolean = false, override var emailTrackerBlockingPrivateBrowsing: Boolean = false, override var userCharacteristicPingCurrentVersion: Int = 0, override var torSecurityLevel: Int = 4, override var spoofEnglish: Boolean = false, override var webContentIsolationStrategy: WebContentIsolationStrategy? = WebContentIsolationStrategy.ISOLATE_HIGH_VALUE, Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt +1 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ class Core( cookieBannerHandlingGlobalRulesSubFrames = context.settings().shouldEnableCookieBannerGlobalRulesSubFrame, emailTrackerBlockingPrivateBrowsing = false, userCharacteristicPingCurrentVersion = FxNimbus.features.userCharacteristics.value().currentVersion, torSecurityLevel = context.settings().torSecurityLevel, spoofEnglish = context.settings().spoofEnglish, getDesktopMode = { store.state.desktopMode Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +20 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import android.content.Intent import android.os.Bundle import android.os.Handler import android.os.Looper import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.Toast Loading Loading @@ -82,6 +83,7 @@ import org.mozilla.fenix.perf.ProfilerViewModelFactory import org.mozilla.fenix.settings.account.AccountUiView import org.mozilla.fenix.snackbar.FenixSnackbarDelegate import org.mozilla.fenix.snackbar.SnackbarBinding import org.mozilla.fenix.tor.TorSecurityLevel import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference import kotlin.system.exitProcess Loading Loading @@ -432,6 +434,10 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment SettingsFragmentDirections.actionSettingsFragmentToPrivateBrowsingFragment() } resources.getString(R.string.pref_key_tor_security_level) -> { SettingsFragmentDirections.actionSettingsFragmentToTorSecurityLevelFragment() } resources.getString(R.string.pref_key_https_only_settings) -> { SettingsFragmentDirections.actionSettingsFragmentToHttpsOnlyFragment() } Loading Loading @@ -673,6 +679,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment FeatureFlags.customExtensionCollectionFeature, ) setupGeckoLogsPreference(settings) setupSecurityLevelPreference() setupHttpsOnlyPreferences(settings) setupIPProtectionPreferences(settings) setupNotificationPreference( Loading Loading @@ -914,6 +921,19 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment } } @VisibleForTesting internal fun setupSecurityLevelPreference() { val securityLevelPreference = requirePreference<Preference>(R.string.pref_key_tor_security_level) securityLevelPreference.summary = when (requireContext().settings().torSecurityLevel) { TorSecurityLevel.STANDARD.level -> getString(R.string.tor_security_level_standard) TorSecurityLevel.SAFER.level -> getString(R.string.tor_security_level_safer) TorSecurityLevel.SAFEST.level -> getString(R.string.tor_security_level_safest) else -> throw Exception("Unexpected TorSecurityLevel of ${requireContext().settings().torSecurityLevel}") } } private fun updateProfilerUI(profilerStatus: Boolean) { if (profilerStatus) { findPreference<Preference>(getPreferenceKey(R.string.pref_key_start_profiler))?.title = Loading mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorSecurityLevel.kt 0 → 100644 +13 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.fenix.tor import android.os.Parcelable import kotlinx.parcelize.Parcelize @Parcelize enum class TorSecurityLevel(val level: Int) : Parcelable { STANDARD(4), SAFER(2), SAFEST(1) } Loading
mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt +7 −0 Original line number Diff line number Diff line Loading @@ -1863,6 +1863,12 @@ class GeckoEngine( value?.let { runtime.settings.setBaselineFingerprintingProtectionOverrides(it) } } override var torSecurityLevel: Int get() = runtime.settings.torSecurityLevel set(value) { runtime.settings.torSecurityLevel = value } override var spoofEnglish: Boolean get() = runtime.settings.spoofEnglish set(value) { Loading Loading @@ -2028,6 +2034,7 @@ class GeckoEngine( this.userCharacteristicPingCurrentVersion = it.userCharacteristicPingCurrentVersion this.baselineFingerprintingProtection = it.baselineFingerprintingProtection this.baselineFingerprintingProtectionOverrides = it.baselineFingerprintingProtectionOverrides this.torSecurityLevel = it.torSecurityLevel this.spoofEnglish = it.spoofEnglish this.webContentIsolationStrategy = it.webContentIsolationStrategy this.fetchPriorityEnabled = it.fetchPriorityEnabled Loading
mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt +12 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,17 @@ abstract class Settings { */ open var userCharacteristicPingCurrentVersion: Int by UnsupportedSetting() /** * Setting to control the current security level * * 4 -> STANDARD * * 2 -> SAFER * * 1 -> SAFEST */ open var torSecurityLevel: Int by UnsupportedSetting() open var spoofEnglish: Boolean by UnsupportedSetting() /** Loading Loading @@ -506,6 +517,7 @@ data class DefaultSettings( override var useContentBlockingDatabase: Boolean = false, override var emailTrackerBlockingPrivateBrowsing: Boolean = false, override var userCharacteristicPingCurrentVersion: Int = 0, override var torSecurityLevel: Int = 4, override var spoofEnglish: Boolean = false, override var webContentIsolationStrategy: WebContentIsolationStrategy? = WebContentIsolationStrategy.ISOLATE_HIGH_VALUE, Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt +1 −0 Original line number Diff line number Diff line Loading @@ -200,6 +200,7 @@ class Core( cookieBannerHandlingGlobalRulesSubFrames = context.settings().shouldEnableCookieBannerGlobalRulesSubFrame, emailTrackerBlockingPrivateBrowsing = false, userCharacteristicPingCurrentVersion = FxNimbus.features.userCharacteristics.value().currentVersion, torSecurityLevel = context.settings().torSecurityLevel, spoofEnglish = context.settings().spoofEnglish, getDesktopMode = { store.state.desktopMode Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +20 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import android.content.Intent import android.os.Bundle import android.os.Handler import android.os.Looper import android.util.Log import android.view.LayoutInflater import android.view.View import android.widget.Toast Loading Loading @@ -82,6 +83,7 @@ import org.mozilla.fenix.perf.ProfilerViewModelFactory import org.mozilla.fenix.settings.account.AccountUiView import org.mozilla.fenix.snackbar.FenixSnackbarDelegate import org.mozilla.fenix.snackbar.SnackbarBinding import org.mozilla.fenix.tor.TorSecurityLevel import org.mozilla.fenix.utils.Settings import java.lang.ref.WeakReference import kotlin.system.exitProcess Loading Loading @@ -432,6 +434,10 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment SettingsFragmentDirections.actionSettingsFragmentToPrivateBrowsingFragment() } resources.getString(R.string.pref_key_tor_security_level) -> { SettingsFragmentDirections.actionSettingsFragmentToTorSecurityLevelFragment() } resources.getString(R.string.pref_key_https_only_settings) -> { SettingsFragmentDirections.actionSettingsFragmentToHttpsOnlyFragment() } Loading Loading @@ -673,6 +679,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment FeatureFlags.customExtensionCollectionFeature, ) setupGeckoLogsPreference(settings) setupSecurityLevelPreference() setupHttpsOnlyPreferences(settings) setupIPProtectionPreferences(settings) setupNotificationPreference( Loading Loading @@ -914,6 +921,19 @@ class SettingsFragment : PreferenceFragmentCompat(), SystemInsetsPaddedFragment } } @VisibleForTesting internal fun setupSecurityLevelPreference() { val securityLevelPreference = requirePreference<Preference>(R.string.pref_key_tor_security_level) securityLevelPreference.summary = when (requireContext().settings().torSecurityLevel) { TorSecurityLevel.STANDARD.level -> getString(R.string.tor_security_level_standard) TorSecurityLevel.SAFER.level -> getString(R.string.tor_security_level_safer) TorSecurityLevel.SAFEST.level -> getString(R.string.tor_security_level_safest) else -> throw Exception("Unexpected TorSecurityLevel of ${requireContext().settings().torSecurityLevel}") } } private fun updateProfilerUI(profilerStatus: Boolean) { if (profilerStatus) { findPreference<Preference>(getPreferenceKey(R.string.pref_key_start_profiler))?.title = Loading
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorSecurityLevel.kt 0 → 100644 +13 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.fenix.tor import android.os.Parcelable import kotlinx.parcelize.Parcelize @Parcelize enum class TorSecurityLevel(val level: Int) : Parcelable { STANDARD(4), SAFER(2), SAFEST(1) }