Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 007737e5 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

tech:2995: Move app code to advancedprivacy module, create application holder app module

parent b4fd3c2b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
/build
 No newline at end of file
+147 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 MURENA SAS
 * Copyright (C) 2022 - 2024 E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id 'androidx.navigation.safeargs.kotlin'
}

def getSentryDsn = { ->

    def sentryDsnEnv = System.getenv("SENTRY_DSN")
    if (sentryDsnEnv != null) {
        return sentryDsnEnv
    }

    Properties properties = new Properties()
    def propertiesFile = project.rootProject.file('local.properties')
    if (propertiesFile.exists()) {
        properties.load(propertiesFile.newDataInputStream())
    }
    return properties.getProperty('SENTRY_DSN')
}

android {
    compileSdkVersion buildConfig.compileSdk

    defaultConfig {
        minSdkVersion buildConfig.minSdk
        targetSdkVersion buildConfig.targetSdk

        manifestPlaceholders = [
            persistent: "false",
            mainActivityIntentFilterCategory: "android.intent.category.LAUNCHER"
        ]

        resValue("string", "mapbox_key", MAPBOX_KEY)
        buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"")
    }


    // We define here  the OS flavor e, specific for the /e/ OS version, and google, for any
    // android device. The e or google prefix is then used in resources, dependencies, ... as
    // expected by the android gradle plugin.
    flavorDimensions 'os'
    productFlavors {
        eos {
            dimension 'os'
        }
        standalone {
            dimension 'os'
            manifestPlaceholders = [
                persistent: "false",
                mainActivityIntentFilterCategory: "android.intent.category.LAUNCHER"
            ]
        }
    }

    buildTypes {
        debug {

        }
        release {
            manifestPlaceholders = [
                persistent: "true",
                mainActivityIntentFilterCategory: "android.intent.category.INFO"
            ]
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    buildFeatures {
        dataBinding true
        viewBinding true
    }

    lintOptions {
        disable 'MissingTranslation'
    }
    namespace 'foundation.e.advancedprivacy'
}

dependencies {
    implementation project(':core')
    standaloneImplementation project(':permissionsstandalone')
    eosImplementation project(':permissionseos')

    eosImplementation files('libs/lineage-sdk.jar')

    implementation project(':trackers')

    implementation project(':ipscrambling')
    eosImplementation project(':trackersserviceeos')
    standaloneImplementation project(':trackersservicestandalone')

    implementation (
        libs.androidx.core.ktx,
        libs.androidx.appcompat,
        libs.androidx.datastore.preferences,
        libs.androidx.fragment.ktx,
        libs.androidx.lifecycle.runtime,
        libs.androidx.lifecycle.viewmodel,
        libs.androidx.navigation.fragment,
        libs.androidx.navigation.ui,
        libs.androidx.viewpager2,

        libs.bundles.koin,

        libs.eos.elib,
        libs.eos.telemetry,

        libs.google.material,
        libs.kotlinx.serialization,

        libs.maplibre,
        libs.mpandroidcharts,

        libs.timber
    )

    debugImplementation libs.leakcanary

    testImplementation libs.junit
}

static def log(Object val) {
    println("[GradleRepository]: " + val)
}
+21 −0
Original line number Diff line number Diff line
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
 No newline at end of file
+108 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright  (C) 2022 ECORP, 2022 MURENA SAS

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission
        android:name="android.permission.WRITE_SECURE_SETTINGS"
        tools:ignore="ProtectedPermissions"
        />
    <uses-permission
        android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
        tools:ignore="ProtectedPermissions"
        />
    <uses-permission android:name="lineageos.permission.ACCESS_BLOCKER" />
    <uses-permission
        android:name="android.permission.QUERY_ALL_PACKAGES"
        tools:ignore="QueryAllPackagesPermission"
        />

    <uses-permission android:name="foundation.e.permission.READ_FAKE_LOCATION_SETTINGS" />

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name="foundation.e.advancedprivacy.AdvancedPrivacyApplication"
        android:persistent="${persistent}"
        android:supportsRtl="true"
        android:theme="@style/Theme.AdvancedPrivacy"
        android:windowSoftInputMode="adjustResize"
        tools:replace="android:icon,android:label,android:theme"
        >

        <provider
            android:name=".externalinterfaces.contentproviders.FakeLocationContentProvider"
            android:authorities="foundation.e.advancedprivacy.fakelocations"
            android:permission="foundation.e.permission.READ_FAKE_LOCATION_SETTINGS"
            android:enabled="true"
            android:exported="true"
            />

        <receiver
            android:name="foundation.e.advancedprivacy.common.BootCompletedReceiver"
            android:exported="true"
            >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

        <receiver
            android:exported="true"
            android:name="foundation.e.advancedprivacy.Widget"
            >
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widget_info"
                />
        </receiver>
        <receiver android:name="foundation.e.advancedprivacy.widget.WidgetCommandReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="toggle_privacy" />
            </intent-filter>
        </receiver>

        <activity android:name="foundation.e.advancedprivacy.main.MainActivity"
            android:launchMode="singleTask"
            android:exported="true"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="${mainActivityIntentFilterCategory}"/>
            </intent-filter>
        </activity>
        <activity
            android:name="foundation.e.advancedprivacy.common.WarningDialog"
            android:noHistory="true"
            android:excludeFromRecents="true"
            android:launchMode="singleInstance"
            android:theme="@style/Theme.InvisibleActivity"
            />
    </application>
</manifest>
Loading