You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type skips input-method restoration after an exception or interruption #429
If Type raises an exception or is interrupted after keyboard detection,
Android can be left using ADB Keyboard. _handle_type only calls restore_keyboard() after clearing, typing and all delays have finished.
Reproduction
Tested on Windows with Python 3.11.9 at 86f55382982fb054e8fc98ca80609dff8a2cdc3c.
Run this from the repository with its Python dependencies installed. It uses the
real handler, device factory and ADB input functions, with subprocess responses
and delays mocked. The text triggers a UTF-8 encoding error inside type_text().
No phone, ADB executable or model API is needed.
The original code prints success: False restore commands: 0. It should still
report the input error, but also attempt to restore the saved input method.
With the proposed fix it prints success: False restore commands: 1.
Cancellation has the same problem. The regression tests also cover cancellation
followed by an ordinary exception during restoration, so cleanup doesn't hide the interrupt.
This covers cleanup after detection returns. Failures during detection's warm-up
and ADB return-code handling need separate changes. Restoration on a physical
device hasn't been tested. #421 addresses a different cause: stderr becoming part
of the saved input-method identifier.
Activity