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

Commit 640f66a7 authored by TheScarastic's avatar TheScarastic
Browse files

privacymodulese: Add fused location to list of providers

parent bb9b44a5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ android {
        minSdkVersion 30
        targetSdkVersion 30
        versionCode 3
        versionName "0.4.2"
        versionName "0.4.3"
        consumerProguardFiles "consumer-rules.pro"
    }

+19 −7
Original line number Diff line number Diff line
@@ -20,13 +20,18 @@ class FakeLocationModule(protected val context: Context): IFakeLocationModule {
    /**
     * List of all the Location provider that will be mocked.
     */
    private val providers = listOf(LocationManager.NETWORK_PROVIDER, LocationManager.GPS_PROVIDER)
    private val providers = listOf(
        LocationManager.NETWORK_PROVIDER,
        LocationManager.GPS_PROVIDER,
        LocationManager.FUSED_PROVIDER
    )

    /**
     * Handy accessor to the locationManager service.
     * We avoid getting it on module initialization to wait for the context to be ready.
     */
    private val locationManager: LocationManager get() =
    private val locationManager: LocationManager
        get() =
            context.getSystemService(LOCATION_SERVICE) as LocationManager

    /**
@@ -49,13 +54,20 @@ class FakeLocationModule(protected val context: Context): IFakeLocationModule {
                false,
                true,
                true,
                Criteria.POWER_LOW, Criteria.ACCURACY_FINE)
                Criteria.POWER_LOW, Criteria.ACCURACY_FINE
            )
            locationManager.setTestProviderEnabled(provider, true)
        }
    }

    override fun setFakeLocation(latitude: Double, longitude: Double) {
        context.startService(FakeLocationService.buildFakeLocationIntent(context, latitude, longitude))
        context.startService(
            FakeLocationService.buildFakeLocationIntent(
                context,
                latitude,
                longitude
            )
        )
    }

    internal fun setTestProviderLocation(latitude: Double, longitude: Double) {