Skip to main content

Module session

Module session 

Source
Expand description

The agent session: an attached agent behind the mirror’s backend traits (task 5.3; design D5 and D7).

  • Session::backend hands a mirror::Backend over: a tree source over the agent’s snapshot requests, 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§

ControllerLink
A connected controller and the runtime its calls run on.
Paths
The paths chosen for a target.
ReadOptions
How the session reads the tree.
ReadStats
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.
SessionOptions
How the session works.
Status
What a session reports about its target.

Enums§

ControllerChoice
Whether to use the emulator’s controller.
Path
Where a kind of input or output goes.
SessionError
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, at scale physical pixels per point.
encode_jpeg
frame as a JPEG: turned by request.rotation, then scaled to exactly request.width by request.height, at request.quality.
frame_meta
The metadata of frame, the seq-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 snapshot sends 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 pixels of width by height scaled to to_width by to_height: each output pixel averages the input area it covers, or repeats the nearest one when enlarging.
rotate_rgb
RGB888 pixels of width by height turned clockwise by rotation; returns the pixels and their new size.
scale_from_density
Physical pixels per device point from wm density output: the override density when one is set, else the physical one, over 160.
select_paths
Selects the paths for the target serial, an emulator when emulator says so: the controller as choice says when it connects within options’ 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 None for 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 from to to over duration, each with its offset from the start: contact 0 down at the start, a move every step along the line, and up at the end, as the agent’s swipe does. With a rest, 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 with rest_ms: a touch that repeats the last position changes nothing the platform sees.