• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18package com.android.server.power;
19
20option java_multiple_files = true;
21
22import "frameworks/base/core/proto/android/app/enums.proto";
23import "frameworks/base/core/proto/android/content/intent.proto";
24import "frameworks/base/core/proto/android/os/enums.proto";
25import "frameworks/base/core/proto/android/os/looper.proto";
26import "frameworks/base/core/proto/android/os/powermanager.proto";
27import "frameworks/base/core/proto/android/os/worksource.proto";
28import "frameworks/base/core/proto/android/providers/settings.proto";
29import "frameworks/base/core/proto/android/server/wirelesschargerdetector.proto";
30import "frameworks/base/core/proto/android/view/enums.proto";
31import "frameworks/base/core/proto/android/privacy.proto";
32
33message PowerManagerServiceDumpProto {
34    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
35
36    // A com.android.server.power.PowerManagerService.Constants object.
37    message ConstantsProto {
38        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
39
40        optional bool is_no_cached_wake_locks = 1;
41    }
42    message ActiveWakeLocksProto {
43        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
44
45        optional bool is_cpu = 1;
46        optional bool is_screen_bright = 2;
47        optional bool is_screen_dim = 3;
48        optional bool is_button_bright = 4;
49        optional bool is_proximity_screen_off = 5;
50        // only set if already awake
51        optional bool is_stay_awake = 6;
52        optional bool is_doze = 7;
53        optional bool is_draw = 8;
54    }
55    message UserActivityProto {
56        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
57
58        optional bool is_screen_bright = 1;
59        optional bool is_screen_dim = 2;
60        optional bool is_screen_dream = 3;
61    }
62    // A com.android.server.power.PowerManagerService.UidState object.
63    message UidStateProto {
64        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
65
66        optional int32 uid = 1;
67        optional string uid_string = 2;
68        optional bool is_active = 3;
69        optional int32 num_wake_locks = 4;
70        optional .android.app.ProcessStateEnum process_state = 5;
71    }
72
73    optional ConstantsProto constants = 1;
74    // A bitfield that indicates what parts of the power state have
75    // changed and need to be recalculated.
76    optional int32 dirty = 2;
77    // Indicates whether the device is awake or asleep or somewhere in between.
78    optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 3;
79    optional bool is_wakefulness_changing = 4;
80    // True if the device is plugged into a power source.
81    optional bool is_powered = 5;
82    // The current plug type
83    optional .android.os.BatteryPluggedStateEnum plug_type = 6;
84    // The current battery level percentage.
85    optional int32 battery_level = 7;
86    // The battery level percentage at the time the dream started.
87    optional int32 battery_level_when_dream_started = 8;
88    // The current dock state.
89    optional .android.content.IntentProto.DockState dock_state = 9;
90    // True if the device should stay on.
91    optional bool is_stay_on = 10;
92    // True if the proximity sensor reads a positive result.
93    optional bool is_proximity_positive = 11;
94    // True if boot completed occurred.  We keep the screen on until this happens.
95    optional bool is_boot_completed = 12;
96    // True if systemReady() has been called.
97    optional bool is_system_ready = 13;
98    // True if auto-suspend mode is enabled.
99    optional bool is_hal_auto_suspend_mode_enabled = 14;
100    // True if interactive mode is enabled.
101    optional bool is_hal_auto_interactive_mode_enabled = 15;
102    // Summarizes the state of all active wakelocks.
103    optional ActiveWakeLocksProto active_wake_locks = 16;
104    // Have we scheduled a message to check for long wake locks?  This is when
105    // we will check. (In milliseconds timestamp)
106    optional int64 notify_long_scheduled_ms = 17;
107    // Last time we checked for long wake locks. (In milliseconds timestamp)
108    optional int64 notify_long_dispatched_ms = 18;
109    // The time we decided to do next long check. (In milliseconds timestamp)
110    optional int64 notify_long_next_check_ms = 19;
111    // Summarizes the effect of the user activity timer.
112    optional UserActivityProto user_activity = 20;
113    // If true, instructs the display controller to wait for the proximity
114    // sensor to go negative before turning the screen on.
115    optional bool is_request_wait_for_negative_proximity = 21;
116    // True if MSG_SANDMAN has been scheduled.
117    optional bool is_sandman_scheduled = 22;
118    // True if the sandman has just been summoned for the first time since entering
119    // the dreaming or dozing state.  Indicates whether a new dream should begin.
120    optional bool is_sandman_summoned = 23;
121    // True if the battery level is currently considered low.
122    optional bool is_battery_level_low = 24;
123    // True if we are currently in light device idle mode.
124    optional bool is_light_device_idle_mode = 25;
125    // True if we are currently in device idle mode.
126    optional bool is_device_idle_mode = 26;
127    // Set of app ids that we will always respect the wake locks for.
128    repeated int32 device_idle_whitelist = 27;
129    // Set of app ids that are temporarily allowed to acquire wakelocks due to
130    // high-pri message
131    repeated int32 device_idle_temp_whitelist = 28;
132    // Timestamp of the last time the device was awoken.
133    optional int64 last_wake_time_ms = 29;
134    // Timestamp of the last time the device was put to sleep.
135    optional int64 last_sleep_time_ms = 30;
136    // Timestamp of the last call to user activity.
137    optional int64 last_user_activity_time_ms = 31;
138    optional int64 last_user_activity_time_no_change_lights_ms = 32;
139    // Timestamp of last interactive power hint.
140    optional int64 last_interactive_power_hint_time_ms = 33;
141    // Timestamp of the last screen brightness boost.
142    optional int64 last_screen_brightness_boost_time_ms = 34;
143    // True if screen brightness boost is in progress.
144    optional bool is_screen_brightness_boost_in_progress = 35;
145    // True if the display power state has been fully applied, which means the
146    // display is actually on or actually off or whatever was requested.
147    optional bool is_display_ready = 36;
148    // True if the wake lock suspend blocker has been acquired.
149    optional bool is_holding_wake_lock_suspend_blocker = 37;
150    // The suspend blocker used to keep the CPU alive when the display is on, the
151    // display is getting ready or there is user activity (in which case the
152    // display must be on).
153    optional bool is_holding_display_suspend_blocker = 38;
154    // Settings and configuration
155    optional PowerServiceSettingsAndConfigurationDumpProto settings_and_configuration = 39;
156    // Sleep timeout in ms. This can be -1.
157    optional sint32 sleep_timeout_ms = 40;
158    // Screen off timeout in ms
159    optional int32 screen_off_timeout_ms = 41;
160    // Screen dim duration in ms
161    optional int32 screen_dim_duration_ms = 42;
162    // We are currently in the middle of a batch change of uids.
163    optional bool are_uids_changing = 43;
164    // Some uids have actually changed while mUidsChanging was true.
165    optional bool are_uids_changed = 44;
166    // List of UIDs and their states
167    repeated UidStateProto uid_states = 45;
168    optional .android.os.LooperProto looper = 46;
169    // List of all wake locks acquired by applications.
170    repeated WakeLockProto wake_locks = 47;
171    // List of all suspend blockers.
172    repeated SuspendBlockerProto suspend_blockers = 48;
173    optional WirelessChargerDetectorProto wireless_charger_detector = 49;
174    optional BatterySaverStateMachineProto battery_saver_state_machine = 50;
175}
176
177// A com.android.server.power.PowerManagerService.SuspendBlockerImpl object.
178message SuspendBlockerProto {
179    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
180
181    optional string name = 1;
182    optional int32 reference_count = 2;
183}
184
185// A com.android.server.power.PowerManagerService.WakeLock object.
186message WakeLockProto {
187    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
188
189    message WakeLockFlagsProto {
190        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
191
192        // Turn the screen on when the wake lock is acquired.
193        optional bool is_acquire_causes_wakeup = 1;
194        // When this wake lock is released, poke the user activity timer
195        // so the screen stays on for a little longer.
196        optional bool is_on_after_release = 2;
197    }
198
199    optional .android.os.WakeLockLevelEnum lock_level = 1;
200    optional string tag = 2;
201    optional WakeLockFlagsProto flags = 3;
202    optional bool is_disabled = 4;
203    // Acquire time in ms
204    optional int64 acq_ms = 5;
205    optional bool is_notified_long = 6;
206    // Owner UID
207    optional int32 uid = 7;
208    // Owner PID
209    optional int32 pid = 8;
210    optional .android.os.WorkSourceProto work_source = 9;
211}
212
213message PowerServiceSettingsAndConfigurationDumpProto {
214    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
215
216    message StayOnWhilePluggedInProto {
217        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
218
219        optional bool is_stay_on_while_plugged_in_ac = 1;
220        optional bool is_stay_on_while_plugged_in_usb = 2;
221        optional bool is_stay_on_while_plugged_in_wireless = 3;
222    }
223    message ScreenBrightnessSettingLimitsProto {
224        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
225
226        optional int32 setting_minimum = 1;
227        optional int32 setting_maximum = 2;
228        optional int32 setting_default = 3;
229    }
230
231    // True to decouple auto-suspend mode from the display state.
232    optional bool is_decouple_hal_auto_suspend_mode_from_display_config = 1;
233    // True to decouple interactive mode from the display state.
234    optional bool is_decouple_hal_interactive_mode_from_display_config = 2;
235    // True if the device should wake up when plugged or unplugged.
236    optional bool is_wake_up_when_plugged_or_unplugged_config = 3;
237    // True if the device should wake up when plugged or unplugged in theater mode.
238    optional bool is_wake_up_when_plugged_or_unplugged_in_theater_mode_config = 4;
239    // True if theater mode is enabled
240    optional bool is_theater_mode_enabled = 5;
241    // True if the device should suspend when the screen is off due to proximity.
242    optional bool is_suspend_when_screen_off_due_to_proximity_config = 6;
243    // True if dreams are supported on this device.
244    optional bool are_dreams_supported_config = 7;
245    // Default value for dreams enabled
246    optional bool are_dreams_enabled_by_default_config = 8;
247    // Default value for dreams activate-on-sleep
248    optional bool are_dreams_activated_on_sleep_by_default_config = 9;
249    // Default value for dreams activate-on-dock
250    optional bool are_dreams_activated_on_dock_by_default_config = 10;
251    // True if dreams can run while not plugged in.
252    optional bool are_dreams_enabled_on_battery_config = 11;
253    // Minimum battery level to allow dreaming when powered.
254    // Use -1 to disable this safety feature.
255    optional sint32 dreams_battery_level_minimum_when_powered_config = 12;
256    // Minimum battery level to allow dreaming when not powered.
257    // Use -1 to disable this safety feature.
258    optional sint32 dreams_battery_level_minimum_when_not_powered_config = 13;
259    // If the battery level drops by this percentage and the user activity
260    // timeout has expired, then assume the device is receiving insufficient
261    // current to charge effectively and terminate the dream.  Use -1 to disable
262    // this safety feature.
263    optional sint32 dreams_battery_level_drain_cutoff_config = 14;
264    // True if dreams are enabled by the user.
265    optional bool are_dreams_enabled_setting = 15;
266    // True if dreams should be activated on sleep.
267    optional bool are_dreams_activate_on_sleep_setting = 16;
268    // True if dreams should be activated on dock.
269    optional bool are_dreams_activate_on_dock_setting = 17;
270    // True if doze should not be started until after the screen off transition.
271    optional bool is_doze_after_screen_off_config = 18;
272    // The minimum screen off timeout, in milliseconds.
273    optional int32 minimum_screen_off_timeout_config_ms = 19;
274    // The screen dim duration, in milliseconds.
275    optional int32 maximum_screen_dim_duration_config_ms = 20;
276    // The maximum screen dim time expressed as a ratio relative to the screen off timeout.
277    optional float maximum_screen_dim_ratio_config = 21;
278    // The screen off timeout setting value in milliseconds.
279    optional int32 screen_off_timeout_setting_ms = 22;
280    // The sleep timeout setting value in milliseconds. Default value is -1.
281    optional sint32 sleep_timeout_setting_ms = 23;
282    // The maximum allowable screen off timeout according to the device administration policy.
283    optional int32 maximum_screen_off_timeout_from_device_admin_ms = 24;
284    optional bool is_maximum_screen_off_timeout_from_device_admin_enforced_locked = 25;
285    // The stay on while plugged in setting.
286    // A set of battery conditions under which to make the screen stay on.
287    optional StayOnWhilePluggedInProto stay_on_while_plugged_in = 26;
288    // The screen brightness mode.
289    optional .android.providers.settings.SettingsProto.ScreenBrightnessMode screen_brightness_mode_setting = 27;
290    // The screen brightness setting override from the window manager
291    // to allow the current foreground activity to override the brightness.
292    // Use -1 to disable.
293    optional sint32 screen_brightness_override_from_window_manager = 28;
294    // The user activity timeout override from the window manager
295    // to allow the current foreground activity to override the user activity
296    // timeout. Use -1 to disable.
297    optional sint64 user_activity_timeout_override_from_window_manager_ms = 29;
298    // The window manager has determined the user to be inactive via other means.
299    // Set this to false to disable.
300    optional bool is_user_inactive_override_from_window_manager = 30;
301    // The screen state to use while dozing.
302    optional .android.view.DisplayStateEnum doze_screen_state_override_from_dream_manager = 31;
303    // The screen brightness to use while dozing.
304    optional float dozed_screen_brightness_override_from_dream_manager = 32;
305    // Screen brightness settings limits.
306    optional ScreenBrightnessSettingLimitsProto screen_brightness_setting_limits = 33;
307    // True if double tap to wake is enabled
308    optional bool is_double_tap_wake_enabled = 34;
309    // True if we are currently in VR Mode.
310    optional bool is_vr_mode_enabled = 35;
311    // True if Sidekick is controlling the display and we shouldn't change its power mode.
312    optional bool draw_wake_lock_override_from_sidekick = 36;
313}
314
315message BatterySaverStateMachineProto {
316    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
317
318    // Whether battery saver is enabled.
319    optional bool enabled = 1;
320
321    enum StateEnum {
322        STATE_UNKNOWN = 0;
323        STATE_OFF = 1;
324        STATE_MANUAL_ON = 2;
325        STATE_AUTOMATIC_ON = 3;
326        STATE_OFF_AUTOMATIC_SNOOZED = 4;
327        STATE_PENDING_STICKY_ON = 5;
328    }
329    optional StateEnum state = 18;
330
331    // Whether full battery saver is enabled.
332    optional bool is_full_enabled = 14;
333
334    // Whether adaptive battery saver is enabled.
335    optional bool is_adaptive_enabled = 15;
336
337    // Whether the battery saver policy indicates that is_enabled should be
338    // advertised.
339    optional bool should_advertise_is_enabled = 16;
340
341    // Whether system has booted.
342    optional bool boot_completed = 2;
343
344    // Whether settings have been loaded already.
345    optional bool settings_loaded = 3;
346
347    // Whether battery status has been set at least once.
348    optional bool battery_status_set = 4;
349
350    reserved 5; // battery_saver_snoozing
351
352    // Whether the device is connected to any power source.
353    optional bool is_powered = 6;
354
355    // Current battery level in %, 0-100.
356    optional int32 battery_level = 7;
357
358    // Whether battery level is low or not.
359    optional bool is_battery_level_low = 8;
360
361    // The value of Global.LOW_POWER_MODE. This is a cached value, so it could
362    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
363    optional bool setting_battery_saver_enabled = 9;
364
365    // The value of Global.LOW_POWER_MODE_STICKY. This is a cached value, so it could
366    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
367    optional bool setting_battery_saver_enabled_sticky = 10;
368
369    // The value of Global.LOW_POWER_MODE_TRIGGER_LEVEL. This is a cached value, so it could
370    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
371    optional int32 setting_battery_saver_trigger_threshold = 11;
372
373    // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED. This is a cached value, so
374    // it could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
375    optional bool setting_battery_saver_sticky_auto_disable_enabled = 12;
376
377    // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL. This is a cached value, so it
378    // could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
379    optional int32 setting_battery_saver_sticky_auto_disable_threshold = 13;
380
381    // The last time adaptive battery saver was changed by an external service,
382    // using elapsed realtime as the timebase.
383    optional int64 last_adaptive_battery_saver_changed_externally_elapsed = 17;
384
385    // Next tag: 19
386}
387