From a96971a668d81f8c447572e730cc6ecec55d8c05 Mon Sep 17 00:00:00 2001 From: rovo89 Date: Fri, 14 Aug 2015 21:06:57 +0200 Subject: [PATCH] Don't hook resources in the Sygic process They have implemented low-level resource class replacements themselves, which conflict with Xposed's. Fixes rovo89/Xposed#54. --- src/de/robv/android/xposed/XposedBridge.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/de/robv/android/xposed/XposedBridge.java b/src/de/robv/android/xposed/XposedBridge.java index 1d1da4d..7d9e200 100644 --- a/src/de/robv/android/xposed/XposedBridge.java +++ b/src/de/robv/android/xposed/XposedBridge.java @@ -257,6 +257,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { if (!SELinuxHelper.getAppDataFileService().checkFileExists(BASE_DIR + "conf/disable_resources")) { hookResources(); } else { + Log.w(TAG, "Found " + BASE_DIR + "conf/disable_resources, not hooking resources"); disableResources = true; } } @@ -274,6 +275,7 @@ private static void hookResources() throws Throwable { final Class classGTLR; final Class classResKey; final ThreadLocal latestResKey = new ThreadLocal(); + final String[] conflictingPackages = { "com.sygic.aura" }; if (Build.VERSION.SDK_INT <= 18) { classGTLR = ActivityThread.class; @@ -308,6 +310,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { if (result == null || result instanceof XResources) return; + if (Arrays.binarySearch(conflictingPackages, AndroidAppHelper.currentPackageName()) == 0) + return; + // replace the returned resources with our subclass XResources newRes = (XResources) cloneToSubclass(result, XResources.class); String resDir = (String) getObjectField(key, "mResDir"); @@ -348,6 +353,9 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable { if (result == null || result instanceof XResources) return; + if (Arrays.binarySearch(conflictingPackages, AndroidAppHelper.currentPackageName()) == 0) + return; + // replace the returned resources with our subclass XResources newRes = (XResources) cloneToSubclass(result, XResources.class); String resDir = (String) param.args[0];