[tbb-commits] [Git][tpo/applications/fenix][tor-browser-99.0.0b3-11.5-1] 2 commits: fixup! Disable features and functionality
Matthew Finkel (@sysrqb)
gitlab at torproject.org
Thu May 19 17:18:15 UTC 2022
Matthew Finkel pushed to branch tor-browser-99.0.0b3-11.5-1 at The Tor Project / Applications / fenix
Commits:
7bdfdab5 by Pier Angelo Vendrame at 2022-05-18T12:16:05+02:00
fixup! Disable features and functionality
Bug 40212: Tor Browser crashing on launch
- - - - -
3125a002 by Matthew Finkel at 2022-05-19T17:18:13+00:00
Merge branch 'bug_40212_2' into 'tor-browser-99.0.0b3-11.5-1'
Bug 40212: Disable more telemetry (especially, since it caused crashes)
See merge request tpo/applications/fenix!148
- - - - -
3 changed files:
- app/src/main/java/org/mozilla/fenix/FenixApplication.kt
- app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt
- app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt
Changes:
=====================================
app/src/main/java/org/mozilla/fenix/FenixApplication.kt
=====================================
@@ -157,6 +157,10 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
@OptIn(DelicateCoroutinesApi::class) // GlobalScope usage
protected open fun initializeGlean() {
val telemetryEnabled = settings().isTelemetryEnabled
+ if (!telemetryEnabled) {
+ logger.debug("Preventing Glean from initializing, since telemetry is disabled")
+ return
+ }
logger.debug("Initializing Glean (uploadEnabled=$telemetryEnabled, isFennec=${Config.channel.isFennec})")
=====================================
app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt
=====================================
@@ -8,6 +8,7 @@ import android.content.Context
import mozilla.components.service.glean.Glean
import mozilla.components.service.glean.private.NoExtraKeys
import mozilla.components.support.base.log.logger.Logger
+import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.GleanMetrics.Addons
import org.mozilla.fenix.GleanMetrics.AndroidAutofill
import org.mozilla.fenix.GleanMetrics.AppTheme
@@ -85,6 +86,9 @@ private class EventWrapper<T : Enum<T>>(
}
fun track(event: Event) {
+ if (BuildConfig.DATA_COLLECTION_DISABLED) {
+ return
+ }
val extras = if (keyMapper != null) {
event.extras?.mapKeys { (key) ->
keyMapper.invoke(key.toString().asCamelCase())
@@ -1002,6 +1006,12 @@ class GleanMetricsService(
private val installationPing = FirstSessionPing(context)
override fun start() {
+ if (BuildConfig.DATA_COLLECTION_DISABLED) {
+ Logger.debug("Data collection is disabled, not initializing Glean.")
+ initialized = true
+ return
+ }
+
logger.debug("Enabling Glean.")
// Initialization of Glean already happened in FenixApplication.
Glean.setUploadEnabled(true)
@@ -1029,10 +1039,12 @@ class GleanMetricsService(
}
override fun track(event: Event) {
- event.wrapper?.track(event)
+ if (!BuildConfig.DATA_COLLECTION_DISABLED) {
+ event.wrapper?.track(event)
+ }
}
override fun shouldTrack(event: Event): Boolean {
- return event.wrapper != null
+ return !BuildConfig.DATA_COLLECTION_DISABLED && event.wrapper != null
}
}
=====================================
app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt
=====================================
@@ -151,7 +151,11 @@ internal class ReleaseMetricController(
private fun isInitialized(type: MetricServiceType): Boolean = initialized.contains(type)
- private fun isTelemetryEnabled(@Suppress("UNUSED_PARAMETER") type: MetricServiceType): Boolean = false
+ private fun isTelemetryEnabled(type: MetricServiceType): Boolean =
+ !BuildConfig.DATA_COLLECTION_DISABLED && when (type) {
+ MetricServiceType.Data -> isDataTelemetryEnabled()
+ MetricServiceType.Marketing -> isMarketingDataTelemetryEnabled()
+ }
@Suppress("LongMethod", "MaxLineLength")
private fun Fact.toEvent(): Event? = when {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/compare/14c96c7e798cc835c05e87ca7c4d12f621887386...3125a00268bfa634ae8f3acdff444ceafaa4fee0
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/compare/14c96c7e798cc835c05e87ca7c4d12f621887386...3125a00268bfa634ae8f3acdff444ceafaa4fee0
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20220519/339e6433/attachment-0001.htm>
More information about the tbb-commits
mailing list