Skip to content

feat(io): add keyboard status and hide commands (android) - #333

Open
gmegidish wants to merge 2 commits into
mainfrom
feat/io-keyboard-hide-status-adb
Open

feat(io): add keyboard status and hide commands (android)#333
gmegidish wants to merge 2 commits into
mainfrom
feat/io-keyboard-hide-status-adb

Conversation

@gmegidish

@gmegidish gmegidish commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds mobilecli io keyboard status and mobilecli io keyboard hide for Android devices.
  • New devices.KeyboardControllable optional interface — only AndroidDevice implements it, so iOS (real + simulator) and remote devices return a clear "not supported" error instead of a stub/panic.
  • IsKeyboardVisible() / HideKeyboard() shell out directly via adb shell dumpsys input_method (mInputShown=) and adb shell input keyevent 4 (BACK) — no on-device agent, no app-debuggable requirement. HideKeyboard only sends BACK when the keyboard is actually visible, so it never fires a stray back-navigation.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds device-scoped io keyboard status and io keyboard hide commands. The commands validate device capabilities, query Android keyboard visibility, dismiss visible keyboards, print JSON responses, and propagate errors.

Changes

Keyboard control

Layer / File(s) Summary
Keyboard control contracts
commands/keyboard.go, devices/common.go
Adds KeyboardControllable, keyboard request and result types, device selection, and capability validation.
Android keyboard operations
devices/android_keyboard.go, devices/android_keyboard_test.go
Parses mInputShown from dumpsys input_method, checks visibility, sends a back key event when visible, and tests parser behavior.
Keyboard CLI flow
commands/keyboard.go, cli/io.go
Adds the status and hide handlers, registers them under io keyboard, adds device flags, prints JSON responses, and propagates errors.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant KeyboardCommands
  participant AndroidDevice
  participant ADB
  CLI->>KeyboardCommands: Execute status or hide with device ID
  KeyboardCommands->>AndroidDevice: Resolve keyboard-controllable device
  AndroidDevice->>ADB: Query or dismiss keyboard
  ADB-->>AndroidDevice: Return command result
  AndroidDevice-->>KeyboardCommands: Return visibility or dismissal result
  KeyboardCommands-->>CLI: Return JSON response or wrapped error
Loading

Possibly related PRs

  • mobile-next/mobilecli#298: Implements similar keyboard status and hide functionality across the CLI, command handlers, device interface, and Android keyboard operations.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the Android keyboard status and hide commands added by the pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/io-keyboard-hide-status-adb

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@devices/android_keyboard.go`:
- Around line 20-26: Update the mInputShown parsing loop in status to inspect
whitespace-separated fields rather than requiring the field to start the trimmed
line, then parse its value with strconv.ParseBool and propagate invalid-value
errors. Add a regression test covering mInputShown appearing after the other
fields on the same dumpsys output line.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4a1a7146-7ea8-4b2d-baf4-049e39cf119e

📥 Commits

Reviewing files that changed from the base of the PR and between 595d4c2 and 2c14191.

📒 Files selected for processing (4)
  • cli/io.go
  • commands/keyboard.go
  • devices/android_keyboard.go
  • devices/common.go

Comment thread devices/android_keyboard.go Outdated
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