For #6479: Add granular ETP settings
parent
15ff4726a0
commit
bba563b5f9
|
@ -25,6 +25,8 @@ import mozilla.components.browser.storage.sync.PlacesHistoryStorage
|
||||||
import mozilla.components.concept.engine.DefaultSettings
|
import mozilla.components.concept.engine.DefaultSettings
|
||||||
import mozilla.components.concept.engine.Engine
|
import mozilla.components.concept.engine.Engine
|
||||||
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy
|
||||||
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy
|
||||||
|
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.TrackingCategory
|
||||||
import mozilla.components.concept.engine.mediaquery.PreferredColorScheme
|
import mozilla.components.concept.engine.mediaquery.PreferredColorScheme
|
||||||
import mozilla.components.concept.fetch.Client
|
import mozilla.components.concept.fetch.Client
|
||||||
import mozilla.components.feature.customtabs.store.CustomTabsServiceStore
|
import mozilla.components.feature.customtabs.store.CustomTabsServiceStore
|
||||||
|
@ -241,13 +243,24 @@ class Core(private val context: Context) {
|
||||||
* in private browsing mode, default to the current preference value.
|
* in private browsing mode, default to the current preference value.
|
||||||
* @return the constructed tracking protection policy based on preferences.
|
* @return the constructed tracking protection policy based on preferences.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("ComplexMethod")
|
||||||
fun createTrackingProtectionPolicy(
|
fun createTrackingProtectionPolicy(
|
||||||
normalMode: Boolean = context.settings().shouldUseTrackingProtection,
|
normalMode: Boolean = context.settings().shouldUseTrackingProtection,
|
||||||
privateMode: Boolean = true
|
privateMode: Boolean = true
|
||||||
): TrackingProtectionPolicy {
|
): TrackingProtectionPolicy {
|
||||||
val trackingProtectionPolicy =
|
val trackingProtectionPolicy =
|
||||||
if (context.settings().useStrictTrackingProtection) TrackingProtectionPolicy.strict() else
|
when {
|
||||||
TrackingProtectionPolicy.recommended()
|
context.settings().useStrictTrackingProtection -> TrackingProtectionPolicy.strict()
|
||||||
|
context.settings().useCustomTrackingProtection -> return TrackingProtectionPolicy.select(
|
||||||
|
cookiePolicy = geCustomCookiePolicy(),
|
||||||
|
trackingCategories = getCustomTrackingCategories()
|
||||||
|
).apply {
|
||||||
|
if (context.settings().blockTrackingContentSelectionInCustomTrackingProtection == "private") {
|
||||||
|
forPrivateSessionsOnly()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> TrackingProtectionPolicy.recommended()
|
||||||
|
}
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
normalMode && privateMode -> trackingProtectionPolicy
|
normalMode && privateMode -> trackingProtectionPolicy
|
||||||
|
@ -257,6 +270,39 @@ class Core(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun geCustomCookiePolicy(): CookiePolicy {
|
||||||
|
return when (context.settings().blockCookiesSelectionInCustomTrackingProtection) {
|
||||||
|
"all" -> CookiePolicy.ACCEPT_NONE
|
||||||
|
"social" -> CookiePolicy.ACCEPT_NON_TRACKERS
|
||||||
|
"unvisited" -> CookiePolicy.ACCEPT_VISITED
|
||||||
|
"third-party" -> CookiePolicy.ACCEPT_ONLY_FIRST_PARTY
|
||||||
|
else -> CookiePolicy.ACCEPT_NONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getCustomTrackingCategories(): Array<TrackingCategory> {
|
||||||
|
val categories = arrayListOf(
|
||||||
|
TrackingCategory.AD,
|
||||||
|
TrackingCategory.ANALYTICS,
|
||||||
|
TrackingCategory.SOCIAL,
|
||||||
|
TrackingCategory.MOZILLA_SOCIAL
|
||||||
|
)
|
||||||
|
|
||||||
|
if (context.settings().blockTrackingContentInCustomTrackingProtection) {
|
||||||
|
categories.add(TrackingCategory.SCRIPTS_AND_SUB_RESOURCES)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.settings().blockFingerprintersInCustomTrackingProtection) {
|
||||||
|
categories.add(TrackingCategory.FINGERPRINTING)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.settings().blockCryptominersInCustomTrackingProtection) {
|
||||||
|
categories.add(TrackingCategory.CRYPTOMINING)
|
||||||
|
}
|
||||||
|
|
||||||
|
return categories.toTypedArray()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets Preferred Color scheme based on Dark/Light Theme Settings or Current Configuration
|
* Sets Preferred Color scheme based on Dark/Light Theme Settings or Current Configuration
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* 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.settings
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.widget.ArrayAdapter
|
||||||
|
import androidx.preference.DropDownPreference
|
||||||
|
import org.mozilla.fenix.R
|
||||||
|
|
||||||
|
class DropDownListPreference @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null
|
||||||
|
) : DropDownPreference(context, attrs) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
layoutResource = R.layout.dropdown_preference_etp
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createAdapter(): ArrayAdapter<Any> {
|
||||||
|
return ArrayAdapter(context, R.layout.etp_dropdown_item)
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,8 @@ package org.mozilla.fenix.settings
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
|
import androidx.preference.CheckBoxPreference
|
||||||
|
import androidx.preference.DropDownPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
|
@ -34,9 +36,21 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
}
|
}
|
||||||
private lateinit var radioStrict: RadioButtonInfoPreference
|
private lateinit var radioStrict: RadioButtonInfoPreference
|
||||||
private lateinit var radioStandard: RadioButtonInfoPreference
|
private lateinit var radioStandard: RadioButtonInfoPreference
|
||||||
|
private lateinit var radioCustom: RadioButtonInfoPreference
|
||||||
|
private lateinit var customCookies: CheckBoxPreference
|
||||||
|
private lateinit var customCookiesSelect: DropDownPreference
|
||||||
|
private lateinit var customTracking: CheckBoxPreference
|
||||||
|
private lateinit var customTrackingSelect: DropDownPreference
|
||||||
|
private lateinit var customCryptominers: CheckBoxPreference
|
||||||
|
private lateinit var customFingerprinters: CheckBoxPreference
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.tracking_protection_preferences, rootKey)
|
setPreferencesFromResource(R.xml.tracking_protection_preferences, rootKey)
|
||||||
|
bindStrict()
|
||||||
|
bindStandard()
|
||||||
|
bindCustom()
|
||||||
|
setupRadioGroups()
|
||||||
|
updateCustomOptionsVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -59,10 +73,6 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
bindStrict()
|
|
||||||
bindStandard()
|
|
||||||
setupRadioGroups()
|
|
||||||
|
|
||||||
val trackingProtectionLearnMore =
|
val trackingProtectionLearnMore =
|
||||||
context!!.getPreferenceKey(R.string.pref_key_etp_learn_more)
|
context!!.getPreferenceKey(R.string.pref_key_etp_learn_more)
|
||||||
val learnMorePreference = findPreference<Preference>(trackingProtectionLearnMore)
|
val learnMorePreference = findPreference<Preference>(trackingProtectionLearnMore)
|
||||||
|
@ -100,6 +110,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
updateCustomOptionsVisibility()
|
||||||
return super.onPreferenceChange(preference, newValue)
|
return super.onPreferenceChange(preference, newValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +118,9 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
nav(
|
nav(
|
||||||
R.id.trackingProtectionFragment,
|
R.id.trackingProtectionFragment,
|
||||||
TrackingProtectionFragmentDirections
|
TrackingProtectionFragmentDirections
|
||||||
.actionTrackingProtectionFragmentToTrackingProtectionBlockingFragment(true)
|
.actionTrackingProtectionFragmentToTrackingProtectionBlockingFragment(
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_strict_default)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +140,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
updateCustomOptionsVisibility()
|
||||||
return super.onPreferenceChange(preference, newValue)
|
return super.onPreferenceChange(preference, newValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,11 +148,104 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
nav(
|
nav(
|
||||||
R.id.trackingProtectionFragment,
|
R.id.trackingProtectionFragment,
|
||||||
TrackingProtectionFragmentDirections
|
TrackingProtectionFragmentDirections
|
||||||
.actionTrackingProtectionFragmentToTrackingProtectionBlockingFragment(false)
|
.actionTrackingProtectionFragmentToTrackingProtectionBlockingFragment(
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_standard)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bindCustom() {
|
||||||
|
val keyCustom = getString(R.string.pref_key_tracking_protection_custom_option)
|
||||||
|
radioCustom = requireNotNull(findPreference(keyCustom))
|
||||||
|
radioCustom.contentDescription =
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_custom_info_button)
|
||||||
|
radioCustom.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||||
|
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||||
|
if (newValue == true) {
|
||||||
|
updateTrackingProtectionPolicy()
|
||||||
|
}
|
||||||
|
updateCustomOptionsVisibility()
|
||||||
|
return super.onPreferenceChange(preference, newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
radioCustom.onInfoClickListener {
|
||||||
|
nav(
|
||||||
|
R.id.trackingProtectionFragment,
|
||||||
|
TrackingProtectionFragmentDirections
|
||||||
|
.actionTrackingProtectionFragmentToTrackingProtectionBlockingFragment(
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_custom)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
customCookies = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_cookies)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
customCookiesSelect = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_cookies_select)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
customTracking = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_tracking_content)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
customTrackingSelect = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_tracking_content_select)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
customCryptominers = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_cryptominers)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
customFingerprinters = requireNotNull(
|
||||||
|
findPreference(
|
||||||
|
getString(R.string.pref_key_tracking_protection_custom_fingerprinters)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
customCookies.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||||
|
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||||
|
updateTrackingProtectionPolicy()
|
||||||
|
customCookiesSelect.isVisible = !customCookies.isChecked
|
||||||
|
return super.onPreferenceChange(preference, newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customTracking.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||||
|
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||||
|
updateTrackingProtectionPolicy()
|
||||||
|
customTrackingSelect.isVisible = !customTracking.isChecked
|
||||||
|
return super.onPreferenceChange(preference, newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customCookiesSelect.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||||
|
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||||
|
updateTrackingProtectionPolicy()
|
||||||
|
customTrackingSelect.isVisible = !customTracking.isChecked
|
||||||
|
return super.onPreferenceChange(preference, newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customTrackingSelect.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
|
||||||
|
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
|
||||||
|
updateTrackingProtectionPolicy()
|
||||||
|
customTrackingSelect.isVisible = !customTracking.isChecked
|
||||||
|
return super.onPreferenceChange(preference, newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCustomOptionsVisibility()
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateTrackingProtectionPolicy() {
|
private fun updateTrackingProtectionPolicy() {
|
||||||
context?.components?.let {
|
context?.components?.let {
|
||||||
val policy = it.core.createTrackingProtectionPolicy()
|
val policy = it.core.createTrackingProtectionPolicy()
|
||||||
|
@ -150,5 +257,21 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
|
||||||
private fun setupRadioGroups() {
|
private fun setupRadioGroups() {
|
||||||
radioStandard.addToRadioGroup(radioStrict)
|
radioStandard.addToRadioGroup(radioStrict)
|
||||||
radioStrict.addToRadioGroup(radioStandard)
|
radioStrict.addToRadioGroup(radioStandard)
|
||||||
|
|
||||||
|
radioStandard.addToRadioGroup(radioCustom)
|
||||||
|
radioCustom.addToRadioGroup(radioStandard)
|
||||||
|
|
||||||
|
radioStrict.addToRadioGroup(radioCustom)
|
||||||
|
radioCustom.addToRadioGroup(radioStrict)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateCustomOptionsVisibility() {
|
||||||
|
val isCustomSelected = requireContext().settings().useCustomTrackingProtection
|
||||||
|
customCookies.isVisible = isCustomSelected
|
||||||
|
customCookiesSelect.isVisible = isCustomSelected && customCookies.isChecked
|
||||||
|
customTracking.isVisible = isCustomSelected
|
||||||
|
customTrackingSelect.isVisible = isCustomSelected && customTracking.isChecked
|
||||||
|
customCryptominers.isVisible = isCustomSelected
|
||||||
|
customFingerprinters.isVisible = isCustomSelected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,29 +11,47 @@ import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
import kotlinx.android.synthetic.main.fragment_tracking_protection_blocking.*
|
import kotlinx.android.synthetic.main.fragment_tracking_protection_blocking.*
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.ext.showToolbar
|
import org.mozilla.fenix.ext.showToolbar
|
||||||
|
|
||||||
class TrackingProtectionBlockingFragment :
|
class TrackingProtectionBlockingFragment :
|
||||||
Fragment(R.layout.fragment_tracking_protection_blocking) {
|
Fragment(R.layout.fragment_tracking_protection_blocking) {
|
||||||
|
|
||||||
private val args: TrackingProtectionBlockingFragmentArgs by navArgs()
|
private val args: TrackingProtectionBlockingFragmentArgs by navArgs()
|
||||||
|
private var isCustomProtection: Boolean = false
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
isCustomProtection = requireContext().settings().useCustomTrackingProtection
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
category_fingerprinters.isVisible = args.strictMode
|
|
||||||
category_tracking_content.isVisible = args.strictMode
|
when (args.protectionMode) {
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_strict) -> {
|
||||||
|
category_fingerprinters.isVisible = true
|
||||||
|
category_tracking_content.isVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_custom) -> {
|
||||||
|
category_fingerprinters.isVisible =
|
||||||
|
requireContext().settings().blockFingerprintersInCustomTrackingProtection
|
||||||
|
category_cryptominers.isVisible =
|
||||||
|
requireContext().settings().blockCryptominersInCustomTrackingProtection
|
||||||
|
category_cookies.isVisible =
|
||||||
|
requireContext().settings().blockCookiesInCustomTrackingProtection
|
||||||
|
}
|
||||||
|
|
||||||
|
getString(R.string.preference_enhanced_tracking_protection_standard) -> return
|
||||||
|
|
||||||
|
else -> return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
showToolbar(getTitle())
|
showToolbar(args.protectionMode)
|
||||||
}
|
|
||||||
|
|
||||||
private fun getTitle(): String {
|
|
||||||
return if (args.strictMode) {
|
|
||||||
getString(R.string.preference_enhanced_tracking_protection_strict_default)
|
|
||||||
} else {
|
|
||||||
getString(R.string.preference_enhanced_tracking_protection_standard_option)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,40 @@ class Settings private constructor(
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val useCustomTrackingProtection by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_option),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
val blockCookiesInCustomTrackingProtection by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cookies),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
val blockCookiesSelectionInCustomTrackingProtection by stringPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cookies_select),
|
||||||
|
""
|
||||||
|
)
|
||||||
|
|
||||||
|
val blockTrackingContentInCustomTrackingProtection by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
|
val blockTrackingContentSelectionInCustomTrackingProtection by stringPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_tracking_content_select),
|
||||||
|
""
|
||||||
|
)
|
||||||
|
|
||||||
|
val blockCryptominersInCustomTrackingProtection by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_cryptominers),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
|
val blockFingerprintersInCustomTrackingProtection by booleanPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_tracking_protection_custom_fingerprinters),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
val shouldUseFixedTopToolbar: Boolean
|
val shouldUseFixedTopToolbar: Boolean
|
||||||
get() {
|
get() {
|
||||||
return touchExplorationIsEnabled || switchServiceIsEnabled
|
return touchExplorationIsEnabled || switchServiceIsEnabled
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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/. -->
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_checked="true">
|
||||||
|
<shape>
|
||||||
|
<solid android:color="#1415141A"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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/. -->
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners
|
||||||
|
android:radius="4dp"/>
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="?toolbarDivider"/>
|
||||||
|
<solid android:color="@android:color/transparent"/>
|
||||||
|
</shape>
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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/. -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="66dp"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingTop="@dimen/radio_button_preference_vertical"
|
||||||
|
android:paddingBottom="@dimen/radio_button_preference_vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@android:id/widget_frame"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:textColor="@color/state_list_text_color"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@android:id/summary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@android:id/widget_frame"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
|
tools:text="Cookies" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@android:id/summary"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:textColor="@color/secondary_state_list_text_color"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@android:id/widget_frame"
|
||||||
|
app:layout_constraintTop_toBottomOf="@android:id/title"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed"
|
||||||
|
tools:text="Cookies summary" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- 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/. -->
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="106dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginEnd="18dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:background="@drawable/rounded_grey_corners_transparent_center"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatSpinner
|
||||||
|
android:id="@+id/spinner"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:popupBackground="?above"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 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/. -->
|
||||||
|
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/text1"
|
||||||
|
style="?android:attr/spinnerDropDownItemStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:paddingEnd="15dp"
|
||||||
|
android:paddingStart="15dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:background="@drawable/etp_spinner_item_background"
|
||||||
|
android:textSize="14sp" />
|
|
@ -665,8 +665,8 @@
|
||||||
android:id="@+id/trackingProtectionBlockingFragment"
|
android:id="@+id/trackingProtectionBlockingFragment"
|
||||||
android:name="org.mozilla.fenix.trackingprotection.TrackingProtectionBlockingFragment">
|
android:name="org.mozilla.fenix.trackingprotection.TrackingProtectionBlockingFragment">
|
||||||
<argument
|
<argument
|
||||||
android:name="strictMode"
|
android:name="protectionMode"
|
||||||
app:argType="boolean" />
|
app:argType="string" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/deleteBrowsingDataOnQuitFragment"
|
android:id="@+id/deleteBrowsingDataOnQuitFragment"
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="cookies_options_entries">
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_cookies_1</item>
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_cookies_2</item>
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_cookies_3</item>
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_cookies_4</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="cookies_options_entry_values">
|
||||||
|
<item>social</item>
|
||||||
|
<item>unvisited</item>
|
||||||
|
<item>third-party</item>
|
||||||
|
<item>all</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="tracking_content_options_entries">
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_tracking_content_1</item>
|
||||||
|
<item>@string/preference_enhanced_tracking_protection_custom_tracking_content_2</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="tracking_content_options_entry_values">
|
||||||
|
<item>all</item>
|
||||||
|
<item>private</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
|
@ -113,6 +113,14 @@
|
||||||
<string name="pref_key_tracking_protection_exceptions" translatable="false">pref_key_tracking_protection_exceptions</string>
|
<string name="pref_key_tracking_protection_exceptions" translatable="false">pref_key_tracking_protection_exceptions</string>
|
||||||
<string name="pref_key_tracking_protection_standard_option" translatable="false">pref_key_tracking_protection_standard_option</string>
|
<string name="pref_key_tracking_protection_standard_option" translatable="false">pref_key_tracking_protection_standard_option</string>
|
||||||
<string name="pref_key_tracking_protection_strict_default" translatable="false">pref_key_tracking_protection_strict_default</string>
|
<string name="pref_key_tracking_protection_strict_default" translatable="false">pref_key_tracking_protection_strict_default</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_option" translatable="false">pref_key_tracking_protection_custom_option</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_cookies" translatable="false">pref_key_tracking_protection_custom_cookies</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_cookies_select" translatable="false">pref_key_tracking_protection_custom_cookies_select</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_tracking_content" translatable="false">pref_key_tracking_protection_custom_tracking_content</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_tracking_content_select" translatable="false">pref_key_tracking_protection_custom_tracking_content_select</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_cryptominers" translatable="false">pref_key_tracking_protection_custom_cryptominers</string>
|
||||||
|
<string name="pref_key_tracking_protection_custom_fingerprinters" translatable="false">pref_key_tracking_protection_custom_fingerprinters</string>
|
||||||
|
|
||||||
<string name="pref_key_tracking_protection_onboarding" translatable="false">pref_key_tracking_protection_onboarding</string>
|
<string name="pref_key_tracking_protection_onboarding" translatable="false">pref_key_tracking_protection_onboarding</string>
|
||||||
|
|
||||||
<!-- Logins Settings -->
|
<!-- Logins Settings -->
|
||||||
|
|
|
@ -961,7 +961,35 @@
|
||||||
<string name="preference_enhanced_tracking_protection_strict_description">Stronger protection, but may cause some sites or content to break.</string>
|
<string name="preference_enhanced_tracking_protection_strict_description">Stronger protection, but may cause some sites or content to break.</string>
|
||||||
<!-- Accessibility text for the Strict protection information icon -->
|
<!-- Accessibility text for the Strict protection information icon -->
|
||||||
<string name="preference_enhanced_tracking_protection_strict_info_button">What’s blocked by strict tracking protection</string>
|
<string name="preference_enhanced_tracking_protection_strict_info_button">What’s blocked by strict tracking protection</string>
|
||||||
|
<!-- Preference for enhanced tracking protection for the custom protection settings -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom">Custom</string>
|
||||||
|
<!-- Preference description for enhanced tracking protection for the strict protection settings -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_description">Choose which trackers and scripts to block</string>
|
||||||
|
<!-- Accessibility text for the Strict protection information icon -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_info_button">What’s blocked by custom tracking protection</string>
|
||||||
<!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings -->
|
<!-- Header for categories that are being blocked by current Enhanced Tracking Protection settings -->
|
||||||
|
<!-- Preference for enhanced tracking protection for the custom protection settings for cookies-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cookies">Cookies</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for cookies-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cookies_1">Cross-site and social media trackers</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for cookies-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cookies_2">Cookies from unvisited sites</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for cookies-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cookies_3">All third-party cookies (may cause websites to break)</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for cookies-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cookies_4">All cookies (will cause websites to break)</string>
|
||||||
|
<!-- Preference for enhanced tracking protection for the custom protection settings for tracking content -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_tracking_content">Tracking content</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for tracking content-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_tracking_content_1">In all tabs</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for tracking content-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_tracking_content_2">Only in Private tabs</string>
|
||||||
|
<!-- Option for enhanced tracking protection for the custom protection settings for tracking content-->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_tracking_content_3">Only in Custom tabs</string>
|
||||||
|
<!-- Preference for enhanced tracking protection for the custom protection settings -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_cryptominers">Cryptominers</string>
|
||||||
|
<!-- Preference for enhanced tracking protection for the custom protection settings -->
|
||||||
|
<string name="preference_enhanced_tracking_protection_custom_fingerprinters">Fingerprinters</string>
|
||||||
<string name="enhanced_tracking_protection_blocked">Blocked</string>
|
<string name="enhanced_tracking_protection_blocked">Blocked</string>
|
||||||
<!-- Header for categories that are being not being blocked by current Enhanced Tracking Protection settings -->
|
<!-- Header for categories that are being not being blocked by current Enhanced Tracking Protection settings -->
|
||||||
<string name="enhanced_tracking_protection_allowed">Allowed</string>
|
<string name="enhanced_tracking_protection_allowed">Allowed</string>
|
||||||
|
|
|
@ -27,6 +27,50 @@
|
||||||
android:key="@string/pref_key_tracking_protection_strict_default"
|
android:key="@string/pref_key_tracking_protection_strict_default"
|
||||||
android:summary="@string/preference_enhanced_tracking_protection_strict_default_description"
|
android:summary="@string/preference_enhanced_tracking_protection_strict_default_description"
|
||||||
android:title="@string/preference_enhanced_tracking_protection_strict_default" />
|
android:title="@string/preference_enhanced_tracking_protection_strict_default" />
|
||||||
|
|
||||||
|
<org.mozilla.fenix.settings.RadioButtonInfoPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:dependency="@string/pref_key_tracking_protection"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_option"
|
||||||
|
android:summary="@string/preference_enhanced_tracking_protection_custom_description"
|
||||||
|
android:title="@string/preference_enhanced_tracking_protection_custom" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_option"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_cookies"
|
||||||
|
android:layout="@layout/checkbox_left_preference_etp"
|
||||||
|
android:title="@string/preference_enhanced_tracking_protection_custom_cookies" />
|
||||||
|
<org.mozilla.fenix.settings.DropDownListPreference
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_cookies"
|
||||||
|
android:entries="@array/cookies_options_entries"
|
||||||
|
android:entryValues="@array/cookies_options_entry_values"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_cookies_select"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_option"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_tracking_content"
|
||||||
|
android:layout="@layout/checkbox_left_preference_etp"
|
||||||
|
android:title="@string/preference_enhanced_tracking_protection_custom_tracking_content" />
|
||||||
|
<org.mozilla.fenix.settings.DropDownListPreference
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_tracking_content"
|
||||||
|
android:entries="@array/tracking_content_options_entries"
|
||||||
|
android:entryValues="@array/tracking_content_options_entry_values"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_tracking_content_select"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_option"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_cryptominers"
|
||||||
|
android:layout="@layout/checkbox_left_preference_etp"
|
||||||
|
android:title="@string/preference_enhanced_tracking_protection_custom_cryptominers" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:dependency="@string/pref_key_tracking_protection_custom_option"
|
||||||
|
android:key="@string/pref_key_tracking_protection_custom_fingerprinters"
|
||||||
|
android:layout="@layout/checkbox_left_preference_etp"
|
||||||
|
android:title="@string/preference_enhanced_tracking_protection_custom_fingerprinters" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/ic_internet"
|
android:icon="@drawable/ic_internet"
|
||||||
android:key="@string/pref_key_tracking_protection_exceptions"
|
android:key="@string/pref_key_tracking_protection_exceptions"
|
||||||
|
|
Loading…
Reference in New Issue