Repository navigation
fix(android): type literal %s correctly in the adb input text fallback - #161
Open
theworker02 wants to merge 1 commit into
Open
theworker02 wants to merge 1 commit into
theworker02 wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
theworker02
force-pushed
the
fix/adb-input-text-percent-s
branch
from
September 27, 2026 19:30
907401e to
32b95bf
Compare
Android's input text replaces every %s with a space and has no escape for it. Split each literal %s across two commands so the % is typed as-is. Fixes google#160
theworker02
force-pushed
the
fix/adb-input-text-percent-s
branch
from
September 27, 2026 19:31
32b95bf to
7e23c11
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.
Fixes #160
Problem
Android's
input textturns every%sinto a space and has no escape for a literal%s._escape_for_adb_text()encodes spaces as%sbut leaves real%ssequences alone, so text such asHello %sor50%salewas typed asHello/50 alewhenever the native fallback ran.AndroidInputIME.type_text()hits this for all ASCII text, because its fast path always usesinput text.Change
_adb_input_text_commands(line)inadb_driver.py. It splits the line at each literal%sso that%ends oneinput textcommand andsstarts the next. Each command is decoded on its own, so the trailing%is typed literally. Lines without%sstill produce exactly one command, same as before.AndroidAdbDriver.input_text()Tier 3 and bothinput textpaths inAndroidInputIME.type_text()use the new helper._escape_for_adb_text()frominput_ime.py, which now imports the shared helper.Testing
New
tests/unit/test_adb_input_text.py:input textdecodes its argument (shell backslash escapes,%s→ space), used to assert round-trips forHello %s,50%sale,a%s%sb,100% sure,%%s literal,ends with %, and plain text.AndroidAdbDriver.input_text()(native fallback) andAndroidInputIME.type_text()(ASCII fast path).uv run pytest tests/unit/test_adb_input_text.py tests/unit/test_drivers.pypasses, andruff format --check,ruff check, andpyright --project pyright-core.jsonare clean.