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 @@ -1614,6 +1614,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 @@ -1701,6 +1707,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 @@ -300,6 +300,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 @@ -430,6 +441,7 @@ data class DefaultSettings( override var queryParameterStrippingStripList: String = "", 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 @@ -184,6 +184,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 @@ -9,6 +9,7 @@ import android.content.DialogInterface 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 @@ -69,6 +70,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 kotlin.system.exitProcess import org.mozilla.fenix.GleanMetrics.Settings as SettingsMetrics Loading Loading @@ -378,6 +380,10 @@ class SettingsFragment : PreferenceFragmentCompat() { 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 @@ -588,6 +594,7 @@ class SettingsFragment : PreferenceFragmentCompat() { FeatureFlags.customExtensionCollectionFeature, ) setupGeckoLogsPreference(settings) setupSecurityLevelPreference() setupHttpsOnlyPreferences(settings) setupNotificationPreference( NotificationManagerCompat.from(requireContext()).areNotificationsEnabled(), Loading Loading @@ -798,6 +805,19 @@ class SettingsFragment : PreferenceFragmentCompat() { } } @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 @@ -1614,6 +1614,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 @@ -1701,6 +1707,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 @@ -300,6 +300,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 @@ -430,6 +441,7 @@ data class DefaultSettings( override var queryParameterStrippingStripList: String = "", 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 @@ -184,6 +184,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 @@ -9,6 +9,7 @@ import android.content.DialogInterface 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 @@ -69,6 +70,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 kotlin.system.exitProcess import org.mozilla.fenix.GleanMetrics.Settings as SettingsMetrics Loading Loading @@ -378,6 +380,10 @@ class SettingsFragment : PreferenceFragmentCompat() { 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 @@ -588,6 +594,7 @@ class SettingsFragment : PreferenceFragmentCompat() { FeatureFlags.customExtensionCollectionFeature, ) setupGeckoLogsPreference(settings) setupSecurityLevelPreference() setupHttpsOnlyPreferences(settings) setupNotificationPreference( NotificationManagerCompat.from(requireContext()).areNotificationsEnabled(), Loading Loading @@ -798,6 +805,19 @@ class SettingsFragment : PreferenceFragmentCompat() { } } @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) }