Unverified Commit 6f5d49c7 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Disable features and functionality

Bug 33594: Disable data collection by default (Glean)

Bug 40019: Adjust is disabled on Release when data collection is disabled

Bug 34338: Disable the crash reporter

Bug 40014: Neuter Google Advertising ID

Bug 40018: Disable Push service

Bug 40034: Disable PWA onboading

Bug 40072: Disable Tracking Protection

Bug 40061: Do not show "Send to device" in sharing menu

Bug 40109: Reduce requested permissions

Exclude LOCATION and NETWORK_STATE

Bug 40162: Disable Numbus experiments
parent 5c13ead2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ android {
        } else {
            buildConfigField "boolean", "MOZILLA_ONLINE", "false"
        }

        buildConfigField "boolean", "DATA_COLLECTION_DISABLED", "true"
    }

    def releaseTemplate = {
@@ -230,6 +232,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 = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project)

@@ -238,7 +242,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
@@ -265,7 +269,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 {
@@ -276,7 +280,7 @@ android.applicationVariants.all { variant ->
        buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
    }

    if (!isDebug) {
    if (!isDebugOrDCD) {
        buildConfigField 'boolean', 'TELEMETRY', 'true'
    } else {
        buildConfigField 'boolean', 'TELEMETRY', 'false'
@@ -297,7 +301,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 + '"'
@@ -513,8 +517,6 @@ dependencies {
    implementation Deps.adjust
    implementation Deps.installreferrer // Required by Adjust

    implementation Deps.google_ads_id // Required for the Google Advertising ID

    implementation Deps.google_play_store // Required for in-app reviews

    androidTestImplementation Deps.uiautomator
+1 −3
Original line number Diff line number Diff line
@@ -4,11 +4,8 @@
    package="org.mozilla.fenix">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
@@ -274,6 +271,7 @@

        <service
            android:name=".push.FirebasePushService"
            android:enabled="false"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ object FeatureFlags {
    /**
     * Enables the Nimbus experiments library.
     */
    const val nimbusExperiments = true
    const val nimbusExperiments = false

    /**
     * Enables the Addresses autofill feature.
+2 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class Analytics(
                appName = context.getString(R.string.app_name),
                organizationName = "Mozilla"
            ),
            enabled = true,
            enabled = !isDataColectionDisabled(),
            nonFatalCrashIntent = pendingIntent
        )
    }
@@ -110,6 +110,7 @@ class Analytics(
    }
}

fun isDataColectionDisabled() = BuildConfig.DATA_COLLECTION_DISABLED
fun isSentryEnabled() = !BuildConfig.SENTRY_TOKEN.isNullOrEmpty()

private fun getSentryProjectUrl(): String? {
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
        if ((BuildConfig.ADJUST_TOKEN.isNullOrBlank())) {
            Log.i(LOGTAG, "No adjust token defined")

            if (Config.channel.isReleased) {
            if (Config.channel.isReleased && !BuildConfig.DATA_COLLECTION_DISABLED) {
                throw IllegalStateException("No adjust token defined for release build")
            }

Loading