Fix inline autofill suggestions never rendering/tappable (size spec mismatch + WRAP_CONTENT collapse) - #850
Open
lexuschris wants to merge 1 commit into
Conversation
Two independent bugs in the inline-suggestions pipeline: 1. inflateSuggestionView() requested a single hardcoded 150dp x 40dp size for every suggestion via suggestion.inflate(), ignoring that onCreateInlineSuggestionsRequest() declares per-suggestion size bounds (regular chips: 80-400dp wide; a trailing icon-only spec: 32-48dp wide). Requesting a size outside a suggestion's own InlinePresentationSpec bounds causes it to silently fail to inflate. 2. Successfully-inflated suggestions were added to the suggestion bar with LinearLayout.LayoutParams(WRAP_CONTENT, MATCH_PARENT). The returned view is an InlineContentView hosting cross-process rendered content and does not reliably self-report a measured size, so WRAP_CONTENT collapsed it to an invisible/untappable 0-width view even though the content rendered correctly on the system side. Fixes both by clamping each suggestion's inflate size to its own spec's minSize/maxSize, and threading that exact size through as explicit LayoutParams instead of WRAP_CONTENT. Verified on a Pixel 6 Pro (GrapheneOS) with 1Password as the Autofill service, across both the primary and a secondary user profile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner
|
@lexuschris amazing - taking a look now! |
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
Fixes #849 — inline autofill suggestions (e.g. from 1Password) would signal availability (indicator icon shown) but never render visibly or tappably in the suggestion bar.
Two independent bugs, both in the inline-suggestions pipeline introduced for password-manager autofill support:
inflateSuggestionView()requested a single hardcoded150dp × 40dpsize for every suggestion viasuggestion.inflate(), ignoring thatonCreateInlineSuggestionsRequest()declares per-suggestion size bounds (regular chips: 80–400dp wide; a trailing icon-only spec: 32–48dp wide). Requesting a size outside a suggestion's ownInlinePresentationSpecbounds causes the system to silently fail to inflate it.LinearLayout.LayoutParams(WRAP_CONTENT, MATCH_PARENT). The returned view is anInlineContentViewhosting cross-process rendered content (viaSurfaceControlViewHost) and does not reliably self-report a measured size to aWRAP_CONTENTparent, so it can collapse to an invisible/untappable 0-width view even though the underlying content rendered correctly on the system side.Changes
UrikInputMethodService.kt:inflateSuggestionView()now readssuggestion.info.inlinePresentationSpecand clamps the requested inflate size into that suggestion's ownminSize/maxSize, and returnsPair<View, Size>so the exact size used travels with the view.CandidateBarController.kt/SwipeKeyboardView.kt:updateInlineAutofillSuggestions()now takesList<Pair<View, Size>>and applies each view's exact size as explicitLinearLayout.LayoutParamsinstead ofWRAP_CONTENT.CandidateBarControllerTest.kt: updated to the new signature.Root cause discovery
Found by decompiling the actual
android-36platform jar to confirm the realInlineSuggestionInfoAPI surface (getInlinePresentationSpec(), not the initially-assumedgetPresentationSpec()), and by capturing on-devicelogcatduring reproduction, which showedInlineSuggestionRenderServicesuccessfully creating and measuring suggestion content (measuredSize=525x140) with no exceptions in the app's own error log — proving the content was fine and the bug was in how the returned view was being laid out client-side, not in suggestion delivery itself.Test plan
./gradlew compileDebugKotlin/compileDebugUnitTestKotlin— clean build./gradlew assembleDebug— builds./gradlew test) — not re-run after this change, recommend running before merge