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