test(config_flow,media_player,remote): digit-delay/send-enter options (store + window/error validation), IME-first text entry with ADB fallback tier, icon column parse/prefill/store (P5-2)

This commit is contained in:
James Mackay committed 2026-10-09 06:00:17 +01:00
1 parent 3d026ae60e
commit a3b397920e
7 files changed
+320 -18

No files matched your search

@@ -495,6 +495,41 @@ class ShieldConnectionManager:
snapshot[name] = {"age": round(time.monotonic() - stamp, 3), "value": value}
return snapshot
async def send_text_ime(self, text: str) -> bool:
"""Text entry via the protocol client's send_text (P5-2).
The Shield may swallow the text when its on-screen virtual keyboard
is up (RESEARCH_IDEAS §2 availability gate) — the call reports the
send outcome; callers fall back to the ADB input-text path only
when the protocol transport is down or the send failed.
"""
if self._protocol is None:
return False
try:
self._protocol.send_text(text)
return True
except Exception as err:
_LOGGER.debug("protocol send_text failed: %s", err)
return False
async def send_adb_input_text(self, text: str) -> bool:
"""ADB fallback for text entry: `input text` (P5-2).
Used only when the protocol send_text path is unavailable/failed.
Shell-quoted (shlex) so single quotes and spaces survive.
"""
import shlex
poller = self._poller
if poller is None or not self.connected:
return False
try:
result = await poller.shell(f"input text {shlex.quote(text)}")
return result is not None
except Exception as err:
_LOGGER.debug("adb input text failed: %s", err)
return False
def app_label(self, package: str | None) -> str | None:
"""Cached manifest label for a package (P5-1), or None.