Expand description
The agent session: an attached agent behind the mirror’s backend traits (task 5.3; design D5 and D7).
Session::backendhands amirror::Backendover: a tree source over the agent’ssnapshotrequests, an event stream carrying the agent’s events and, on an emulator with its controller, the controller’s frames with status-bar-free hashes, an input sink over the agent’s input and text requests or the controller’s touches, and the system clock.- The agent’s snapshot passes through as it came: the window metadata it carries (whether each window sends change events, its owner, whether it is modal) and the scroll semantics are what the mirror reads.
- Input the agent did not inject, the controller’s touches, leaves the agent’s cache of Compose windows stale, so the next read waits until the input is a quiet window old and empties that cache first.
- Without a frame source, the mirror’s settle probes a few nodes’ bounds
through the agent’s
bounds(task 10.11), when the agent advertises it, and reads windows whose nodes moved with their cache evicted. - The end of the connection or three seconds of silence (the protocol
crate’s liveness) reach the mirror as
Disconnected.
Structs§
- Controller
Link - A connected controller and the runtime its calls run on.
- Paths
- The paths chosen for a target.
- Read
Options - How the session reads the tree.
- Read
Stats - What the last tree read returned.
- Selection
- The controller to use, if any, and the paths that follow.
- Session
- An attached agent serving a mirror. Clones share it.
- Session
Options - How the session works.
- Status
- What a session reports about its target.
Enums§
- Controller
Choice - Whether to use the emulator’s controller.
- Path
- Where a kind of input or output goes.
- Session
Error - Why a session could not start.
Constants§
- BACKEND
- The backend name the mirror reports for reads from the agent.
- INPUT_
QUIET - How long after input the agent did not inject a read waits, as the agent’s idle wait counts a quiet window from its own input (design D8’s 200 ms).
Functions§
- agent_
call - The agent request for
input, atscalephysical pixels per point. - encode_
jpeg frameas a JPEG: turned byrequest.rotation, then scaled to exactlyrequest.widthbyrequest.height, atrequest.quality.- frame_
meta - The metadata of
frame, theseq-th of the stream: its hash leaves the status bar out; its capture time is its arrival minus the lag the emulator’s timestamp shows, at most a second. - has_
event_ less_ window - Whether a window of
snapshotsends no change events by the agent’s account, as a window of Jetpack Compose content does: its changes are seen only by reading it again. - input_
ack - The acknowledgement an agent reply carries.
- resize_
rgb - RGB888
pixelsofwidthbyheightscaled toto_widthbyto_height: each output pixel averages the input area it covers, or repeats the nearest one when enlarging. - rotate_
rgb - RGB888
pixelsofwidthbyheightturned clockwise byrotation; returns the pixels and their new size. - scale_
from_ density - Physical pixels per device point from
wm densityoutput: the override density when one is set, else the physical one, over 160. - select_
paths - Selects the paths for the target
serial, an emulator whenemulatorsays so: the controller aschoicesays when it connects withinoptions’ deadlines, else the agent, with the warning on an emulator whose controller was wanted. - snapshot_
params - The parameters of a read for
reason: reads the target’s own changes trigger do not wait for idle, reads after an attach, an action or a resync take the settle bound. - stream_
item - The stream item for a host session event, or
Nonefor events the mirror has no use for: an oversized frame that answered no request, and a failed resync, which the session retries on its next read (the gap that caused it has already reached the mirror). - swipe_
touches - The controller touches of a swipe from
fromtotooverduration, each with its offset from the start: contact 0 down at the start, a move everystepalong the line, and up at the end, as the agent’s swipe does. With arest, the contact rests at the end that long, then moves one pixel on along the line and goes up there, as the agent’s swipe does withrest_ms: a touch that repeats the last position changes nothing the platform sees.