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

Commit

Permalink
Revert "Fixed location restriction in AOSP mode"
Browse files Browse the repository at this point in the history
This reverts commit eeabe02.

Refs #2129
  • Loading branch information
M66B committed Feb 1, 2015
1 parent eeabe02 commit 3494196
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Changelog

**Next release**

* Fixed location restriction in AOSP mode ([issue](/../../issues/2129))
* ...

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
33 changes: 8 additions & 25 deletions src/biz/bokhorst/xprivacy/XLocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ else if (param.args[arg] != null && param.thisObject != null) {

// Create proxy
Util.log(this, Log.INFO, "Creating proxy uid=" + Binder.getCallingUid());
Object proxy = new ProxyLocationListener(Binder.getCallingUid(), param.args[arg]);
Object proxy = new ProxyLocationListener(Binder.getCallingUid(), (LocationListener) param.args[arg]);

// Use proxy
synchronized (mMapProxy) {
Expand Down Expand Up @@ -369,50 +369,33 @@ else if (param.args[arg] != null) {

private static class ProxyLocationListener implements LocationListener {
private int mUid;
private Object mListener;
private LocationListener mListener;

public ProxyLocationListener(int uid, Object listener) {
public ProxyLocationListener(int uid, LocationListener listener) {
mUid = uid;
mListener = listener;
}

@Override
public void onLocationChanged(Location location) {
Util.log(null, Log.INFO, "Location changed uid=" + Binder.getCallingUid());
try {
Location fakeLocation = PrivacyManager.getDefacedLocation(mUid, location);
mListener.getClass().getMethod("onLocationChanged", Location.class).invoke(mListener, fakeLocation);
} catch (Exception ex) {
Util.bug(null, ex);
}
Location fakeLocation = PrivacyManager.getDefacedLocation(mUid, location);
mListener.onLocationChanged(fakeLocation);
}

@Override
public void onProviderDisabled(String provider) {
try {
mListener.getClass().getMethod("onProviderDisabled", String.class).invoke(mListener, provider);
} catch (Exception ex) {
Util.bug(null, ex);
}
mListener.onProviderDisabled(provider);
}

@Override
public void onProviderEnabled(String provider) {
try {
mListener.getClass().getMethod("onProviderEnabled", String.class).invoke(mListener, provider);
} catch (Exception ex) {
Util.bug(null, ex);
}
mListener.onProviderEnabled(provider);
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
try {
mListener.getClass().getMethod("onStatusChanged", String.class, int.class, Bundle.class)
.invoke(mListener, provider);
} catch (Exception ex) {
Util.bug(null, ex);
}
mListener.onStatusChanged(provider, status, extras);
}
}
}

0 comments on commit 3494196

Please sign in to comment.