Constructor of ActivityThread is private (#1833)

This commit is contained in:
残页 2022-04-11 00:18:05 +08:00 committed by GitHub
parent 6b7fdb2fac
commit 9a022f4c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -102,7 +102,8 @@ public final class XposedBridge {
// ActivityThread for now and the call will throw an NPE. Luckily they check the
// nullability of the result configuration. So we hereby set a dummy
// ActivityThread to bypass such a situation.
XposedHelpers.setStaticObjectField(ActivityThread.class, "sCurrentActivityThread", new ActivityThread());
var fake = XposedHelpers.newInstance(ActivityThread.class);
XposedHelpers.setStaticObjectField(ActivityThread.class, "sCurrentActivityThread", fake);
try {
TypedArray ta = res.obtainTypedArray(res.getIdentifier(
"preloaded_drawables", "array", "android"));