Verified Commit afe2caf6 authored by Matthew Finkel's avatar Matthew Finkel Committed by Pier Angelo Vendrame
Browse files

[android] 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
parent 24236cd9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ class SettingsTest {
            cookieBannerHandlingDetectOnlyMode = true,
            cookieBannerHandlingGlobalRules = true,
            cookieBannerHandlingGlobalRulesSubFrames = true,
            emailTrackerBlockingPrivateBrowsing = true,
            emailTrackerBlockingPrivateBrowsing = false,
        )

        assertFalse(defaultSettings.domStorageEnabled)
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    androidResources {
        ignoreAssetsPattern '!<dir>extensions'
    }

    defaultConfig {
        minSdkVersion config.minSdkVersion
        compileSdk config.compileSdkVersion
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ class AddonsManagerAdapter(
        }

        // Add recommended section and addons if available
        if (recommendedAddons.isNotEmpty()) {
        if (false) { // recommendedAddons.isNotEmpty() tor-browser#40502: Do not recommend addons on Tor Browser
            itemsWithSections.add(Section(R.string.mozac_feature_addons_recommended_section, true))
            val filteredRecommendedAddons = recommendedAddons.filter {
                it.id !in excludedAddonIDs
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ apply plugin: 'kotlin-android'

android {
    androidResources {
        ignoreAssetsPattern '!amazon*:!azerdict*:!baidu*:!bing*:!ceneje*:!coccoc*:!daum*:!ebay*:!ecosia*:!faclair*:!google*:!gulesider*:!leo*:!mapy*:!mercadolibre*:!odpiralni*:!pazaruvaj*:!prisjakt*:!qwant*:!rakuten*:!salidzinilv*:!seznam*:!vatera*:!wikipedia-*:!wiktionary*:!yahoo*:!yandex*'
        ignoreAssetsPattern '!<dir>extensions:!search_telemetry_v2.json:!amazon*:!azerdict*:!baidu*:!bing*:!ceneje*:!coccoc*:!daum*:!ebay*:!ecosia*:!faclair*:!google*:!gulesider*:!leo*:!mapy*:!mercadolibre*:!odpiralni*:!pazaruvaj*:!prisjakt*:!qwant*:!rakuten*:!salidzinilv*:!seznam*:!vatera*:!wikipedia-*:!wiktionary*:!yahoo*:!yandex*'
    }

    defaultConfig {
+8 −7
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ android {
        ]

        buildConfigField "String[]", "SUPPORTED_LOCALE_ARRAY", getSupportedLocales()

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

    def releaseTemplate = {
@@ -296,6 +298,8 @@ android.applicationVariants.configureEach { variant ->
// -------------------------------------------------------------------------------------------------

    def isDebug = variant.buildType.resValues['bool/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

    println("----------------------------------------------")
@@ -303,7 +307,7 @@ android.applicationVariants.configureEach { variant ->
    println("Application ID:    " + [variant.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
@@ -345,7 +349,7 @@ android.applicationVariants.configureEach { 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 {
@@ -356,7 +360,7 @@ android.applicationVariants.configureEach { variant ->
        buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
    }

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

    print("Adjust token: ")

    if (!isDebug) {
    if (!isDebugOrDCD) {
        try {
            def token = new File("${rootDir}/.adjust_token").text.trim()
            buildConfigField 'String', 'ADJUST_TOKEN', '"' + token + '"'
@@ -687,11 +691,8 @@ dependencies {
    implementation FenixDependencies.protobuf_javalite
    implementation ComponentsDependencies.google_material

    implementation FenixDependencies.adjust
    implementation FenixDependencies.installreferrer // Required by Adjust

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

    // Required for in-app reviews
    implementation ComponentsDependencies.play_review
    implementation ComponentsDependencies.play_review_ktx
Loading