| // Copyright 2021 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.power.profile; |
| |
| /// System power profiles that may be returned by [Watcher.Watch]. |
| type Profile = strict enum { |
| /// There is no active work in the system. On a system that supports it, the device may be put |
| /// into a lower-power or suspended state at any time. |
| IDLE = 1; |
| |
| /// Some background activity is occurring that should prevent the system from dropping into a |
| /// non-running or suspended state (example: downloading an OTA, performing a backup, or |
| /// CPU-based hotword monitoring). |
| BACKGROUND_ACTIVE = 2; |
| |
| /// The device is providing some user-visible experience such as running an app in the |
| /// foreground or streaming audio, or has recently received interaction from a user. |
| USER_ACTIVE = 3; |
| }; |
| |
| /// Protocol for observing changes to the system power profile. |
| @discoverable |
| protocol Watcher { |
| /// Watches for changes to the system power profile. |
| /// |
| /// On a given connection, the first call will return immediately with the current system power |
| /// profile, while subsequent calls will only return a new `profile` as the system power profile |
| /// changes. This follows the |
| /// [hanging get](https://fuchsia.dev/fuchsia-src/concepts/api/fidl#hanging-get) pattern. Any |
| /// errors are considered fatal and will result in the channel being closed. |
| Watch() -> (struct { |
| profile Profile; |
| }); |
| }; |