fix: retry playback intents over the command path that originally served them (ADB broadcasts annotate the intent, self-heal retry goes back over ADB)

This commit is contained in:
James Mackay committed 2026-10-08 07:39:53 +01:00
1 parent a2f1948a88
commit 359b96ef9c
2 files changed
+29 -4

No files matched your search

@@ -13,10 +13,15 @@ class PlaybackIntent:
Attributes:
target_state: The MediaPlayerState we expect after the command.
command: The service/command name (for retries and logging).
command: The command/service name (for retries and logging).
created_at: Monotonic timestamp when the intent was created.
prior_state: The source state before the intent (for detecting external overrides).
retry_count: Number of retries attempted so far.
via_adb: True when the command was successfully served by the ADB
keyevent path — the retry must then go over ADB too, not back to
the remote that did not serve it.
adb_command: The ADB keycode command name matching the intent
(play/pause/stop/next/previous); set together with via_adb.
"""
target_state: str # MediaPlayerState value (e.g. "playing", "paused")
@@ -24,6 +29,8 @@ class PlaybackIntent:
created_at: float
prior_state: str | None = None
retry_count: int = 0
via_adb: bool = False
adb_command: str | None = None
@classmethod
def create(cls, target_state: str, command: str, prior_state: str | None = None) -> "PlaybackIntent":
@@ -45,4 +52,6 @@ class PlaybackIntent:
"command": self.command,
"retries": self.retry_count,
"age_s": self.age_seconds,
"via_adb": self.via_adb,
"adb_command": self.adb_command,
}