diff options
Diffstat (limited to 'fakelocation/src/main/java/foundation')
-rw-r--r-- | fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/KoinModule.kt | 9 | ||||
-rw-r--r-- | fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/domain/usecases/FakeLocationModule.kt (renamed from fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationModule.kt) | 11 | ||||
-rw-r--r-- | fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt (renamed from fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationService.kt) | 3 | ||||
-rw-r--r-- | fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/IFakeLocationModule.kt | 41 |
4 files changed, 17 insertions, 47 deletions
diff --git a/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/KoinModule.kt b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/KoinModule.kt new file mode 100644 index 0000000..b833181 --- /dev/null +++ b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/KoinModule.kt @@ -0,0 +1,9 @@ +package foundation.e.advancedprivacy.fakelocation + +import foundation.e.advancedprivacy.fakelocation.domain.usecases.FakeLocationModule +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.module + +val fakelocationModule = module { + singleOf(::FakeLocationModule) +} diff --git a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationModule.kt b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/domain/usecases/FakeLocationModule.kt index 4245836..c9aac0a 100644 --- a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationModule.kt +++ b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/domain/usecases/FakeLocationModule.kt @@ -15,7 +15,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package foundation.e.privacymodules.fakelocation +package foundation.e.advancedprivacy.fakelocation.domain.usecases import android.content.Context import android.content.Context.LOCATION_SERVICE @@ -27,6 +27,7 @@ import android.location.provider.ProviderProperties import android.os.Build import android.os.SystemClock import android.util.Log +import foundation.e.advancedprivacy.fakelocation.services.FakeLocationService /** * Implementation of the functionality of fake location. @@ -34,7 +35,7 @@ import android.util.Log * * @param context an Android context, to retrieve system services for example. */ -class FakeLocationModule(private val context: Context) : IFakeLocationModule { +class FakeLocationModule(private val context: Context) { companion object { private const val TAG = "FakeLocationModule" } @@ -56,7 +57,7 @@ class FakeLocationModule(private val context: Context) : IFakeLocationModule { * @see IFakeLocationModule.startFakeLocation */ @Synchronized - override fun startFakeLocation() { + fun startFakeLocation() { providers.forEach { provider -> try { locationManager.removeTestProvider(provider) @@ -84,7 +85,7 @@ class FakeLocationModule(private val context: Context) : IFakeLocationModule { } } - override fun setFakeLocation(latitude: Double, longitude: Double) { + fun setFakeLocation(latitude: Double, longitude: Double) { context.startService(FakeLocationService.buildFakeLocationIntent(context, latitude, longitude)) } @@ -118,7 +119,7 @@ class FakeLocationModule(private val context: Context) : IFakeLocationModule { /** * @see IFakeLocationModule.stopFakeLocation */ - override fun stopFakeLocation() { + fun stopFakeLocation() { context.stopService(FakeLocationService.buildStopIntent(context)) providers.forEach { provider -> try { diff --git a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationService.kt b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt index 34620fe..6eaae54 100644 --- a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/FakeLocationService.kt +++ b/fakelocation/src/main/java/foundation/e/advancedprivacy/fakelocation/services/FakeLocationService.kt @@ -15,7 +15,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -package foundation.e.privacymodules.fakelocation +package foundation.e.advancedprivacy.fakelocation.services import android.app.Service import android.content.Context @@ -23,6 +23,7 @@ import android.content.Intent import android.os.CountDownTimer import android.os.IBinder import android.util.Log +import foundation.e.advancedprivacy.fakelocation.domain.usecases.FakeLocationModule class FakeLocationService : Service() { diff --git a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/IFakeLocationModule.kt b/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/IFakeLocationModule.kt deleted file mode 100644 index 32906f8..0000000 --- a/fakelocation/src/main/java/foundation/e/privacymodules/fakelocation/IFakeLocationModule.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022 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/>. - */ - -package foundation.e.privacymodules.fakelocation - -/** - * Manage a fake location on the device. - */ -interface IFakeLocationModule { - /** - * Start to fake the location module. Call [setFakeLocation] after to set the fake - * position. - */ - fun startFakeLocation() - - /** - * Set or update the faked position. - * @param latitude the latitude of the fake position in degrees. - * @param longitude the longitude of the fake position in degrees. - */ - fun setFakeLocation(latitude: Double, longitude: Double) - - /** - * Stop the fake location module, giving back hand to the true location modules. - */ - fun stopFakeLocation() -} |