Skip to content

fix: prevent auto-caps errors with unavailable text cache - #664

Merged
LeanBitLab merged 1 commit into
mainfrom
fix-auto-caps-fallback-5380252126256777111
Oct 14, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix-auto-caps-fallback-5380252126256777111

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

Fixes an issue where auto-capitalization fails due to a race condition / unavailable text cache during rapid app switching, Autofill insertions, or transient fields. Fallback caps mode logic was updated to rely on EditorInfo correctly.

💡 What

  • Updated RichInputConnection.getCursorCapsMode to correctly use EditorInfo.initialCapsMode as the fallback when the text cache is not immediately available.
  • Updated LatinIME.onStartInputViewInternal to properly reset the Caps State to CAP_MODE_OFF for transient TYPE_NULL input fields.
  • Removed aggressive/false-positive Log.e on closing Batch edits when the nest level is already 0.

🔍 Verification

Ran gradlew :app:testStandardDebugUnitTest --tests "*RichInputConnection*" and observed no crashes or side effects. Verified the fallback properly evaluates ei?.initialCapsMode.

📦 Impact

Users will no longer experience incorrect lowercase-by-default behavior immediately after focusing a text field when the input connection text cache is lagging. Reduces aggressive bug-report-like logging in Logcat during generic text operations.


PR created automatically by Jules for task 5380252126256777111 started by @LeanBitLab

When the keyboard connects to a new or transient input field, the text
cache may be temporarily unavailable. Previously, this caused the caps mode
to default to CAP_MODE_OFF, breaking auto-capitalization in fast switching or
autofill scenarios.

This commit updates `RichInputConnection.getCursorCapsMode` to use
`EditorInfo.initialCapsMode` as a fallback when `getTextBeforeCursor` or
`reloadTextCache` fails, properly inheriting the app's requested capitalization.

Also fixes a batch edit nesting error log spam and ensures that caps mode is
explicitly reset for transient `TYPE_NULL` focus events to prevent stale state leaking
across apps.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@LeanBitLab
LeanBitLab merged commit 8272e36 into main Oct 14, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix-auto-caps-fallback-5380252126256777111 branch October 14, 2026 09:45
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