Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
Added restrictions Srv_addGpsMeasurements/NavigationMessageListener
Browse files Browse the repository at this point in the history
Refs #1757
  • Loading branch information
M66B committed Dec 15, 2014
1 parent a95da3b commit 9c6c774
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions res/values/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
<string name="location_Srv_isProviderEnabled" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/location/LocationManager.html#isProviderEnabled(java.lang.String)">Google documentation</a>]]></string>
<string name="location_Srv_requestLocationUpdates" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent)">Google documentation</a>]]></string>
<string name="location_Srv_sendExtraCommand" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/location/LocationManager.html#sendExtraCommand(java.lang.String,%20java.lang.String,%20android.os.Bundle)">Google documentation</a>]]></string>
<string name="location_Srv_addGpsMeasurementsListener" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/location/LocationManager.html">Google documentation</a>]]></string>
<string name="location_Srv_addGpsNavigationMessageListener" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/location/LocationManager.html">Google documentation</a>]]></string>
<string name="location_enableLocationUpdates" translatable="false"><![CDATA[Will restrict location updates through the <a href="https://developer.android.com/reference/android/telephony/PhoneStateListener.html">phone state listener</a>]]></string>
<string name="location_getAllCellInfo" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getAllCellInfo()">Google documentation</a>]]></string>
<string name="location_getCellLocation" translatable="false"><![CDATA[<a href="https://developer.android.com/reference/android/telephony/TelephonyManager.html#getCellLocation()">Google documentation</a>]]></string>
Expand Down
4 changes: 4 additions & 0 deletions src/biz/bokhorst/xprivacy/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ public static List<Hook> 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));
Expand Down Expand Up @@ -587,6 +589,8 @@ public static List<Hook> 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
Expand Down
25 changes: 24 additions & 1 deletion src/biz/bokhorst/xprivacy/XLocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9c6c774

Please sign in to comment.