[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/fenix][tor-browser-99.0.0b3-11.5-1] 2 commits: fixup! Disable features and functionality



Title: GitLab

Matthew Finkel pushed to branch tor-browser-99.0.0b3-11.5-1 at The Tor Project / Applications / fenix

Commits:

3 changed files:

Changes:

  • app/src/main/java/org/mozilla/fenix/FenixApplication.kt
    ... ... @@ -157,6 +157,10 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
    157 157
         @OptIn(DelicateCoroutinesApi::class) // GlobalScope usage
    
    158 158
         protected open fun initializeGlean() {
    
    159 159
             val telemetryEnabled = settings().isTelemetryEnabled
    
    160
    +        if (!telemetryEnabled) {
    
    161
    +            logger.debug("Preventing Glean from initializing, since telemetry is disabled")
    
    162
    +            return
    
    163
    +        }
    
    160 164
     
    
    161 165
             logger.debug("Initializing Glean (uploadEnabled=$telemetryEnabled, isFennec=${Config.channel.isFennec})")
    
    162 166
     
    

  • app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt
    ... ... @@ -8,6 +8,7 @@ import android.content.Context
    8 8
     import mozilla.components.service.glean.Glean
    
    9 9
     import mozilla.components.service.glean.private.NoExtraKeys
    
    10 10
     import mozilla.components.support.base.log.logger.Logger
    
    11
    +import org.mozilla.fenix.BuildConfig
    
    11 12
     import org.mozilla.fenix.GleanMetrics.Addons
    
    12 13
     import org.mozilla.fenix.GleanMetrics.AndroidAutofill
    
    13 14
     import org.mozilla.fenix.GleanMetrics.AppTheme
    
    ... ... @@ -85,6 +86,9 @@ private class EventWrapper<T : Enum<T>>(
    85 86
         }
    
    86 87
     
    
    87 88
         fun track(event: Event) {
    
    89
    +        if (BuildConfig.DATA_COLLECTION_DISABLED) {
    
    90
    +            return
    
    91
    +        }
    
    88 92
             val extras = if (keyMapper != null) {
    
    89 93
                 event.extras?.mapKeys { (key) ->
    
    90 94
                     keyMapper.invoke(key.toString().asCamelCase())
    
    ... ... @@ -1002,6 +1006,12 @@ class GleanMetricsService(
    1002 1006
         private val installationPing = FirstSessionPing(context)
    
    1003 1007
     
    
    1004 1008
         override fun start() {
    
    1009
    +        if (BuildConfig.DATA_COLLECTION_DISABLED) {
    
    1010
    +            Logger.debug("Data collection is disabled, not initializing Glean.")
    
    1011
    +            initialized = true
    
    1012
    +            return
    
    1013
    +        }
    
    1014
    +
    
    1005 1015
             logger.debug("Enabling Glean.")
    
    1006 1016
             // Initialization of Glean already happened in FenixApplication.
    
    1007 1017
             Glean.setUploadEnabled(true)
    
    ... ... @@ -1029,10 +1039,12 @@ class GleanMetricsService(
    1029 1039
         }
    
    1030 1040
     
    
    1031 1041
         override fun track(event: Event) {
    
    1032
    -        event.wrapper?.track(event)
    
    1042
    +        if (!BuildConfig.DATA_COLLECTION_DISABLED) {
    
    1043
    +            event.wrapper?.track(event)
    
    1044
    +        }
    
    1033 1045
         }
    
    1034 1046
     
    
    1035 1047
         override fun shouldTrack(event: Event): Boolean {
    
    1036
    -        return event.wrapper != null
    
    1048
    +        return !BuildConfig.DATA_COLLECTION_DISABLED && event.wrapper != null
    
    1037 1049
         }
    
    1038 1050
     }

  • app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt
    ... ... @@ -151,7 +151,11 @@ internal class ReleaseMetricController(
    151 151
     
    
    152 152
         private fun isInitialized(type: MetricServiceType): Boolean = initialized.contains(type)
    
    153 153
     
    
    154
    -    private fun isTelemetryEnabled(@Suppress("UNUSED_PARAMETER") type: MetricServiceType): Boolean = false
    
    154
    +    private fun isTelemetryEnabled(type: MetricServiceType): Boolean =
    
    155
    +        !BuildConfig.DATA_COLLECTION_DISABLED && when (type) {
    
    156
    +            MetricServiceType.Data -> isDataTelemetryEnabled()
    
    157
    +            MetricServiceType.Marketing -> isMarketingDataTelemetryEnabled()
    
    158
    +        }
    
    155 159
     
    
    156 160
         @Suppress("LongMethod", "MaxLineLength")
    
    157 161
         private fun Fact.toEvent(): Event? = when {
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits