idle_service.mojom 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module crosapi.mojom;
  5. import "mojo/public/mojom/base/time.mojom";
  6. // Information needed to deduce idle state. Seralized time are in microseconds.
  7. [Stable]
  8. struct IdleInfo {
  9. // For PowerPolicyController::GetMaxPolicyAutoScreenLockDelay().
  10. mojo_base.mojom.TimeDelta auto_lock_delay;
  11. // For UserActivityDetector::last_activity_time().
  12. mojo_base.mojom.TimeTicks last_activity_time;
  13. bool is_locked;
  14. };
  15. // Interface for idle info observers. Implemented by lacros-chrome. Used by
  16. // ash-chrome to send idle info updates.
  17. [Stable, Uuid="3bd0e430-2afa-4a3b-b0c7-b8ef617322d1"]
  18. interface IdleInfoObserver {
  19. // Called when an observed idle info changes, subject to throttling to avoid
  20. // flodding.
  21. OnIdleInfoChanged@0(IdleInfo idle_info);
  22. };
  23. // Interface that allows clients to receive info and configs related to the
  24. // idle state of the system. Implemented by ash-chrome.
  25. [Stable, Uuid="f426b526-38ba-48cc-be0f-e0a26e390122"]
  26. interface IdleService {
  27. // Adds an observer for changes in idle info. The observer is fired
  28. // immediately with the current value. Multiple observers may be registered.
  29. AddIdleInfoObserver@0(pending_remote<IdleInfoObserver> observer);
  30. };