Fix Bundle.main asset path when DRM wrapper replaces applicationInfo.…#123
Closed
m-t-a-p wants to merge 2 commits into
Closed
Fix Bundle.main asset path when DRM wrapper replaces applicationInfo.…#123m-t-a-p wants to merge 2 commits into
m-t-a-p wants to merge 2 commits into
Conversation
…className - findMainBundlePackage fix
Member
|
Thanks again for all the work you've put into finding and fixing this issue. I think there is still a shortcoming in this technique that #124 fixes, which is that this PR will assume that the first For example, you might have: In this case, Could you try applying #124 and see if it also fixes your situation, if convenient? |
Member
|
Closing in favor of alternative fix in #124 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When apps are installed via Google Play, a DRM protection system called PairIP (
com.pairip.*) wraps apps by replacingapplicationInfo.classNamewith a customApplication subclass (e.g.
com.pairip.application.AppController).Bundle.mainderives its asset package path fromapplicationInfo.className:With PairIP active,
packageName(forClassName:)producescom.pairip.applicationinstead of the app's actual Kotlin namespace (e.g.what.watt), soBundle.mainresolvesto
asset:/com/pairip/application/Resources— which doesn't exist. SinceNSLocalizedString()defaults toBundle.main, all translations fail silently (raw keysreturned instead of strings). The bug only manifests on Google Play installs; direct APK installs are unaffected because PairIP is not injected.
Why not use
androidContext.packageName? It returns theapplicationId(e.g.ch.whatwatt.app) — the Play Store identifier — which is not the Kotlin namespace usedfor asset paths (e.g.
what.watt). Apps routinely differ these two values, sopackageNamewould break direct APK installs whereapplicationInfo.classNameis correct.Fix
After deriving the package name as before (fast path unchanged), validate it by checking whether
assets.list(derivedPath/Resources)returns any entries. If empty —indicating the derived path is wrong — search the top two levels of the asset tree for a directory containing a
Resourcessubdirectory.