1
0
Fork 0

For #4295 - Adds Experiments Pref to Data Collection Settings (#4915)

master
Emily Kager 2019-08-27 15:56:16 -04:00 committed by Jeff Boek
parent c322343248
commit 1cf8a40059
5 changed files with 23 additions and 5 deletions

View File

@ -74,12 +74,14 @@ open class FenixApplication : Application() {
experimentLoader = loadExperiments()
// Enable the service-experiments component
Experiments.initialize(
applicationContext,
mozilla.components.service.experiments.Configuration(
httpClient = lazy(LazyThreadSafetyMode.NONE) { components.core.client }
if (Settings.getInstance(this).isExperimentationEnabled) {
Experiments.initialize(
applicationContext,
mozilla.components.service.experiments.Configuration(
httpClient = lazy(LazyThreadSafetyMode.NONE) { components.core.client }
)
)
)
}
// When the `fenix-test-2019-08-05` experiment is active, record its branch in Glean
// telemetry. This will be used to validate that the experiment system correctly enrolls

View File

@ -63,5 +63,10 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
findPreference<SwitchPreference>(getPreferenceKey(R.string.pref_key_experimentation))?.apply {
isChecked = Settings.getInstance(context).isExperimentationEnabled
onPreferenceChangeListener = SharedPreferenceUpdater()
}
}
}

View File

@ -90,6 +90,11 @@ class Settings private constructor(
default = true
)
val isExperimentationEnabled by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_experimentation),
default = true
)
val shouldAutoBounceQuickActionSheet: Boolean
get() = autoBounceQuickActionSheetCount < autoBounceMaximumCount

View File

@ -27,6 +27,7 @@
<string name="pref_key_theme" translatable="false">pref_key_theme</string>
<string name="pref_key_leakcanary" translatable="false">pref_key_leakcanary</string>
<string name="pref_key_remote_debugging" translatable="false">pref_key_remote_debugging</string>
<string name="pref_key_experimentation" translatable="false">pref_key_experimentation</string>
<!-- Data Choices -->
<string name="pref_key_telemetry" translatable="false">pref_key_telemetry</string>

View File

@ -9,4 +9,9 @@
android:summary="@string/preferences_usage_data_description"
android:title="@string/preference_usage_data"
app:iconSpaceReserved="false" />
<androidx.preference.SwitchPreference
android:key="@string/pref_key_experimentation"
android:summary="@string/preference_experiments_summary"
android:title="@string/preference_experiments"
app:iconSpaceReserved="false" />
</PreferenceScreen>