| // 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; |
| |
| using OngoingActivityId = uint32; |
| |
| /// The Tracker protocol collects evidence of user activity and uses this |
| /// evidence to set the system's activity state. |
| [Discoverable] |
| protocol Tracker { |
| /// Reports a discrete activity such as a keystroke. |
| /// |event_time| is in nanoseconds in the `CLOCK_MONOTONIC` time base. |
| ReportDiscreteActivity(DiscreteActivity activity, zx.time event_time); |
| |
| /// Reports the start of an ongoing activity such as media playback. |
| /// Returns a unique |activity_id| which is expected to be later passed |
| /// to EndOngoingActivity. |
| /// |start_time| is in nanoseconds in the `CLOCK_MONOTONIC` time base. |
| StartOngoingActivity(OngoingActivity activity, zx.time start_time) |
| -> (OngoingActivityId activity_id); |
| |
| /// Reports the end of an ongoing activity such as media playback. |
| /// |activity_id| is the nonce which was returned by StartOngoingActivity. |
| /// |end_time| is in nanoseconds in the `CLOCK_MONOTONIC` time base. |
| EndOngoingActivity(OngoingActivityId activity_id, zx.time end_time); |
| }; |