Commit 28062b0b 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 bb9ecb8a
Loading
Loading
Loading
Loading
+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
+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
+30 −30
Original line number Diff line number Diff line
@@ -4,34 +4,34 @@
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <shortcut
        android:shortcutId="password_manager"
        android:enabled="true"
        android:icon="@drawable/ic_static_password_shortcut"
        android:shortcutShortLabel="@string/home_screen_shortcut_passwords">
        <intent
            android:action="org.mozilla.fenix.OPEN_PASSWORD_MANAGER"
            android:targetPackage="org.mozilla.firefox_beta"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
    <shortcut
        android:shortcutId="open_new_tab"
        android:enabled="true"
        android:icon="@drawable/ic_static_shortcut_tab"
        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_tab_2">
        <intent
            android:action="org.mozilla.fenix.OPEN_TAB"
            android:targetPackage="org.mozilla.firefox_beta"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
    <shortcut
        android:shortcutId="open_new_private_tab"
        android:enabled="true"
        android:icon="@drawable/ic_static_shortcut_private_tab"
        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_private_tab_2">
        <intent
            android:action="org.mozilla.fenix.OPEN_PRIVATE_TAB"
            android:targetPackage="org.mozilla.firefox_beta"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
<!--    <shortcut-->
<!--        android:shortcutId="password_manager"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_password_shortcut"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_passwords">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_PASSWORD_MANAGER"-->
<!--            android:targetPackage="org.mozilla.firefox_beta"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
<!--    <shortcut-->
<!--        android:shortcutId="open_new_tab"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_shortcut_tab"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_tab_2">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_TAB"-->
<!--            android:targetPackage="org.mozilla.firefox_beta"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
<!--    <shortcut-->
<!--        android:shortcutId="open_new_private_tab"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_shortcut_private_tab"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_private_tab_2">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_PRIVATE_TAB"-->
<!--            android:targetPackage="org.mozilla.firefox_beta"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
</shortcuts>
+30 −30
Original line number Diff line number Diff line
@@ -4,34 +4,34 @@
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
    <shortcut
        android:shortcutId="password_manager"
        android:enabled="true"
        android:icon="@drawable/ic_static_password_shortcut"
        android:shortcutShortLabel="@string/home_screen_shortcut_passwords">
        <intent
            android:action="org.mozilla.fenix.OPEN_PASSWORD_MANAGER"
            android:targetPackage="org.mozilla.fenix.debug"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
    <shortcut
        android:shortcutId="open_new_tab"
        android:enabled="true"
        android:icon="@drawable/ic_static_shortcut_tab"
        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_tab_2">
        <intent
            android:action="org.mozilla.fenix.OPEN_TAB"
            android:targetPackage="org.mozilla.fenix.debug"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
    <shortcut
        android:shortcutId="open_new_private_tab"
        android:enabled="true"
        android:icon="@drawable/ic_static_shortcut_private_tab"
        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_private_tab_2">
        <intent
            android:action="org.mozilla.fenix.OPEN_PRIVATE_TAB"
            android:targetPackage="org.mozilla.fenix.debug"
            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />
    </shortcut>
<!--    <shortcut-->
<!--        android:shortcutId="password_manager"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_password_shortcut"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_passwords">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_PASSWORD_MANAGER"-->
<!--            android:targetPackage="org.mozilla.fenix.debug"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
<!--    <shortcut-->
<!--        android:shortcutId="open_new_tab"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_shortcut_tab"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_tab_2">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_TAB"-->
<!--            android:targetPackage="org.mozilla.fenix.debug"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
<!--    <shortcut-->
<!--        android:shortcutId="open_new_private_tab"-->
<!--        android:enabled="true"-->
<!--        android:icon="@drawable/ic_static_shortcut_private_tab"-->
<!--        android:shortcutShortLabel="@string/home_screen_shortcut_open_new_private_tab_2">-->
<!--        <intent-->
<!--            android:action="org.mozilla.fenix.OPEN_PRIVATE_TAB"-->
<!--            android:targetPackage="org.mozilla.fenix.debug"-->
<!--            android:targetClass="org.mozilla.fenix.IntentReceiverActivity" />-->
<!--    </shortcut>-->
</shortcuts>
+2 −6
Original line number Diff line number Diff line
@@ -7,15 +7,12 @@
    xmlns:tools="http://schemas.android.com/tools">

    <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"
        android:maxSdkVersion="28"
        tools:ignore="ScopedStorage"
        />
    <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" />

    <!-- This is needed because the android.permission.CAMERA above automatically
@@ -32,9 +29,6 @@
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.USE_BIOMETRIC" />

    <!-- Needed for Google Play policy https://support.google.com/googleplay/android-developer/answer/6048248 -->
    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

    <!-- Needed to prompt the user to give permission to install a downloaded apk -->
    <uses-permission-sdk-23 android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

@@ -116,6 +110,7 @@
            android:exported="true"
            android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|layoutDirection|smallestScreenSize|screenLayout"
            android:launchMode="singleTask"
            android:taskAffinity=""
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true"
            android:windowSoftInputMode="adjustResize">
@@ -380,6 +375,7 @@

        <service
            android:name=".push.FirebasePushService"
            android:enabled="false"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
Loading