From d148f9492ad35373253cb6e4a9c1e4d9b430849f Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 14 May 2014 12:03:44 +0200 Subject: [PATCH] Fixed incompatibility with Xposed 2.6 beta 1 Fixed #1659 --- CHANGELOG.md | 2 ++ README.md | 3 --- src/biz/bokhorst/xprivacy/PrivacyService.java | 5 ++++- src/biz/bokhorst/xprivacy/XActivityManagerService.java | 5 ++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81c22920b..7c91a78e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Changelog **Next release** +* Fixed incompatibility with Xposed 2.6 beta 1 ([issue](/../../issues/1659)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 2.0.20 STABLE** diff --git a/README.md b/README.md index 389b1f732..3c074dcf5 100644 --- a/README.md +++ b/README.md @@ -346,9 +346,6 @@ for unknown reasons ([issue](https://github.com/M66B/XPrivacy/issues/1607)). XPrivacy seems to cause camera lag on a Samsung Galaxy Note II ([issue](https://github.com/M66B/XPrivacy/issues/715)) -XPrivacy is reported to be incompatible with [WSM TOOLS](http://forum.xda-developers.com/showthread.php?t=2481178) -([issue](https://github.com/M66B/XPrivacy/issues/1655)). - Installation ------------ diff --git a/src/biz/bokhorst/xprivacy/PrivacyService.java b/src/biz/bokhorst/xprivacy/PrivacyService.java index af48dab56..6c71ec5a6 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyService.java +++ b/src/biz/bokhorst/xprivacy/PrivacyService.java @@ -3,6 +3,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; +import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Date; @@ -1695,7 +1696,9 @@ private Context getContext() { Object am = cam.getMethod("self").invoke(null); if (am == null) return null; - return (Context) cam.getDeclaredField("mContext").get(am); + Field mContext = cam.getDeclaredField("mContext"); + mContext.setAccessible(true); + return (Context) mContext.get(am); } catch (Throwable ex) { Util.bug(null, ex); return null; diff --git a/src/biz/bokhorst/xprivacy/XActivityManagerService.java b/src/biz/bokhorst/xprivacy/XActivityManagerService.java index cafd19c0d..e4fcaf446 100644 --- a/src/biz/bokhorst/xprivacy/XActivityManagerService.java +++ b/src/biz/bokhorst/xprivacy/XActivityManagerService.java @@ -1,5 +1,6 @@ package biz.bokhorst.xprivacy; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Semaphore; @@ -159,7 +160,9 @@ private int getUidANR(XParam param) throws IllegalAccessException { try { Class pr = Class.forName("com.android.server.am.ProcessRecord"); if (param.args.length > 0 && param.args[0] != null && param.args[0].getClass().equals(pr)) { - uid = (Integer) pr.getDeclaredField("uid").get(param.args[0]); + Field fUid = pr.getDeclaredField("uid"); + fUid.setAccessible(true); + uid = (Integer) fUid.get(param.args[0]); } } catch (ClassNotFoundException ignored) { } catch (NoSuchFieldException ignored) {