Commit 602684e5 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 33594: Disable data collection by default (Glean)

parent bda00391
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ android {
        manifestPlaceholders = [
                "deepLinkScheme": deepLinkSchemeValue
        ]
        buildConfigField "boolean", "DATA_COLLECTION_DISABLED", "true"
    }

    def releaseTemplate = {
@@ -192,6 +193,8 @@ android.applicationVariants.all { variant ->
// -------------------------------------------------------------------------------------------------

    def isDebug = variant.buildType.resValues['IS_DEBUG']?.value ?: false
    def isDataCollectionDisabled = variant.buildType.buildConfigFields['DATA_COLLECTION_DISABLED']?.value ?: true
    def isDebugOrDCD = isDebug || isDataCollectionDisabled
    def useReleaseVersioning = variant.buildType.buildConfigFields['USE_RELEASE_VERSIONING']?.value ?: false
    def versionName = Config.releaseVersionName(project)

@@ -200,7 +203,7 @@ android.applicationVariants.all { variant ->
    println("Application ID:    " + [variant.mergedFlavor.applicationId, variant.buildType.applicationIdSuffix].findAll().join())
    println("Build type:        " + variant.buildType.name)
    println("Flavor:            " + variant.flavorName)
    println("Telemetry enabled: " + !isDebug)
    println("Telemetry enabled: " + !isDebugOrDCD)

    if (useReleaseVersioning) {
        // The Google Play Store does not allow multiple APKs for the same app that all have the
@@ -225,7 +228,7 @@ android.applicationVariants.all { variant ->
// -------------------------------------------------------------------------------------------------

    buildConfigField 'String', 'SENTRY_TOKEN', 'null'
    if (!isDebug) {
    if (!isDebugOrDCD) {
        buildConfigField 'boolean', 'CRASH_REPORTING', 'true'
        // Reading sentry token from local file (if it exists). In a release task on taskcluster it will be available.
        try {
@@ -236,7 +239,7 @@ android.applicationVariants.all { variant ->
        buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
    }

    if (!isDebug) {
    if (!isDebugOrDCD) {
        buildConfigField 'boolean', 'TELEMETRY', 'true'
    } else {
        buildConfigField 'boolean', 'TELEMETRY', 'false'
@@ -257,7 +260,7 @@ android.applicationVariants.all { variant ->

    print("Adjust token: ")

    if (!isDebug) {
    if (!isDebugOrDCD) {
        try {
            def token = new File("${rootDir}/.adjust_token").text.trim()
            buildConfigField 'String', 'ADJUST_TOKEN', '"' + token + '"'
+3 −3
Original line number Diff line number Diff line
@@ -286,17 +286,17 @@ class Settings(private val appContext: Context) : PreferencesHolder {

    val isTelemetryEnabled by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_telemetry),
        default = true
        default = BuildConfig.DATA_COLLECTION_DISABLED == false
    )

    val isMarketingTelemetryEnabled by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_marketing_telemetry),
        default = true
        default = BuildConfig.DATA_COLLECTION_DISABLED == false
    )

    val isExperimentationEnabled by booleanPreference(
        appContext.getPreferenceKey(R.string.pref_key_experimentation),
        default = true
        default = BuildConfig.DATA_COLLECTION_DISABLED == false
    )

    private var trackingProtectionOnboardingShownThisSession = false
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.mozilla.fenix.settings.PhoneFeature
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
@@ -149,8 +150,12 @@ class SettingsTest {
    fun isTelemetryEnabled() {
        // When just created
        // Then
        if (BuildConfig.DATA_COLLECTION_DISABLED) {
            assertFalse(settings.isTelemetryEnabled)
        } else {
            assertTrue(settings.isTelemetryEnabled)
        }
    }

    @Test
    fun showLoginsDialogWarningSync() {