diff --git a/CHANGELOG.md b/CHANGELOG.md index 44456cf63..97c3bc6bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java b/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java index 9586074ae..567c02e29 100644 --- a/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java +++ b/src/biz/bokhorst/xprivacy/XConnectionCallbacks.java @@ -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;