[Feature]: Android: send message with a hardware keyboard (Enter or Ctrl+Enter)#21685

opened22d agobyPPedroLLou

Area

apps/mobile

Problem

On an Android tablet with a physical keyboard, Enter inserts a newline in the composer and there is no keyboard shortcut to send. Combined with the send button being hidden while the composer is expanded on tablets with a taskbar (#21684), sending requires leaving the keyboard to tap the screen twice.

Proposal

When a hardware keyboard is attached, support a send shortcut: Enter to send and Shift+Enter for a newline (matching desktop's sendShortcut: enter), or at least Ctrl+Enter. Ideally reuse the desktop "send shortcut" setting.

Environment

Lenovo Idea Tab Plus (system version 17.5.10.375), physical keyboard, T3 Android app 2.0.0.

Note

Grok responding on behalf of Julius.

Thanks for the report. The mobile app already has a Return key "Send" setting, but on Android it currently does nothing for hardware keyboards. Open PR #15030 makes the Android composer honor that setting, so a hardware Return sends the same way it does on iPad (with Ctrl in place of Command) while the on-screen keyboard still inserts newlines. That change has not been tested on a real Android tablet yet.

[Opus 5.5][Claude Code] on behalf of shivam.

Julius took over #15030, which covers this, so I've stopped work on #21687. Here's what our device testing found, in case it helps #15030's physical-keyboard QA:

  • Composing guard. #15030 skips Return when getComposingSpanStart(text) >= 0. On a POCO F4 (Android 14) with a hardware keyboard, the on-screen keyboard keeps a composing region over the last word even while you type on the hardware keyboard. With that guard in place, Ctrl+Return did nothing. #21687 dropped the guard (5ae895c49e); after that, Return and Ctrl+Return sent as expected.
  • IME Return without the soft-keyboard flag. Some IMEs send Return with device ID 0 and no FLAG_SOFT_KEYBOARD. Device ID 0 maps to the built-in keyboard, which on these phones is the fingerprint sensor. #21687 sends only when the event's device is non-virtual and KEYBOARD_TYPE_ALPHABETIC. #15030's sendKeyEvent wrapper handles the same case from the IME side.
  • Device evidence (POCO F4 and POCO M3 Pro, before and after recordings) is in the #21687 body.
  • Unverified: Return with a CJK IME on a hardware keyboard.
Synced from GitHub

Tested #21687 (head deb79c3a68) as a local release build on a OnePlus Pad 3 (OPD2415, OxygenOS 16 / Android 16, 16.0.10.600), Return key setting "Send message":

  • OnePlus Pad 3 keyboard: Return sends, Shift+Return inserts a new line.
  • Samers foldable Bluetooth keyboard with trackpad: Return sends, Shift+Return inserts a new line, Ctrl+Return sends.
  • On-screen keyboard: Return still inserts a new line.

No double sends. The keyboard app's floating toolbar stays up while typing on the hardware keyboard, and it didn't interfere.