• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 The Chromium OS 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
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8
9package power_manager;
10
11// Power management policy sent from Chrome to powerd.
12//
13// New settings take effect immediately.  For example, if |idle_ms| is
14// currently set to 15 minutes, the user has been inactive for 12 minutes,
15// and a message setting |idle_ms| to 10 minutes is received,
16// |idle_action| will be performed immediately.  If |lid_closed_action| is
17// DO_NOTHING, the lid is closed, and |lid_closed_action| is then set to
18// SHUT_DOWN, the system will shut down immediately.
19//
20// In the case of an unset field, powerd will restore a default value (as
21// opposed to continuing to use a value set by a previous message).  An
22// empty message will restore all settings to their defaults.
23//
24// Next ID to use: 19
25message PowerManagementPolicy {
26
27  enum Action {
28    // Suspends the system.  Chrome may lock the screen first depending on
29    // its "Require password to wake from sleep" setting and the type of
30    // user that is logged in.
31    SUSPEND = 0;
32
33    // Ends the current user's session.  Does nothing at the login screen.
34    STOP_SESSION = 1;
35
36    // Shuts the system down.
37    SHUT_DOWN = 2;
38
39    // Does nothing.
40    DO_NOTHING = 3;
41
42    // Next value to use: 4
43  }
44
45  message Delays {
46    // Delay after which |idle_action| is performed, in milliseconds.  The
47    // inactivity timeout is reset in response to things like user activity
48    // (including the lid being opened, the power source changing, an
49    // external display being connected, etc.), resuming from suspend, or
50    // the session state changing.
51    optional int64 idle_ms = 1;
52
53    // Delay after which the screen will be turned off, in milliseconds.  0
54    // disables turning the screen off.  Capped to be less than or equal to
55    // |idle_ms|.  The same events that cause the inactivity timeout to be
56    // reset cause the screen to be turned back on.
57    optional int64 screen_off_ms = 2;
58
59    // Delay after which the screen will be dimmed, in milliseconds.  0
60    // disables dimming.  Capped to be less than or equal to
61    // |screen_off_ms| if |screen_off_ms| is set or less than or equal to
62    // |idle_ms| otherwise.  The same events that cause the inactivity
63    // timeout to be reset cause the screen to be undimmed.
64    optional int64 screen_dim_ms = 3;
65
66    // Delay after which the screen will be locked, in milliseconds.  0
67    // disables locking.  Capped to be less than |idle_ms|.  Note that
68    // lock-on-suspend is implemented within Chrome; this delay is provided
69    // for cases where the screen must be locked a significant amount of
70    // time before the device is suspended.
71    optional int64 screen_lock_ms = 4;
72
73    // Delay after which an IdleActionImminent signal will be emitted, in
74    // milliseconds. If the inactivity timeout is then reset before the idle
75    // action is performed, an IdleActionDeferred signal will be emitted. If the
76    // idle delay is changed after IdleActionImminent has been emitted, an
77    // additional signal will be emitted. 0 disables the signal. Capped to be
78    // less than or equal to |idle_ms|.
79    optional int64 idle_warning_ms = 5;
80
81    // Next ID to use: 6
82  }
83
84  // Action to perform when |idle_ms| (see Delays) is reached without any
85  // user activity while the system is on AC power.
86  optional Action ac_idle_action = 1;
87
88  // Idle action when the system is on battery power.
89  optional Action battery_idle_action = 11;
90
91  // Action to perform when the lid is closed.
92  optional Action lid_closed_action = 2;
93
94  // Delays used while the system is on AC power.
95  optional Delays ac_delays = 3;
96
97  // Delays used while the system is on battery power.
98  optional Delays battery_delays = 4;
99
100  // True if at least one full-brightness, dimmed-but-on, or system-level wake
101  // lock is currently held.
102  optional bool screen_wake_lock = 16;
103  optional bool dim_wake_lock = 17;
104  optional bool system_wake_lock = 18;
105
106  // Should audio activity be honored?  If true, audio activity will
107  // prevent |idle_action| from being performed, although the screen
108  // dimming, off, and lock delays will still be in effect.  Once the audio
109  // has stopped, |idle_action| will be performed if no user or audio
110  // activity is observed for |idle_ms|.
111  optional bool use_audio_activity = 5;
112
113  // Should video activity be honored?  If true, video activity will
114  // prevent |idle_action| from being performed and the screen from being
115  // automatically dimmed, turned off, or locked.  All these timeouts will
116  // be reset once the video has stopped.
117  optional bool use_video_activity = 6;
118
119  // Backlight brightness in the range [0.0, 100.0] to use when on AC or battery
120  // power. When a message containing these fields is received, the backlight is
121  // set to the requested brightness. The updated brightness persists until the
122  // user manually changes it or a new policy containing the currently-relevant
123  // field is received.
124  optional double ac_brightness_percent = 13;
125  optional double battery_brightness_percent = 14;
126
127  // Factor by which |screen_dim_ms| will be scaled while the device is in
128  // presentation mode.  Other delays' distances from |screen_dim_ms| are
129  // preserved after scaling.  A value of 1.0 (or less) leaves delays
130  // unchanged. If the conditions used for both this field and
131  // |user_activity_screen_dim_delay_factor| are true, this field takes
132  // precedence.
133  optional double presentation_screen_dim_delay_factor = 10;
134
135  // Factor by which |screen_dim_ms| will be scaled if user activity is
136  // observed while the screen is dimmed or soon after it is turned off.
137  // Other delays' distances from |screen_dim_ms| are preserved after
138  // scaling.  The delays will return to their original values at the end
139  // of the current user session.  A value of 1.0 (or less) or an unset
140  // |screen_dim_ms| delay leaves delays unchanged.
141  optional double user_activity_screen_dim_delay_factor = 9;
142
143  // If true, instructs the power manager not to perform any
144  // delay-triggered actions while in a user session until user activity
145  // has been observed. After activity is seen, the inactivity timeout
146  // starts. The actions are deferred again after a new session starts.
147  // Note that this has no immediate effect if activity has already been
148  // seen within an already-started session (activity that took place
149  // before the policy change is honored) and also that it has no effect at
150  // the login screen.
151  optional bool wait_for_initial_user_activity = 12;
152
153  // If true, force the panel backlight to a non-zero brightness level in
154  // response to user activity if it was previously manually set to zero by the
155  // user.
156  optional bool force_nonzero_brightness_for_user_activity = 15;
157
158  // Human-readable description of the factors contributing to this policy.
159  // Logged by the power manager to aid in debugging.
160  optional string reason = 8;
161}
162
163// Message included in IdleActionImminent signals.
164message IdleActionImminent {
165  // Time until the idle action will be performed as given by
166  // base::TimeDelta::ToInternalValue().
167  optional int64 time_until_idle_action = 1;
168}
169