Unverified Commit 2a48c125 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 33594: Disable data collection by default (Glean)

parent 43f5ac08
......@@ -37,6 +37,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 + '"'
......
......@@ -276,17 +276,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
......@@ -135,7 +136,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
......
Supports Markdown
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