Skip to content

fix: enable host keyboard passthrough in AVDs (hw.keyboard=yes)#1

Merged
maxgfr merged 1 commit into
mainfrom
fix/hw-keyboard-passthrough
Jun 13, 2026
Merged

fix: enable host keyboard passthrough in AVDs (hw.keyboard=yes)#1
maxgfr merged 1 commit into
mainfrom
fix/hw-keyboard-passthrough

Conversation

@maxgfr

@maxgfr maxgfr commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Problem

Typing on the host (Mac) keyboard does nothing in the emulator. avdmanager's device profiles generate config.ini with hw.keyboard=no, which silently drops physical key events — you tap a text field, the on-screen keyboard appears, but the host keyboard is dead. (Diagnosed live: mInputShown=true and the soft IME renders fine; the gap was the physical keyboard.)

Fix

Flip the AVD to hw.keyboard=yes so the host keyboard types into the guest. The on-screen IME still shows because the system images keep show_ime_with_hard_keyboard=1 — so you get both keyboards.

  • emulator::with_hw_keyboard_enabled() — pure config.ini transform that flips/appends the bare hw.keyboard key without touching hw.keyboard.charmap / hw.keyboard.lid (+ 4 unit tests).
  • provision — applied on every cold boot, so AVDs created by an older andro heal automatically (no andro clean needed). Covers both the phone and TV profiles.

Verification

  • cargo test (39 unit + 11 integration) green, clippy clean.
  • Real andro up: config.ini rewritten noyes, regenerated hardware-qemu.ini reports hw.keyboard = true, guest exposes an active qwerty2 hardware keyboard, and show_ime_with_hard_keyboard stays 1.

🤖 Generated with Claude Code

avdmanager's device profiles generate config.ini with hw.keyboard=no,
which silently drops physical (Mac) key events — you tap a text field,
the on-screen keyboard shows, but typing on the host does nothing.

Flip it to hw.keyboard=yes so the host keyboard types into the guest.
The soft IME still appears because the system images keep
show_ime_with_hard_keyboard=1, so you get both keyboards.

- emulator::with_hw_keyboard_enabled(): pure config.ini transform that
  flips/append the bare hw.keyboard key without touching hw.keyboard.charmap
  or hw.keyboard.lid (+ unit tests).
- provision: apply it on every cold boot, so AVDs created by an older
  andro heal automatically — no `andro clean` required.

Verified end-to-end: a real boot rewrites config.ini (no→yes) and the
regenerated hardware-qemu.ini reports hw.keyboard = true, with the guest
exposing an active qwerty2 hardware keyboard.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maxgfr maxgfr merged commit 4e11bb2 into main Jun 13, 2026
5 checks passed
@maxgfr maxgfr deleted the fix/hw-keyboard-passthrough branch June 13, 2026 19:00
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant