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

Commit c187755e authored by Guillaume Jacquart's avatar Guillaume Jacquart Committed by Guillaume Jacquart
Browse files

poc:2295: Implement whitlist app for fake location through ContentProvider

parent 250afa29
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -66,22 +66,11 @@ To strictly enforce the code quality, this project has a pre-commit hook which i

## Build dependencies

TrackerFilter won't work unless your rom was build with this specific netd project:
Trackers filter and Fake location won't work unless your rom was build with this specific netd project, android framework base and microG.

[android_system_netd](../../../e_privacycentral_android_system_netd)
Custom netd project communicate to AdvancedPrivay through a Unix socket, to log and block name resolution.

To create an /e/ build with this specific project, follow the documentation to create an usual /e/ build for your device https://doc.e.foundation/devices until `repo sync`

After `repo sync` all the sources, replace
```
system/netd
```

with this repo [android_system_netd](../../../e_privacycentral_android_system_netd)

then run the build as usual

This won't include advanced privacy, you still need to build the app.
Custom android framework base and microG will consult the foundation.e.advancedprivacy.fakelocations ContentProvider for fake location instruction.

## Build
If you'd like to build AdvancedPrivacy locally, you should be able to just clone and build with no issues.
@@ -90,7 +79,7 @@ For building from CLI, you can execute use `./gradlew assemble<Flavor><Debug|Rel

Example for eOs debug version
```bash
./gradlew assembleEDebug
./gradlew assembleEosDebug
```

## How to use AdvancedPrivacy apk
@@ -107,7 +96,7 @@ But the first time, to replace the AdvancedPrivacy app, embeded in the test buil
    adb shell kill -9 $(adb shell pidof -s foundation.e.advancedprivacy)
    ```

#### AdvancedPrivacy requiement against the system
#### AdvancedPrivacy requirement against the system

AdvancedPrivacy needs to be installed as system app and whitelisting in order to grant some system specific permissions. Follow these steps to make it work properly on /e/OS

@@ -153,6 +142,7 @@ Please refer to [Development Guide](DEVELOPMENT.md) for detailed instructions ab

# License
```
Copyright (C) 2024 E FOUNDATION
Copyright (C) 2023 MURENA SAS
Copyright (C) 2021 ECORP

+0 −2
Original line number Diff line number Diff line
@@ -142,8 +142,6 @@ dependencies {
    standaloneImplementation project(':permissionsstandalone')
    eosImplementation project(':permissionseos')

    implementation project(':fakelocation')

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

    implementation project(':trackers')
+9 −2
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@
        android:windowSoftInputMode="adjustResize"
        tools:replace="android:icon,android:label,android:theme"
        >

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

        <receiver
            android:name="foundation.e.advancedprivacy.common.BootCompletedReceiver"
            android:exported="true"
@@ -92,5 +100,4 @@
            android:theme="@style/Theme.InvisibleActivity"
            />
    </application>

</manifest>
+9 −8
Original line number Diff line number Diff line
@@ -29,9 +29,11 @@ import foundation.e.advancedprivacy.domain.entities.DisplayableApp
import foundation.e.advancedprivacy.domain.entities.ProfileType
import foundation.e.advancedprivacy.domain.repositories.LocalStateRepository
import foundation.e.advancedprivacy.domain.usecases.AppTrackersUseCase
import foundation.e.advancedprivacy.domain.usecases.FakeLocationForAppUseCase
import foundation.e.advancedprivacy.domain.usecases.FakeLocationStateUseCase
import foundation.e.advancedprivacy.domain.usecases.GetQuickPrivacyStateUseCase
import foundation.e.advancedprivacy.domain.usecases.IpScramblingStateUseCase
import foundation.e.advancedprivacy.domain.usecases.ListenLocationUseCase
import foundation.e.advancedprivacy.domain.usecases.ShowFeaturesWarningUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackerDetailsUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackersAndAppsListsUseCase
@@ -40,7 +42,6 @@ import foundation.e.advancedprivacy.domain.usecases.TrackersStateUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackersStatisticsUseCase
import foundation.e.advancedprivacy.dummy.CityDataSource
import foundation.e.advancedprivacy.externalinterfaces.permissions.IPermissionsPrivacyModule
import foundation.e.advancedprivacy.fakelocation.fakelocationModule
import foundation.e.advancedprivacy.features.dashboard.DashboardViewModel
import foundation.e.advancedprivacy.features.internetprivacy.InternetPrivacyViewModel
import foundation.e.advancedprivacy.features.location.FakeLocationViewModel
@@ -68,7 +69,7 @@ import org.koin.dsl.module
import timber.log.Timber

val appModule = module {
    includes(coreModule, trackersModule, fakelocationModule, ipScramblerModule, trackerServiceModule)
    includes(coreModule, trackersModule, ipScramblerModule, trackerServiceModule)

    single<CoroutineScope> {
        CoroutineScope(
@@ -113,18 +114,18 @@ val appModule = module {
    single { CityDataSource }
    single { ResourcesRepository(androidContext()) }

    singleOf(::FakeLocationStateUseCase)

    single {
        FakeLocationStateUseCase(
            fakeLocationModule = get(),
        ListenLocationUseCase(
            permissionsModule = get(),
            localStateRepository = get(),
            citiesRepository = get(),
            appDesc = get(named("AdvancedPrivacy")),
            appContext = androidContext(),
            coroutineScope = get()
            appContext = androidContext()
        )
    }

    singleOf(::FakeLocationForAppUseCase)

    singleOf(::GetQuickPrivacyStateUseCase)
    single {
        IpScramblingStateUseCase(
+6 −3
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 MURENA SAS
 * Copyright (C) 2022 MURENA SAS
 * Copyright (C) 2024 E FOUNDATION
 * Copyright (C) 2022 - 2023 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
@@ -29,6 +29,7 @@ import foundation.e.advancedprivacy.domain.entities.CHANNEL_FAKE_LOCATION_FLAG
import foundation.e.advancedprivacy.domain.entities.CHANNEL_FIRST_BOOT
import foundation.e.advancedprivacy.domain.entities.CHANNEL_IPSCRAMBLING_FLAG
import foundation.e.advancedprivacy.domain.entities.CHANNEL_TRACKER_FLAG
import foundation.e.advancedprivacy.domain.entities.FeatureMode
import foundation.e.advancedprivacy.domain.entities.FeatureState
import foundation.e.advancedprivacy.domain.entities.NOTIFICATION_FAKE_LOCATION_FLAG
import foundation.e.advancedprivacy.domain.entities.NOTIFICATION_FIRST_BOOT
@@ -96,7 +97,9 @@ object Notifications {
            channelDescription = R.string.notifications_tracker_channel_description
        )

        getQuickPrivacyStateUseCase.isLocationHidden.onEach {
        getQuickPrivacyStateUseCase.locationMode.map {
            it != FeatureMode.VULNERABLE
        }.distinctUntilChanged().onEach {
            if (it) {
                showFlagNotification(appContext, NOTIFICATION_FAKE_LOCATION_FLAG)
            } else {
Loading