blob: a4d2daf6132a9c5015fb6eace0e88ef36ed198a0 [file] [log] [blame] [view]
<link rel="stylesheet" href="../style.css" />
[TOC]
# fuchsia.ui.activity
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 7</span></div>
## **PROTOCOLS**
## Listener {#Listener}
*Defined in [fuchsia.ui.activity/provider.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/provider.fidl;l=24)*
<p>The Listener protocol subscribes to changes in the system's activity
state. Clients which care about the activity state of the system are
expected to implement this protocol and subscribe via Provider.WatchState.</p>
### OnStateChanged {#Listener.OnStateChanged}
<p>Callback that is invoked whenever the system state changes.
The Listener is expected to acknowledge each call explicitly and will
not receive new state until this acknowledgement is done.</p>
#### Request {#Listener.OnStateChanged_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>state</code></td>
<td>
<code><a class='link' href='#State'>State</a></code>
</td>
</tr>
<tr>
<td><code>transition_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code>
</td>
</tr>
</table>
#### Response {#Listener.OnStateChanged_Response}
&lt;EMPTY&gt;
## Provider {#Provider}
*Defined in [fuchsia.ui.activity/provider.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/provider.fidl;l=11)*
<p>The Provider protocol offers a subscription interface through
which clients can watch for changes in the system's activity state.</p>
### WatchState {#Provider.WatchState}
<p>Subscribe to changes in the system's state.
The server will always invoke listener.OnStateChanged at least once with
the initial state, and after that invoke listener.OnStateChanged
whenever the system's state changes.</p>
#### Request {#Provider.WatchState_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>listener</code></td>
<td>
<code><a class='link' href='#Listener'>Listener</a></code>
</td>
</tr>
</table>
## Tracker {#Tracker}
*Defined in [fuchsia.ui.activity/tracker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/tracker.fidl;l=13)*
<p>The Tracker protocol collects evidence of user activity and uses this
evidence to set the system's activity state.</p>
### EndOngoingActivity {#Tracker.EndOngoingActivity}
<p>Reports the end of an ongoing activity such as media playback.
<code>activity_id</code> is the nonce which was passed into StartOngoingActivity.
<code>end_time</code> is in nanoseconds in the <code>CLOCK_MONOTONIC</code> time base.</p>
#### Request {#Tracker.EndOngoingActivity_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>activity_id</code></td>
<td>
<code><a class='link' href='#OngoingActivityId'>OngoingActivityId</a></code>
</td>
</tr>
<tr>
<td><code>end_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code>
</td>
</tr>
</table>
#### Response {#Tracker.EndOngoingActivity_Response}
&lt;EMPTY&gt;
### ReportDiscreteActivity {#Tracker.ReportDiscreteActivity}
<p>Reports a discrete activity such as a keystroke.
<code>event_time</code> is in nanoseconds in the <code>CLOCK_MONOTONIC</code> time base.</p>
#### Request {#Tracker.ReportDiscreteActivity_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>activity</code></td>
<td>
<code><a class='link' href='#DiscreteActivity'>DiscreteActivity</a></code>
</td>
</tr>
<tr>
<td><code>event_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code>
</td>
</tr>
</table>
#### Response {#Tracker.ReportDiscreteActivity_Response}
&lt;EMPTY&gt;
### StartOngoingActivity {#Tracker.StartOngoingActivity}
<p>Reports the start of an ongoing activity such as media playback.
<code>activity_id</code> is a unique identifier which is expected to be later
passed to EndOngoingActivity.
<code>start_time</code> is in nanoseconds in the <code>CLOCK_MONOTONIC</code> time base.</p>
#### Request {#Tracker.StartOngoingActivity_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>activity_id</code></td>
<td>
<code><a class='link' href='#OngoingActivityId'>OngoingActivityId</a></code>
</td>
</tr>
<tr>
<td><code>activity</code></td>
<td>
<code><a class='link' href='#OngoingActivity'>OngoingActivity</a></code>
</td>
</tr>
<tr>
<td><code>start_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code>
</td>
</tr>
</table>
#### Response {#Tracker.StartOngoingActivity_Response}
&lt;EMPTY&gt;
## **ENUMS**
### State [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#State data-text="State"}
Type: <code>uint32</code>
*Defined in [fuchsia.ui.activity/state.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/state.fidl;l=7)*
<p>State is an enumeration of the activity states the system may be in.</p>
<table>
<tr><th>Name</th><th>Value</th><th>Description</th></tr>
<tr id="State.UNKNOWN">
<td><h3 id="State.UNKNOWN" class="add-link hide-from-toc">UNKNOWN</h3></td>
<td><code>0</code></td>
<td></td>
</tr>
<tr id="State.IDLE">
<td><h3 id="State.IDLE" class="add-link hide-from-toc">IDLE</h3></td>
<td><code>1</code></td>
<td><p>IDLE implies that the system is not currently being used by a user.
In other words, the system is not ACTIVE.</p>
</td>
</tr>
<tr id="State.ACTIVE">
<td><h3 id="State.ACTIVE" class="add-link hide-from-toc">ACTIVE</h3></td>
<td><code>2</code></td>
<td><p>ACTIVE implies that a user has recently or is currently using the
system.</p>
<p>Activity can be signalled by discrete interactions (cursor, keyboard,
touchscreen), or by ongoing activities (video playback).</p>
<p>The specific meaning of &quot;recently&quot; is an implementation
detail of the Activity Service, but a typical value is 15 minutes.</p>
</td>
</tr>
</table>
## **TABLES**
### GenericActivity {#GenericActivity data-text="GenericActivity"}
*Defined in [fuchsia.ui.activity/activity.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/activity.fidl;l=20)*
<p>GenericActivity is a user or system activity of unspecified type, e.g.
a keyboard press or an alarm going off.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="GenericActivity.label">
<td><h3 id="GenericActivity.label" class="add-link hide-from-toc">1</h3></td>
<td><code>label</code></td>
<td>
<code>string</code>
</td>
<td><p>Brief human-readable label for the activity, for logging/debugging.
e.g. &quot;cursor&quot;, &quot;key&quot;, &quot;video&quot;</p>
</td>
</tr>
</table>
## **UNIONS**
### DiscreteActivity [flexible](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#DiscreteActivity data-text="DiscreteActivity"}
*Defined in [fuchsia.ui.activity/activity.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/activity.fidl;l=7)*
<p>DiscreteActivity is an activity which occurs at a point in time.</p>
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="DiscreteActivity.generic">
<td><h3 id="DiscreteActivity.generic" class="add-link hide-from-toc">1</h3></td>
<td><code>generic</code></td>
<td>
<code><a class='link' href='#GenericActivity'>GenericActivity</a></code>
</td>
<td><p>Activities that require no special handling.</p>
</td>
</tr>
</table>
### OngoingActivity [flexible](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#OngoingActivity data-text="OngoingActivity"}
*Defined in [fuchsia.ui.activity/activity.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/activity.fidl;l=13)*
<p>OngoingActivity is an activity which has a definite start and end time.</p>
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="OngoingActivity.generic">
<td><h3 id="OngoingActivity.generic" class="add-link hide-from-toc">1</h3></td>
<td><code>generic</code></td>
<td>
<code><a class='link' href='#GenericActivity'>GenericActivity</a></code>
</td>
<td><p>Activities that require no special handling.</p>
</td>
</tr>
</table>
## **TYPE ALIASES**
<table>
<tr><th>Name</th><th>Value</th><th>Description</th></tr>
<tr id="OngoingActivityId">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.activity/tracker.fidl;l=8">OngoingActivityId</a></td>
<td>
<code>uint32</code></td>
<td></td>
</tr>
</table>