Apply patch da1daf of mywalkb/LSPosed_mod

From Android 14 QPR3 and forward, the classloader of injected app (com.android.shell)
does not contain the apk manager, so in hook getClassLoader there is a new check when
it got a negative response the apk manager is injected in classloader, so parasitic
manager can start correctly.

Co-authored-by: mywalk <66966897+mywalkb@users.noreply.github.com>
This commit is contained in:
JingMatrix 2024-05-18 21:31:04 +02:00
parent 8e96b8de21
commit 2e0de88eca
1 changed files with 11 additions and 1 deletions

View File

@ -123,7 +123,17 @@ public class ParasiticManagerHooker {
protected void afterHookedMethod(MethodHookParam param) { protected void afterHookedMethod(MethodHookParam param) {
var pkgInfo = getManagerPkgInfo(null); var pkgInfo = getManagerPkgInfo(null);
if (pkgInfo != null && XposedHelpers.getObjectField(param.thisObject, "mApplicationInfo") == pkgInfo.applicationInfo) { if (pkgInfo != null && XposedHelpers.getObjectField(param.thisObject, "mApplicationInfo") == pkgInfo.applicationInfo) {
sendBinderToManager((ClassLoader) param.getResult(), managerService.asBinder()); var sSourceDir = pkgInfo.applicationInfo.sourceDir;
var pathClassLoader = param.getResult();
Hookers.logD("LoadedApk getClassLoader " + pathClassLoader);
var pathList = XposedHelpers.getObjectField(pathClassLoader, "pathList");
List<String> lstDexPath = (List<String>)XposedHelpers.callMethod(pathList, "getDexPaths");
if (!lstDexPath.contains(sSourceDir)) {
Utils.logW("Could not find manager apk injected in classloader");
XposedHelpers.callMethod(pathClassLoader, "addDexPath", sSourceDir);
}
sendBinderToManager((ClassLoader) pathClassLoader, managerService.asBinder());
unhooks[0].unhook(); unhooks[0].unhook();
} }
} }