Repository navigation
fix: report Drag as unsupported on Android 7 instead of a silent no-op - #44
Merged
Jeomon merged 1 commit intoNov 11, 2026
Merged
Conversation
input draganddrop exists from Android 8.0. On Android 7.x, AOSP's Input prints "Error: Unknown command: draganddrop" to stderr and returns normally, so it exits 0. shell() returns stdout only and raises only on a non-zero exit, so drag() returned as if it had worked: the Drag tool told the agent "Dragged from ... and dropped on ..." while nothing moved, and the docstring's "earlier releases fail with an adb error" never happened. Merge stderr into stdout for the command and raise AdbError on "Unknown command", which every tool already turns into a message for the agent. Same cause as the clear_text fix in CursorTouch#40. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014TonJ1geSd97oAtSBZofUK
Member
|
Thanks for the fix, @aftabkh4n. Drag now fails with a clear error on Android 7 instead of reporting success, and it matches the clear_text approach from #40. Merging. |
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.
Problem
input draganddropwas added in Android 8.0. In AOSPcmds/input/.../Input.java,android-7.1.2_r1has nodraganddropbranch, andandroid-8.0.0_r1adds it.On Android 7.x, an unknown subcommand prints
Error: Unknown command: draganddropto stderr andreturns, so the process exits 0.core.shell()returns stdout only and raises only on a non-zero exit. As a resultadb.drag()returned normally, and theDragtool told the agent "Dragged from (x1,y1) and dropped on (x2,y2)" while nothing had moved. The agent then continues from a state that never happened.The
drag()docstring said older releases "fail with an adb error", but they never did.This is the same cause as the
clear_textfix in #40.Change
adb/input.py: runinput draganddrop … 2>&1. If the output contains "Unknown command", raiseAdbError("Drag needs Android 8 or later: …").Session.operationalready turnsAdbErrorinto aToolError, so the agent gets a clear message.Testing
uv run pytest: 584 passed, 21 skipped.ruff checkandruff format --checkare clean.test_drag_on_a_device_without_draganddrop_raises. Its fake device returns the answer only when the command merges stderr, as a real device does. It fails onmasterand passes with this change.subprocesspath, withANDROID_MCP_ADB_PATHpointing at a fakeadbthat keeps stderr separate and exits 0:draganddropunknown)AdbError: Drag needs Android 8 or later …I don't have a physical Android 7 device. The behavior is taken from AOSP source (
android-7.1.2_r1andandroid-8.0.0_r1).