summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml7
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt2
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt1
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/location/LocationApiDelegate.kt19
4 files changed, 28 insertions, 1 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 74c226c..5fe282d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="foundation.e.privacycentralapp">
<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"
+ />
<application
android:name=".PrivacyCentralApplication"
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt
index 59f56c8..fe9359a 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFeature.kt
@@ -179,7 +179,7 @@ class FakeLocationFeature(
}
}
is Action.UseRealLocationAction -> {
- action.locationApiDelegate.stopFakeLocation()
+ action.locationApiDelegate.startRealLocation()
val success = DummyDataSource.setLocationMode(LocationMode.REAL_LOCATION)
if (success) {
flowOf(
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
index ff15e31..c11a7ea 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/FakeLocationFragment.kt
@@ -185,6 +185,7 @@ class FakeLocationFragment :
}
}
}
+ locationApiDelegate.startRealLocation()
}
override fun onAttach(context: Context) {
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/location/LocationApiDelegate.kt b/app/src/main/java/foundation/e/privacycentralapp/features/location/LocationApiDelegate.kt
index efacae2..dd2e5c1 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/location/LocationApiDelegate.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/location/LocationApiDelegate.kt
@@ -54,9 +54,28 @@ class LocationApiDelegate(
appDesc, AppOpsManager.OPSTR_MOCK_LOCATION,
AppOpModes.IGNORED
)
+ permissionsModule.setAppOpMode(
+ appDesc, AppOpsManager.OPSTR_MOCK_LOCATION,
+ AppOpModes.IGNORED
+ )
fakeLocationModule.stopFakeLocation()
} catch (e: Exception) {
Log.e(TAG, "Can't stop FakeLocation", e)
}
}
+ fun startRealLocation() {
+ stopFakeLocation()
+ try {
+ permissionsModule.setAppOpMode(
+ appDesc, AppOpsManager.OPSTR_COARSE_LOCATION,
+ AppOpModes.ALLOWED
+ )
+ permissionsModule.setAppOpMode(
+ appDesc, AppOpsManager.OPSTR_FINE_LOCATION,
+ AppOpModes.ALLOWED
+ )
+ } catch (e: Exception) {
+ Log.e(TAG, "Can't start RealLocation", e)
+ }
+ }
}