Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix: SplitDelegateClassloader inject is not compatible with Tinker #49

Merged
merged 2 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class QigsawAppBasePlugin extends QigsawPlugin {
qigsawProcessManifest.mergedManifestFile = mergedManifestFile
qigsawProcessManifest.bundleManifestFile = bundleManifestFile
qigsawProcessManifest.mustRunAfter processManifest
processManifest.finalizedBy qigsawProcessManifest
generateQigsawConfig.dependsOn qigsawProcessManifest
boolean multiDexEnabled
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ private static void reflectPackageInfoClassloader(Context baseContext, ClassLoad
if (packageInfo != null) {
HiddenApiReflection.findField(packageInfo, "mClassLoader").set(packageInfo, reflectClassLoader);
}
try {
// Tinker(since 1.9.14.9) will set the mBase.mClassLoader field with its own ClassLoader,
// so we will re-set it with ours.
HiddenApiReflection.findField(baseContext, "mClassLoader").set(baseContext, reflectClassLoader);
} catch (Throwable ignored) {
// There's no mClassLoader field in ContextImpl before Android O.
// However we should try our best to replace this field in case some
// customized system has one.
}
}

static void inject(ClassLoader originalClassloader, Context baseContext) throws Exception {
Expand Down