Repository navigation
Conversation
…eam#175) Resources.getIdentifier() returns 0 when a subtype_* string does not exist for a locale listed in subtype_locale_exception_keys, subtype_locale_displayed_in_root_locale or predefined_layouts. These 0 values were stored unchecked in the name-id maps, and getSubtypeLocaleDisplayNameInternal() later called getString(0), which throws Resources$NotFoundException: 'String resource ID #0x0' and crashes the keyboard when such a subtype is selected. Skip registering missing resources so the existing fallbacks kick in (locale display name / UNKNOWN_KEYBOARD_LAYOUT), keep the two exceptional-locale maps in sync because isExceptionalLocale() checks one while getSubtypeNameId() reads the other, and guard the exceptional-name lookup against a stored 0 as a second line of defence. Fixes openboard-team#175 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MiMoHo
force-pushed
the
fix/subtype-name-crash
branch
from
September 9, 2026 15:22
4e4894b to
3019766
Compare
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.
Summary
Selecting certain subtypes crashes the keyboard with
Resources$NotFoundException: String resource ID #0x0thrown fromSubtypeLocaleUtils(#175).Resources.getIdentifier()returns 0 when asubtype_*string does not exist for a locale listed insubtype_locale_exception_keys,subtype_locale_displayed_in_root_localeorpredefined_layouts. Those zeros were stored unchecked in the name-id maps, and the display-name lookup later callsres.getString(0), which throws.Fix
UNKNOWN_KEYBOARD_LAYOUT).sExceptionalLocaleToNameIdsMapandsExceptionalLocaleToWithLayoutNameIdsMapin sync (a locale is only "exceptional" when both strings exist), becauseisExceptionalLocale()checks one map whilegetSubtypeNameId()reads the other — an asymmetric skip would trade the crash for an NPE.Testing
Builds with the stock toolchain (AGP 7.0.4/JDK 11); keyboard smoke-tested on an Android 15 emulator (typing, suggestions, subtype switching). The crash itself needs a subtype whose name string is missing, which none of the bundled subtypes currently triggers — the fix makes the code robust against that class of mismatch (as reported from third-party/derived builds in #175).
Fixes #175
🤖 Generated with Claude Code