Skip to content

Commit

Permalink
Force recompilation on Huawei devices
Browse files Browse the repository at this point in the history
They have added several checks that disable the recompiliation of
pre-optimized APKs. This must be undone when Xposed is active.

Fixes rovo89/Xposed#72.
  • Loading branch information
rovo89 committed Apr 12, 2016
1 parent 434b97f commit 468b5ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/src/main/java/de/robv/android/xposed/XposedBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import de.robv.android.xposed.services.BaseService;

import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import static de.robv.android.xposed.XposedHelpers.findClassIfExists;
import static de.robv.android.xposed.XposedHelpers.getBooleanField;
import static de.robv.android.xposed.XposedHelpers.getIntField;
import static de.robv.android.xposed.XposedHelpers.getObjectField;
Expand Down Expand Up @@ -246,6 +247,14 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[2] = true;
}
});

// Huawei
Class<?> clsHwPackageManager = findClassIfExists("com.android.server.pm.HwPackageManagerService", cl);
if (clsHwPackageManager != null) {
findAndHookMethod(clsHwPackageManager, "isOdexMode", XC_MethodReplacement.returnConstant(false));
String className = "com.android.server.pm." + (Build.VERSION.SDK_INT >= 23 ? "PackageDexOptimizer" : "PackageManagerService");
findAndHookMethod(className, cl, "dexEntryExists", String.class, XC_MethodReplacement.returnConstant(true));
}
}
}
});
Expand Down

0 comments on commit 468b5ca

Please sign in to comment.