Skip to content

fix(accesskey): fall back to raster logo when vector rasterization fails#1030

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/accesskey-logo-raster-fallback
Jul 3, 2026
Merged

fix(accesskey): fall back to raster logo when vector rasterization fails#1030
bmc08gt merged 1 commit into
code/cashfrom
fix/accesskey-logo-raster-fallback

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

Drawable.toBitmap on the vector access-key logo crashes on some budget OEM
devices (e.g. Infinix X693, Vortex JK68) with
java.lang.IllegalArgumentException: width and height must be > 0, seen
unhandled in production (Bugsnag 6a47a1e0, and the same signature across
several sibling groups).

Deobfuscating the R8-mapped stack for the crashing build put the failure in
BaseAccessKeyViewModel.createBitmapForExport — specifically the R8-inlined
DrawableKt.toBitmap on ic_flipcash_logo. The logo is a tiny 92×132 bitmap,
so this is not memory pressure. Our dimensions are valid positive
constants; the > 0 violation originates inside VectorDrawable's internal
cache-bitmap allocation
on these ROMs — a device-level defect in the
vector→bitmap path.

Fix

  • Add a pre-rasterized PNG fallback (ic_flipcash_logo_raster, a
    drawable-nodpi asset reconstructed 1:1 from the vector geometry). It's a
    BitmapDrawable, so toBitmap takes the createScaledBitmap decode/scale
    path and never touches the VectorDrawable cache that crashes.
  • Flow: try the vector → on failure recoverCatching with the PNG → if even
    that fails, render the recovery image without the logo (key words + QR
    still intact) and report a non-fatal, instead of dropping the whole image.
  • Remove the !! on the logo drawable (latent NPE).

This complements #1027 (which catches the crash but discards the entire image);
here the image survives — with the logo on virtually all devices, and without
it only as a last resort.

Verification

  • ./gradlew :apps:flipcash:shared:accesskey:compileDebugKotlin — BUILD
    SUCCESSFUL (regenerates R, confirms the new drawable resolves).
  • Rendered PNG visually verified to match the Flipcash logo.
  • The OEM vector-cache failure can't be reproduced on non-affected hardware, so
    the fallback firing is only observable in the field once shipped; the PNG
    path is structurally immune to the crash regardless.

Rasterizing the vector access-key logo via Drawable.toBitmap crashes on some
budget OEM devices (e.g. Infinix X693, Vortex JK68) with
"width and height must be > 0". The failure originates inside VectorDrawable's
internal cache-bitmap allocation, not our dimensions — the values we pass
(92x132) are valid, so it's a device-level defect in the vector->bitmap path.

Add a pre-rasterized PNG fallback: try the vector first, and on failure retry
with a BitmapDrawable (ic_flipcash_logo_raster), which goes through the far
more robust decode/scale path and sidesteps the VectorDrawable cache entirely.
If even that fails, render the recovery image without the logo instead of
dropping the whole image, and report a non-fatal.

Also removes the !! on the logo drawable, which was a latent NPE.

Refs Bugsnag 6a47a1e0.
@bmc08gt bmc08gt merged commit 5509cc7 into code/cash Jul 3, 2026
3 checks passed
@bmc08gt bmc08gt deleted the fix/accesskey-logo-raster-fallback branch July 3, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant