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