Skip to content

fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况#1801

Open
Nam0101 wants to merge 3 commits into
Tencent:devfrom
Nam0101:contribai/improve/quality/force-include-all-inner-classes-when-the
Open

fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况#1801
Nam0101 wants to merge 3 commits into
Tencent:devfrom
Nam0101:contribai/improve/quality/force-include-all-inner-classes-when-the

Conversation

@Nam0101
Copy link
Copy Markdown

@Nam0101 Nam0101 commented May 16, 2026

Summary

fix: resolve #1212 — 360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况

Problem

Severity: High | File: tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/DexPatchGenerator.java

The IllegalAccessError reported ('FindFragment' attempting to access 'FindFragment$4') is caused by the outer class living in changed_classes2.dex.jar (loaded by Tinker's patch ClassLoader) while the inner class FindFragment$4 remains in the hardened base dex (loaded by a different ClassLoader installed by 360 Jiagu). Even though the inner class wasn't textually modified, it must travel with its outer class so that both classes resolve via the same ClassLoader at runtime; otherwise ART enforces package-private/inner-class access checks across ClassLoaders and rejects the access.

Solution

After the diff phase produces the set of "changed" classes, walk that set and for each class name Lcom/foo/Outer; find every class in the new dex whose name matches Lcom/foo/Outer$.*; (and recursively for nested inner classes). Add those classes to the patch output even if the diff considered them unchanged. Concretely:

Changes

  • tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/DexPatchGenerator.java (modified)
  • tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/patch/Configuration.java (modified)
  • tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/dexpatcher/util/RelatedClassResolver.java (new)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Note: this change was drafted with AI assistance and reviewed locally before submission.

@tencent-adm
Copy link
Copy Markdown
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

360加固之后,一些代码会导致崩溃,另外isProtectedApp=true的情况

2 participants