Skip to content

Commit

Permalink
Don't hook resources in the Sygic process
Browse files Browse the repository at this point in the history
They have implemented low-level resource class replacements themselves,
which conflict with Xposed's.

Fixes rovo89/Xposed#54.
  • Loading branch information
rovo89 committed Aug 16, 2015
1 parent 7ae6185 commit a96971a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/de/robv/android/xposed/XposedBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -274,6 +275,7 @@ private static void hookResources() throws Throwable {
final Class<?> classGTLR;
final Class<?> classResKey;
final ThreadLocal<Object> latestResKey = new ThreadLocal<Object>();
final String[] conflictingPackages = { "com.sygic.aura" };

if (Build.VERSION.SDK_INT <= 18) {
classGTLR = ActivityThread.class;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit a96971a

Please sign in to comment.