Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matthew Finkel
fenix
Commits
b00f8f2f
Commit
b00f8f2f
authored
Jul 24, 2020
by
Matthew Finkel
Browse files
Bug 33594: Disable data collection by default (Glean)
parent
0bde9483
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/build.gradle
View file @
b00f8f2f
...
...
@@ -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: "
+
!
isDebug
OrDCD
)
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
(!
isDebug
OrDCD
)
{
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
(!
isDebug
OrDCD
)
{
buildConfigField
'boolean'
,
'TELEMETRY'
,
'true'
}
else
{
buildConfigField
'boolean'
,
'TELEMETRY'
,
'false'
...
...
@@ -257,7 +260,7 @@ android.applicationVariants.all { variant ->
print
(
"Adjust token: "
)
if
(!
isDebug
)
{
if
(!
isDebug
OrDCD
)
{
try
{
def
token
=
new
File
(
"${rootDir}/.adjust_token"
).
text
.
trim
()
buildConfigField
'String'
,
'ADJUST_TOKEN'
,
'"'
+
token
+
'"'
...
...
app/src/main/java/org/mozilla/fenix/utils/Settings.kt
View file @
b00f8f2f
...
...
@@ -286,17 +286,17 @@ class Settings(private val appContext: Context) : PreferencesHolder {
val
isTelemetryEnabled
by
booleanPreference
(
appContext
.
getPreferenceKey
(
R
.
string
.
pref_key_telemetry
),
default
=
tru
e
default
=
BuildConfig
.
DATA_COLLECTION_DISABLED
==
fals
e
)
val
isMarketingTelemetryEnabled
by
booleanPreference
(
appContext
.
getPreferenceKey
(
R
.
string
.
pref_key_marketing_telemetry
),
default
=
tru
e
default
=
BuildConfig
.
DATA_COLLECTION_DISABLED
==
fals
e
)
val
isExperimentationEnabled
by
booleanPreference
(
appContext
.
getPreferenceKey
(
R
.
string
.
pref_key_experimentation
),
default
=
tru
e
default
=
BuildConfig
.
DATA_COLLECTION_DISABLED
==
fals
e
)
private
var
trackingProtectionOnboardingShownThisSession
=
false
...
...
app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt
View file @
b00f8f2f
...
...
@@ -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,7 +150,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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment