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

Commit

Permalink
Handle Play services differences (debug info)
Browse files Browse the repository at this point in the history
  • Loading branch information
M66B committed Aug 16, 2014
1 parent fea4eef commit 7a43c60
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Version 2.99.x and version 3.x will be available with a [pro license](http://www

* Added application specific quirks ([issue](/../../issues/1844))
* Added intent for update check ([issue](/../../issues/1867))
* Fixed all problems reported through the debug info
* Updated Simplified Chinese translation

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)
Expand Down
61 changes: 40 additions & 21 deletions src/biz/bokhorst/xprivacy/XConnectionCallbacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,52 @@ protected void before(XParam param) throws Throwable {
ClassLoader loader = param.thisObject.getClass().getClassLoader();

// FusedLocationApi
Class<?> cLoc = Class.forName("com.google.android.gms.location.LocationServices", false, loader);
Object fusedLocationApi = cLoc.getDeclaredField("FusedLocationApi").get(null);
if (PrivacyManager.getTransient(fusedLocationApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(fusedLocationApi.getClass().getName(), Boolean.toString(true));

if (fusedLocationApi != null)
XPrivacy.hookAll(XFusedLocationApi.getInstances(fusedLocationApi), loader, getSecret());
try {
Class<?> cLoc = Class.forName("com.google.android.gms.location.LocationServices", false, loader);
Object fusedLocationApi = cLoc.getDeclaredField("FusedLocationApi").get(null);
if (PrivacyManager.getTransient(fusedLocationApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(fusedLocationApi.getClass().getName(), Boolean.toString(true));

if (fusedLocationApi != null)
XPrivacy.hookAll(XFusedLocationApi.getInstances(fusedLocationApi), loader, getSecret());
}
} catch (ClassNotFoundException ex) {
Util.log(this, Log.WARN, ex.toString());
} catch (NoSuchFieldException ex) {
Util.log(this, Log.WARN, ex.toString());
}

// ActivityRecognitionApi
Class<?> cRec = Class.forName("com.google.android.gms.location.ActivityRecognition", false, loader);
Object activityRecognitionApi = cRec.getDeclaredField("ActivityRecognitionApi").get(null);
if (PrivacyManager.getTransient(activityRecognitionApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(activityRecognitionApi.getClass().getName(), Boolean.toString(true));

if (activityRecognitionApi != null)
XPrivacy.hookAll(XActivityRecognitionApi.getInstances(activityRecognitionApi), loader, getSecret());
try {
Class<?> cRec = Class.forName("com.google.android.gms.location.ActivityRecognition", false, loader);
Object activityRecognitionApi = cRec.getDeclaredField("ActivityRecognitionApi").get(null);
if (PrivacyManager.getTransient(activityRecognitionApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(activityRecognitionApi.getClass().getName(), Boolean.toString(true));

if (activityRecognitionApi != null)
XPrivacy.hookAll(XActivityRecognitionApi.getInstances(activityRecognitionApi), loader,
getSecret());
}
} catch (ClassNotFoundException ex) {
Util.log(this, Log.WARN, ex.toString());
} catch (NoSuchFieldException ex) {
Util.log(this, Log.WARN, ex.toString());
}

// AppIndexApi
Class<?> cApp = Class.forName("com.google.android.gms.appindexing.AppIndex", false, loader);
Object appIndexApi = cApp.getDeclaredField("AppIndexApi").get(null);
if (PrivacyManager.getTransient(appIndexApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(appIndexApi.getClass().getName(), Boolean.toString(true));

if (appIndexApi != null)
XPrivacy.hookAll(XAppIndexApi.getInstances(appIndexApi), loader, getSecret());
try {
Class<?> cApp = Class.forName("com.google.android.gms.appindexing.AppIndex", false, loader);
Object appIndexApi = cApp.getDeclaredField("AppIndexApi").get(null);
if (PrivacyManager.getTransient(appIndexApi.getClass().getName(), null) == null) {
PrivacyManager.setTransient(appIndexApi.getClass().getName(), Boolean.toString(true));

if (appIndexApi != null)
XPrivacy.hookAll(XAppIndexApi.getInstances(appIndexApi), loader, getSecret());
}
} catch (ClassNotFoundException ex) {
Util.log(this, Log.WARN, ex.toString());
} catch (NoSuchFieldException ex) {
Util.log(this, Log.WARN, ex.toString());
}

break;
Expand Down

0 comments on commit 7a43c60

Please sign in to comment.