Skip to content

Commit 522b9ce

Browse files
JingMatrixre-zero001
authored andcommitted
Add LoadedApk callers to deoptimize list (JingMatrix#414)
This commit attempts to resolve an issue reported by users on recent OnePlus software updates where LSPosed modules are no longer able to hook the `Application#attach` method. Android Runtime (ART) on these devices has become more aggressive with method inlining. This optimization can cause the relatively small `Application#attach` method to be directly embedded into its (indirect) calling methods, which makes it invisible to the hooking framework. This approach is adapted from a reportedly successful commit in a community fork (LSPosed-Irena). It identifies `makeApplication` and `makeApplicationInner` within the `android.app.LoadedApk` class as the key callers to deoptimize. By adding these methods to the `BOOT_IMAGE` list, the goal is to prevent ART from inlining them, thus preserving `Application#attach` as a distinct and hookable method. Co-authored-by: Irena <140869597+re-zero001@users.noreply.github.com>
1 parent 14b454a commit 522b9ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/java/org/lsposed/lspd/deopt/InlinedMethodCallers.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public class InlinedMethodCallers {
6161
{"android.app.LoadedApk", "makeApplicationInner", Boolean.TYPE, Instrumentation.class, Boolean.TYPE},
6262
{"android.app.Instrumentation", "newApplication", ClassLoader.class, String.class, Context.class},
6363
{"android.app.Instrumentation", "newApplication", ClassLoader.class, Context.class},
64+
65+
// callers of Instrumentation#newApplication(ClassLoader, String, Context)
66+
{"android.app.LoadedApk", "makeApplicationInner", Boolean.TYPE, Instrumentation.class, Boolean.TYPE},
67+
{"android.app.LoadedApk", "makeApplicationInner", Boolean.TYPE, Instrumentation.class},
68+
{"android.app.LoadedApk", "makeApplication", Boolean.TYPE, Instrumentation.class},
69+
6470
{"android.app.ContextImpl", "getSharedPreferencesPath", String.class}
6571
};
6672

0 commit comments

Comments
 (0)