blob: 60f27e9b0953d17070acae99a3811607f8b43639 [file] [log] [blame]
// 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
closed 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.
strict 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.
closed 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.
strict OnStateChanged(struct {
state State;
transition_time zx.Time;
}) -> ();
};