Skip to content

fix: prevent stderr from corrupting IME identifier in keyboard detection - #421

Open
Ricardo-M-L wants to merge 1 commit into
zai-org:mainfrom
Ricardo-M-L:fix/ime-detection-stderr-corruption
Open

fix: prevent stderr from corrupting IME identifier in keyboard detection#421
Ricardo-M-L wants to merge 1 commit into
zai-org:mainfrom
Ricardo-M-L:fix/ime-detection-stderr-corruption

Conversation

@Ricardo-M-L

Copy link
Copy Markdown

This PR addresses: prevent stderr from corrupting IME identifier in keyboard detection

`detect_and_set_adb_keyboard()` concatenates stdout and stderr when
reading the current IME. If the adb/hdc command fails (e.g. permission
denied), the error message pollutes the IME string, causing
`restore_keyboard()` to receive an invalid identifier and silently
fail to restore the original keyboard.

Use only stdout when the command succeeds; fall back to empty string
on failure.

Affects both ADB (phone_agent/adb/input.py) and HarmonyOS
(phone_agent/hdc/input.py) code paths.
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