1
0
Fork 0

For #6219 - Reset default setting if user opts out of experiments

master
Emily Kager 2019-10-25 11:21:42 -07:00 committed by Emily Kager
parent 0242b40ce2
commit 6435a503ca
2 changed files with 14 additions and 0 deletions

View File

@ -10,6 +10,16 @@ import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
object ExperimentsManager {
fun optOutEtpExperiment(context: Context) {
// If a user can see the ETP categories we don't want to change their settings
if (FeatureFlags.etpCategories) return
// Release user has opted out of ETP experiment, reset them to current default (strict)
context.settings().setUseStrictTrackingProtection()
context.components.useCases.settingsUseCases.updateTrackingProtection(
context.components.core.createTrackingProtectionPolicy()
)
}
fun initEtpExperiment(context: Context) {
// When the `fenix-etp-5651` experiment is active, set up ETP settings and GV policy.
// Note that this will not take effect the first time the application has launched,

View File

@ -87,6 +87,10 @@ open class FenixApplication : Application() {
httpClient = lazy(LazyThreadSafetyMode.NONE) { components.core.client }
)
)
} else {
// We should make a better way to opt out for when we have more experiments
// See https://github.com/mozilla-mobile/fenix/issues/6278
ExperimentsManager.optOutEtpExperiment(this)
}
// When the `fenix-test-2019-08-05` experiment is active, record its branch in Glean