GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 64d7a5f4 authored by Matthew Finkel's avatar Matthew Finkel Committed by Alex Catarineu
Browse files

Bug 33594: Disable data collection by default (Glean)

parent 9cb7f216
......@@ -36,6 +36,7 @@ android {
manifestPlaceholders = [
"deepLinkScheme": deepLinkSchemeValue
]
buildConfigField "boolean", "DATA_COLLECTION_DISABLED", "true"
}
def releaseTemplate = {
......@@ -191,6 +192,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)
......@@ -199,7 +202,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
......@@ -224,7 +227,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 {
......@@ -235,7 +238,7 @@ android.applicationVariants.all { variant ->
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
}
if (!isDebug) {
if (!isDebugOrDCD) {
buildConfigField 'boolean', 'TELEMETRY', 'true'
} else {
buildConfigField 'boolean', 'TELEMETRY', 'false'
......@@ -256,7 +259,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 + '"'
......
......@@ -269,17 +269,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
......
......@@ -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
......@@ -121,7 +122,11 @@ class SettingsTest {
fun isTelemetryEnabled() {
// When just created
// Then
assertTrue(settings.isTelemetryEnabled)
if (BuildConfig.DATA_COLLECTION_DISABLED) {
assertFalse(settings.isTelemetryEnabled)
} else {
assertTrue(settings.isTelemetryEnabled)
}
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment