From 9c6c774e824f415462bab0adf64bff3547aa6c5f Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 15 Dec 2014 11:54:00 +0100 Subject: [PATCH] Added restrictions Srv_addGpsMeasurements/NavigationMessageListener Refs #1757 --- CHANGELOG.md | 1 + res/values/functions.xml | 2 ++ src/biz/bokhorst/xprivacy/Meta.java | 4 +++ .../bokhorst/xprivacy/XLocationManager.java | 25 ++++++++++++++++++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9b37fc2..fb9dc6889 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Changelog * Added restrictions for [LinkProperties](http://developer.android.com/reference/android/net/LinkProperties.html) * Added restrictions *InetAddress.getAllByNameOnNet* and *InetAddress.getByNameOnNet* ([issue](/../../issues/1757)) * Added restriction *Srv_getCurrentSyncsAsUser* ([issue](/../../issues/1757)) +* Added restrictions *Srv_addGpsMeasurementsListener* and *Srv_addGpsNavigationMessageListener* ([issue](/../../issues/1757)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/res/values/functions.xml b/res/values/functions.xml index de247a7c9..00998c382 100644 --- a/res/values/functions.xml +++ b/res/values/functions.xml @@ -159,6 +159,8 @@ Google documentation]]> Google documentation]]> Google documentation]]> + Google documentation]]> + Google documentation]]> phone state listener]]> Google documentation]]> Google documentation]]> diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index 2256f0ac6..b563ff66d 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -221,6 +221,8 @@ public static List get() { mListHook.add(new Hook("location", "Srv_getLastLocation", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 1, "2.99", "getLastKnownLocation").AOSP(19)); mListHook.add(new Hook("location", "Srv_requestLocationUpdates", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 1, "2.99", "requestLocationUpdates").restart().AOSP(19)); mListHook.add(new Hook("location", "Srv_sendExtraCommand", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 3, "2.99", "sendExtraCommand").AOSP(19)); + mListHook.add(new Hook("location", "Srv_addGpsMeasurementsListener", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 21, "3.5.6", null).AOSP(21)); + mListHook.add(new Hook("location", "Srv_addGpsNavigationMessageListener", "ACCESS_COARSE_LOCATION,ACCESS_FINE_LOCATION", 21, "3.5.6", null).AOSP(21)); mListHook.add(new Hook("location", "enableLocationUpdates", "CONTROL_LOCATION_UPDATES", 10, null, null).notAOSP(19)); mListHook.add(new Hook("location", "getAllCellInfo", "ACCESS_COARSE_UPDATES", 17, null, null).notAOSP(19)); @@ -587,6 +589,8 @@ public static List get() { mListHook.add(new Hook(null, "Srv_removeUpdates", "", 19, null, null).AOSP(19)); mListHook.add(new Hook(null, "Srv_removeGeofence", "", 19, null, null).AOSP(19)); mListHook.add(new Hook(null, "Srv_removeGpsStatusListener", "", 19, null, null).AOSP(19)); + mListHook.add(new Hook(null, "Srv_removeGpsMeasurementsListener", "", 21, null, null).AOSP(21)); + mListHook.add(new Hook(null, "Srv_removeGpsNavigationMessageListener", "", 21, null, null).AOSP(21)); mListHook.add(new Hook(null, "MapV1.disableMyLocation", "", 1, null, null).optional()); // MediaRecorder diff --git a/src/biz/bokhorst/xprivacy/XLocationManager.java b/src/biz/bokhorst/xprivacy/XLocationManager.java index bc6192c50..5c62660b0 100644 --- a/src/biz/bokhorst/xprivacy/XLocationManager.java +++ b/src/biz/bokhorst/xprivacy/XLocationManager.java @@ -74,6 +74,11 @@ public String getClassName() { // public boolean isProviderEnabled(java.lang.String provider) // public boolean sendExtraCommand(java.lang.String provider, java.lang.String command, android.os.Bundle extras) // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.4_r1/com/android/server/LocationManagerService.java + // public boolean addGpsMeasurementsListener(IGpsMeasurementsListener listener, String packageName) + // public boolean addGpsNavigationMessageListener(IGpsNavigationMessageListener listener, String packageName) + // public boolean removeGpsMeasurementsListener(IGpsMeasurementsListener listener) + // public boolean removeGpsNavigationMessageListener(IGpsNavigationMessageListener listener) + // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/com/android/server/LocationManagerService.java // @formatter:on @@ -92,7 +97,9 @@ private enum Methods { Srv_getLastLocation, Srv_addGpsStatusListener, Srv_removeGpsStatusListener, Srv_getAllProviders, Srv_getProviders, Srv_getBestProvider, Srv_isProviderEnabled, - Srv_sendExtraCommand + Srv_sendExtraCommand, + + Srv_addGpsMeasurementsListener, Srv_addGpsNavigationMessageListener, Srv_removeGpsMeasurementsListener, Srv_removeGpsNavigationMessageListener }; // @formatter:on @@ -134,6 +141,8 @@ protected void before(XParam param) throws Throwable { case addGpsStatusListener: case addNmeaListener: case Srv_addGpsStatusListener: + case Srv_addGpsMeasurementsListener: + case Srv_addGpsNavigationMessageListener: if (isRestricted(param)) param.setResult(false); break; @@ -143,6 +152,16 @@ protected void before(XParam param) throws Throwable { param.setResult(null); break; + case Srv_removeGpsMeasurementsListener: + if (isRestricted(param, PrivacyManager.cLocation, "Srv_addGpsMeasurementsListener")) + param.setResult(null); + break; + + case Srv_removeGpsNavigationMessageListener: + if (isRestricted(param, PrivacyManager.cLocation, "Srv_addGpsNavigationMessageListener")) + param.setResult(null); + break; + case getAllProviders: case getBestProvider: case getGpsStatus: @@ -216,8 +235,12 @@ protected void after(XParam param) throws Throwable { case addProximityAlert: case Srv_requestGeofence: case Srv_addGpsStatusListener: + case Srv_addGpsMeasurementsListener: + case Srv_addGpsNavigationMessageListener: case Srv_removeGeofence: case Srv_removeGpsStatusListener: + case Srv_removeGpsMeasurementsListener: + case Srv_removeGpsNavigationMessageListener: // Do nothing break;