Repository navigation
Conversation
The composer field's OnControllableInsetsChangedListener removed itself inside its own callback. InsetsController walks that list by index with the size read up front, so with two composers composed (a subagent page over its session) the second read ran past the end and the app crashed with IndexOutOfBoundsException when a recreated window got control of the keys (Play crash, issue #247). The listener now marks itself done and stays registered until onDispose removes it, so it still asks for the keys at most once. Verified: new Robolectric test in ComposerKeyboardProgressTests fails without the fix with the same IndexOutOfBoundsException and passes with it; scripts/check.sh (vm.sh check) passes. On the emulator (Pixel 8, API 36, session-lab): subagent page open with the keyboard up, then a font scale change crashes dev and doesn't crash the branch, where the keyboard comes back up for the focused field. The Catch Up preview with a font scale change didn't crash on dev or the branch.
Review follow-up for #259. The regression test now focuses one field with a counting SoftwareKeyboardController and gives the window control of the keys, takes it away and gives it again: the listener asks for the keys once. Since the listener now stays registered, the asked guard is the only thing stopping a repeat request; without it the test fails at the second assertion. docs/parity/composer.md counts four ComposerKeyboardProgressTests. Verified: the test passes, and fails with the asked guard removed; vm.sh check :feature:composer passes.
This branch has not been deployed
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.
Fixes a crash Play reports as an IndexOutOfBoundsException in
InsetsController.invokeControllableInsetsChangedListeners.The composer field's controllable-insets listener removed itself from inside its own callback. Android walks that list by index with the size read up front, so when two composers are composed at once (a subagent page over its session) and a recreated window gets control of the keyboard, the second read runs past the end. The listener now just marks itself done and is removed in
onDispose, so it still asks for the keyboard at most once.Verified with a new Robolectric test in
ComposerKeyboardProgressTests(fails without the fix with the same exception, passes with it),scripts/check.sh, and on the emulator: with a subagent page open and the keyboard up, changing font size crashesdevand doesn't crash this branch, and the keyboard comes back up for the focused field. The Catch Up preview with a font size change didn't crash on either.Nothing visible changes, so no media.
Fixes #247