Skip to content

Add android_ime tool: check, enable, disable, and switch input methods (ADBKeyboard etc.) #13

Description

@ArtemisArchitect

Problem

There is no dedicated tool for managing the Android input method (IME/keyboard). This is a critical pre-flight checkandroid_type relies on ADBKeyboard (com.android.adbkeyboard/.AdbIME) for Unicode input, but if the IME is disabled or not set as default, typing silently fails or falls back to the hardware keyboard with broken Unicode handling.

Currently the only way to manage this is raw adb shell ime commands via android_shell, which:

  • Requires the operator to know the exact IME ComponentName strings
  • Has no guardrails or validation
  • Is not documented as a required pre-flight step in any skill
  • Silently breaks typing flows when ADBKeyboard gets unset (OEM updates, reboots, package manager clearing defaults)

Proposed tool: android_ime

Actions

  • list — List all installed IMEs with enabled/disabled status (ime list -s + ime list -s -a)
  • state — Return the current default input method (settings get secure default_input_method) + whether ADBKeyboard is enabled and set as default
  • enable — Enable an IME by ComponentName (ime enable <cn>). Shortcuts: adbkeyboard auto-resolves to the full CN
  • disable — Disable an IME by ComponentName (ime disable <cn>)
  • set — Set the default IME (ime set <cn>). This is the most common operation — switching to ADBKeyboard before a typing session
  • ensureConvenience: checks if ADBKeyboard is the current default; if not, enables + sets it. Returns the previous default so it can be restored later. This should be the recommended pre-flight call

Key parameters

  • component (string, optional): Full ComponentName (e.g., com.android.adbkeyboard/.AdbIME) or a shortcut alias (adbkeyboard, gboard, swiftkey)
  • restore (boolean, optional): For set/ensure — if true, also save the previous default IME so a later restore can switch back

Shortcut aliases

To avoid requiring the operator to memorize ComponentNames, the tool should ship with a built-in alias map:

{
  "adbkeyboard": "com.android.adbkeyboard/.AdbIME",
  "gboard": "com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME",
  "samsung": "com.samsung.android.honeyboard/.HoneyboardInputMethodService"
}

Users can extend this with a config file or the tool can auto-discover installed IMEs and fuzzy-match.

Why this matters

  1. Pre-flight critical: Before any android_type call, the agent should verify ADBKeyboard is active. Without this tool, there is no clean way to do it.
  2. Unicode correctness: android_type uses ADBKeyboard for Unicode text injection. If the wrong IME is active, emoji, accented characters, and non-Latin scripts break silently.
  3. Session hygiene: After automation, the operator often wants to restore the original keyboard so the phone is usable normally again. The ensure/restore pattern handles this.
  4. Discovery: The list action makes it obvious what keyboards are available without shelling out to adb shell ime list -s -a.

Suggested skill update

The android-device-basics skill should be updated to include an IME pre-flight section:

Before any android_type call, call android_ime action=ensure component=adbkeyboard. This is especially important after device reboots, app updates, or package manager operations that may reset IME defaults.

Priority

High. This is a silent failure mode that breaks one of the most fundamental primitives (android_type) with no diagnostic feedback. Every flow that types text is affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions