Skip to content

Localized Android icons: prevent sibling-locale fallback#4925

Merged
shai-almog merged 1 commit into
masterfrom
fix-android-localized-icon-sibling-fallback
May 12, 2026
Merged

Localized Android icons: prevent sibling-locale fallback#4925
shai-almog merged 1 commit into
masterfrom
fix-android-localized-icon-sibling-fallback

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • Android's resource resolver (API 24+) walks every child of the parent locale when it can't find an exact or parent-language match. With only cn1_icon_ar_AE.png shipped, the build emitted drawable-ar-rAE-*/ with no drawable-ar/, so an ar-PK device hit the AE icon as a sibling match (customer report).
  • processLocalizedIcons now does a first pass to identify languages that have region-qualified variants but no language-only variant, and writes the default (non-localized) app icon into drawable-<lang>/ (and mipmap-*-<lang>/ for adaptive icons). The parent-locale lookup now succeeds before Android escalates to sibling regions.
  • If the user already supplied a cn1_icon_<lang>.png it remains the language-level fallback — no behaviour change for that pattern.
  • iOS already does strict lang_COUNTRYlang matching at runtime, so it's unaffected.

Test plan

  • Build an Android app with only cn1_icon_ar_AE.png supplied and verify drawable-ar-rAE-*/icon.png + drawable-ar-*/icon.png (default icon) are both produced.
  • Install on a device set to Arabic / region Pakistan → expect default icon (was: AE icon).
  • Install on a device set to Arabic / region UAE → expect AE icon.
  • Build with both cn1_icon_ar.png and cn1_icon_ar_AE.png and verify drawable-ar-*/ uses the user-supplied Arabic icon (no barrier override).

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: Vale failed (exit code 2) (report)
  • Image references: 1 unused image(s) found (report)

Unused image preview:

  • img/skin-designer/.gitkeep

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 12, 2026

Compared 105 screenshots: 105 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 207 seconds

Build and Run Timing

Metric Duration
Simulator Boot 76000 ms
Simulator Boot (Run) 1000 ms
App Install 20000 ms
App Launch 26000 ms
Test Execution 271000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1690.000 ms
Base64 CN1 encode 1444.000 ms
Base64 encode ratio (CN1/native) 0.854x (14.6% faster)
Base64 native decode 844.000 ms
Base64 CN1 decode 1139.000 ms
Base64 decode ratio (CN1/native) 1.350x (35.0% slower)
Base64 SIMD encode 433.000 ms
Base64 encode ratio (SIMD/native) 0.256x (74.4% faster)
Base64 encode ratio (SIMD/CN1) 0.300x (70.0% faster)
Base64 SIMD decode 413.000 ms
Base64 decode ratio (SIMD/native) 0.489x (51.1% faster)
Base64 decode ratio (SIMD/CN1) 0.363x (63.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 112.000 ms
Image createMask (SIMD on) 15.000 ms
Image createMask ratio (SIMD on/off) 0.134x (86.6% faster)
Image applyMask (SIMD off) 215.000 ms
Image applyMask (SIMD on) 100.000 ms
Image applyMask ratio (SIMD on/off) 0.465x (53.5% faster)
Image modifyAlpha (SIMD off) 221.000 ms
Image modifyAlpha (SIMD on) 169.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.765x (23.5% faster)
Image modifyAlpha removeColor (SIMD off) 324.000 ms
Image modifyAlpha removeColor (SIMD on) 135.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.417x (58.3% faster)
Image PNG encode (SIMD off) 1618.000 ms
Image PNG encode (SIMD on) 1298.000 ms
Image PNG encode ratio (SIMD on/off) 0.802x (19.8% faster)
Image JPEG encode 692.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 12, 2026

Compared 105 screenshots: 105 matched.

Native Android coverage

  • 📊 Line coverage: 11.23% (6208/55280 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.94% (30777/344403), branch 3.85% (1262/32764), complexity 4.97% (1560/31415), method 8.71% (1280/14698), class 14.72% (293/1991)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 11.23% (6208/55280 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 8.94% (30777/344403), branch 3.85% (1262/32764), complexity 4.97% (1560/31415), method 8.71% (1280/14698), class 14.72% (293/1991)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 941.000 ms
Base64 CN1 encode 111.000 ms
Base64 encode ratio (CN1/native) 0.118x (88.2% faster)
Base64 native decode 762.000 ms
Base64 CN1 decode 163.000 ms
Base64 decode ratio (CN1/native) 0.214x (78.6% faster)
Image encode benchmark status skipped (SIMD unsupported)

Android's resource resolver (API 24+) walks every child of the parent
locale when it can't find an exact or parent-language match, so an
ar-PK device with only drawable-ar-rAE/ supplied would match the AE
icon. Insert the default app icon into drawable-<lang>/ (and
mipmap-*-<lang>/) when only region-qualified variants are provided, so
the parent-locale lookup succeeds before sibling matching kicks in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog shai-almog force-pushed the fix-android-localized-icon-sibling-fallback branch from 920acd8 to 0210813 Compare May 12, 2026 09:24
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 12, 2026

Compared 15 screenshots: 15 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 12, 2026

Compared 104 screenshots: 104 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 237 seconds

Build and Run Timing

Metric Duration
Simulator Boot 79000 ms
Simulator Boot (Run) 1000 ms
App Install 14000 ms
App Launch 4000 ms
Test Execution 290000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1113.000 ms
Base64 CN1 encode 1314.000 ms
Base64 encode ratio (CN1/native) 1.181x (18.1% slower)
Base64 native decode 737.000 ms
Base64 CN1 decode 982.000 ms
Base64 decode ratio (CN1/native) 1.332x (33.2% slower)
Base64 SIMD encode 397.000 ms
Base64 encode ratio (SIMD/native) 0.357x (64.3% faster)
Base64 encode ratio (SIMD/CN1) 0.302x (69.8% faster)
Base64 SIMD decode 415.000 ms
Base64 decode ratio (SIMD/native) 0.563x (43.7% faster)
Base64 decode ratio (SIMD/CN1) 0.423x (57.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 57.000 ms
Image createMask (SIMD on) 10.000 ms
Image createMask ratio (SIMD on/off) 0.175x (82.5% faster)
Image applyMask (SIMD off) 140.000 ms
Image applyMask (SIMD on) 60.000 ms
Image applyMask ratio (SIMD on/off) 0.429x (57.1% faster)
Image modifyAlpha (SIMD off) 135.000 ms
Image modifyAlpha (SIMD on) 54.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.400x (60.0% faster)
Image modifyAlpha removeColor (SIMD off) 163.000 ms
Image modifyAlpha removeColor (SIMD on) 75.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.460x (54.0% faster)
Image PNG encode (SIMD off) 946.000 ms
Image PNG encode (SIMD on) 802.000 ms
Image PNG encode ratio (SIMD on/off) 0.848x (15.2% faster)
Image JPEG encode 429.000 ms

@shai-almog shai-almog merged commit ae54da1 into master May 12, 2026
24 checks passed
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.

1 participant