| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.ui.activity; |
| |
| using zx; |
| |
| /// The Provider protocol offers a subscription interface through |
| /// which clients can watch for changes in the system's activity state. |
| @discoverable |
| protocol Provider { |
| /// 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. |
| WatchState(resource struct { |
| listener client_end:Listener; |
| }); |
| }; |
| |
| /// 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. |
| protocol Listener { |
| /// 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. |
| OnStateChanged(struct { |
| state State; |
| transition_time zx.time; |
| }) -> (); |
| }; |