fuchsia.ui.activity

PROTOCOLS

Provider

Defined in fuchsia.ui.activity/provider.fidl

The Provider protocol offers a subscription interface through which clients can watch for changes in the system's activity state.

WatchState

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.

Request

NameType
listener Listener

Listener

Defined in fuchsia.ui.activity/provider.fidl

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.

OnStateChanged

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.

Request

NameType
state State
transition_time zx/time

Response

NameType

Tracker

Defined in fuchsia.ui.activity/tracker.fidl

The Tracker protocol collects evidence of user activity and uses this evidence to set the system's activity state.

ReportDiscreteActivity

Reports a discrete activity such as a keystroke. |event_time| is in nanoseconds in the CLOCK_MONOTONIC time base.

Request

NameType
activity DiscreteActivity
event_time zx/time

Response

NameType

StartOngoingActivity

Reports the start of an ongoing activity such as media playback. |activity_id| is a unique identifier which is expected to be later passed to EndOngoingActivity. |start_time| is in nanoseconds in the CLOCK_MONOTONIC time base.

Request

NameType
activity_id OngoingActivityId
activity OngoingActivity
start_time zx/time

Response

NameType

EndOngoingActivity

Reports the end of an ongoing activity such as media playback. |activity_id| is the nonce which was passed into StartOngoingActivity. |end_time| is in nanoseconds in the CLOCK_MONOTONIC time base.

Request

NameType
activity_id OngoingActivityId
end_time zx/time

Response

NameType

STRUCTS

ENUMS

State

Type: uint32

Defined in fuchsia.ui.activity/state.fidl

State is an enumeration of the activity states the system may be in.

NameValueDescription
UNKNOWN 0
IDLE 1

IDLE implies that the system is not currently being used by a user. In other words, the system is not ACTIVE.

ACTIVE 2

ACTIVE implies that a user has recently or is currently using the system.

Activity can be signalled by discrete interactions (cursor, keyboard, touchscreen), or by ongoing activities (video playback).

The specific meaning of "recently" is an implementation detail of the Activity Service, but a typical value is 15 minutes.

TABLES

GenericActivity

Defined in fuchsia.ui.activity/activity.fidl

GenericActivity is a user or system activity of unspecified type, e.g. a keyboard press or an alarm going off.

OrdinalNameTypeDescription
1 label string

Brief human-readable label for the activity, for logging/debugging. e.g. "cursor", "key", "video"

XUNIONS

DiscreteActivity

Defined in fuchsia.ui.activity/activity.fidl

DiscreteActivity is an activity which occurs at a point in time.

NameTypeDescription
generic GenericActivity

Activities that require no special handling.

OngoingActivity

Defined in fuchsia.ui.activity/activity.fidl

OngoingActivity is an activity which has a definite start and end time.

NameTypeDescription
generic GenericActivity

Activities that require no special handling.

TYPE ALIASES

NameValueDescription
OngoingActivityId uint32