Repository navigation
fix(android): keep pdiff working on density split installs - #700
Conversation
A split install only has the density variants its split carries, so every patch copy of another density looked like content drift and failed the patch. Fill those targets from the variant the resource has installed. Copies of an installed density, and paths present with other content, still fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
A target like drawable-night-hdpi resolved from the current configuration, so a day variant could land in the night directory. Such targets fail as drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
BundledResourceCopierfinds patch copies by CRC among the APKs installed on the device. A density split install (Google Play, orbundletool) only has the variants itssplit_config.<density>.apkcarries, so copies of every other density are never found and the whole patch fails withBundled resource content mismatch (crc32). On an app with@2xand@3ximages, 9 of 17 copies were missing at every density tested, so its Play users could not take a pdiff at all.Fix
When a copy's CRC is not found, its targets are filled from the variant Android resolves for that resource, only if all of these hold:
drawable-*path whose density is not installed;A copy of an installed density, a resource that was removed, and content that moved into an installed density still fail as before.
The filled file holds the installed variant, so a later density change reads an existing file instead of hitting
ENOENT. Its pixel size may not match its directory.Verification
BundledResourceCopierTest(new, not run by CI): 6 cases on the density decision.crunchPngson and off: unfixed fails, fixed succeeds; switching among xhdpi/xxhdpi/xxxhdpi loads every image; drift, removal and moved content fail; only changing a density that is not installed succeeds, as intended; plain APK unchanged; AAB baseline passes.shrinkResources,crunchPngs false), sideload APK as baseline, Play AAB split installed bybundletool, API 34: unfixed fails on 9 entries; fixed succeeds on xhdpi, xxhdpi and xxxhdpi, and images load after density changes.Not covered: splits delivered by Play itself (to be checked on an internal track after release), API 24/25.
🤖 Generated with Claude Code
Summary by CodeRabbit