Debian Codegraph @

core/proto/android/server/powermanagerservice.proto

raw
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
17 syntax = "proto2";
18 package com.android.server.power;
19
20 option java_multiple_files = true;
21
22 import "frameworks/base/core/proto/android/content/intent.proto";
23 import "frameworks/base/core/proto/android/os/looper.proto";
24 import "frameworks/base/core/proto/android/os/powermanager.proto";
25 import "frameworks/base/core/proto/android/os/worksource.proto";
26 import "frameworks/base/core/proto/android/providers/settings.proto";
27 import "frameworks/base/core/proto/android/server/wirelesschargerdetector.proto";
28 import "frameworks/base/core/proto/android/privacy.proto";
29 import "frameworks/proto_logging/stats/enums/app/enums.proto";
30 import "frameworks/proto_logging/stats/enums/os/enums.proto";
31 import "frameworks/proto_logging/stats/enums/view/enums.proto";
32
33 message 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 optional int64 last_user_activity_time_ms = 4;
62 optional int64 last_user_activity_time_no_change_lights_ms = 5;
63 optional int32 display_group_id = 6;
64 }
65 // A com.android.server.power.PowerManagerService.UidState object.
66 message UidStateProto {
67 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
68
69 optional int32 uid = 1;
70 optional string uid_string = 2;
71 optional bool is_active = 3;
72 optional int32 num_wake_locks = 4;
73 optional .android.app.ProcessStateEnum process_state = 5;
74 }
75
76 optional ConstantsProto constants = 1;
77 // A bitfield that indicates what parts of the power state have
78 // changed and need to be recalculated.
79 optional int32 dirty = 2;
80 // Indicates whether the device is awake or asleep or somewhere in between.
81 optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 3;
82 optional bool is_wakefulness_changing = 4;
83 // True if the device is plugged into a power source.
84 optional bool is_powered = 5;
85 // The current plug type
86 optional .android.os.BatteryPluggedStateEnum plug_type = 6;
87 // The current battery level percentage.
88 optional int32 battery_level = 7;
89 // The battery level percentage at the time the dream started.
90 optional int32 battery_level_when_dream_started = 8;
91 // The current dock state.
92 optional .android.content.IntentProto.DockState dock_state = 9;
93 // True if the device should stay on.
94 optional bool is_stay_on = 10;
95 // True if the proximity sensor reads a positive result.
96 optional bool is_proximity_positive = 11;
97 // True if boot completed occurred. We keep the screen on until this happens.
98 optional bool is_boot_completed = 12;
99 // True if systemReady() has been called.
100 optional bool is_system_ready = 13;
101 // True if auto-suspend mode is enabled.
102 optional bool is_hal_auto_suspend_mode_enabled = 14;
103 // True if interactive mode is enabled.
104 optional bool is_hal_auto_interactive_mode_enabled = 15;
105 // Summarizes the state of all active wakelocks.
106 optional ActiveWakeLocksProto active_wake_locks = 16;
107 // Have we scheduled a message to check for long wake locks? This is when
108 // we will check. (In milliseconds timestamp)
109 optional int64 notify_long_scheduled_ms = 17;
110 // Last time we checked for long wake locks. (In milliseconds timestamp)
111 optional int64 notify_long_dispatched_ms = 18;
112 // The time we decided to do next long check. (In milliseconds timestamp)
113 optional int64 notify_long_next_check_ms = 19;
114 // Summarizes the effect of the user activity timer.
115 repeated UserActivityProto user_activity = 20;
116 // If true, instructs the display controller to wait for the proximity
117 // sensor to go negative before turning the screen on.
118 optional bool is_request_wait_for_negative_proximity = 21;
119 // True if MSG_SANDMAN has been scheduled.
120 optional bool is_sandman_scheduled = 22;
121 // True if the sandman has just been summoned for the first time since entering
122 // the dreaming or dozing state. Indicates whether a new dream should begin.
123 optional bool is_sandman_summoned = 23;
124 // True if the battery level is currently considered low.
125 optional bool is_battery_level_low = 24;
126 // True if we are currently in light device idle mode.
127 optional bool is_light_device_idle_mode = 25;
128 // True if we are currently in device idle mode.
129 optional bool is_device_idle_mode = 26;
130 // Set of app ids that we will respect the wake locks for while in device idle mode.
131 repeated int32 device_idle_whitelist = 27;
132 // Set of app ids that are temporarily allowed to acquire wakelocks due to
133 // high-pri message
134 repeated int32 device_idle_temp_whitelist = 28;
135 // Timestamp of the last time the device was awoken.
136 optional int64 last_wake_time_ms = 29;
137 // Timestamp of the last time the device was put to sleep.
138 optional int64 last_sleep_time_ms = 30;
139 // Timestamp of the last call to user activity.
140 optional int64 last_user_activity_time_ms = 31 [deprecated = true];
141 optional int64 last_user_activity_time_no_change_lights_ms = 32 [deprecated = true];
142 // Timestamp of last interactive power hint.
143 optional int64 last_interactive_power_hint_time_ms = 33;
144 // Timestamp of the last screen brightness boost.
145 optional int64 last_screen_brightness_boost_time_ms = 34;
146 // True if screen brightness boost is in progress.
147 optional bool is_screen_brightness_boost_in_progress = 35;
148 // True if the display power state has been fully applied, which means the
149 // display is actually on or actually off or whatever was requested.
150 optional bool is_display_ready = 36;
151 // True if the wake lock suspend blocker has been acquired.
152 optional bool is_holding_wake_lock_suspend_blocker = 37;
153 // The suspend blocker used to keep the CPU alive when the display is on, the
154 // display is getting ready or there is user activity (in which case the
155 // display must be on).
156 optional bool is_holding_display_suspend_blocker = 38;
157 // Settings and configuration
158 optional PowerServiceSettingsAndConfigurationDumpProto settings_and_configuration = 39;
159 // Sleep timeout in ms. This can be -1.
160 optional sint32 sleep_timeout_ms = 40;
161 // Screen off timeout in ms
162 optional int32 screen_off_timeout_ms = 41;
163 // Screen dim duration in ms
164 optional int32 screen_dim_duration_ms = 42;
165 // We are currently in the middle of a batch change of uids.
166 optional bool are_uids_changing = 43;
167 // Some uids have actually changed while mUidsChanging was true.
168 optional bool are_uids_changed = 44;
169 // List of UIDs and their states
170 repeated UidStateProto uid_states = 45;
171 optional .android.os.LooperProto looper = 46;
172 // List of all wake locks acquired by applications.
173 repeated WakeLockProto wake_locks = 47;
174 // List of all suspend blockers.
175 repeated SuspendBlockerProto suspend_blockers = 48;
176 optional WirelessChargerDetectorProto wireless_charger_detector = 49;
177 optional BatterySaverStateMachineProto battery_saver_state_machine = 50;
178 // Attentive timeout in ms. The timeout is disabled if it is set to -1.
179 optional sint32 attentive_timeout_ms = 51;
180 // The time (in the elapsed realtime timebase) at which the battery level will reach 0%. This
181 // is provided as an enhanced estimate and only valid if
182 // last_enhanced_discharge_time_updated_elapsed is greater than 0.
183 optional int64 enhanced_discharge_time_elapsed = 52;
184 // Timestamp (in the elapsed realtime timebase) of last update to enhanced battery estimate
185 // data.
186 optional int64 last_enhanced_discharge_time_updated_elapsed = 53;
187 // Whether or not the current enhanced discharge prediction is personalized based on device
188 // usage or not.
189 optional bool is_enhanced_discharge_prediction_personalized = 54;
190 optional bool is_low_power_standby_active = 55;
191 optional LowPowerStandbyControllerDumpProto low_power_standby_controller = 56;
192 // The battery level drained by the dream.
193 optional int32 battery_level_drained_while_dreaming = 57;
194 }
195
196 // A com.android.server.power.PowerManagerService.SuspendBlockerImpl object.
197 message SuspendBlockerProto {
198 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
199
200 optional string name = 1;
201 optional int32 reference_count = 2;
202 }
203
204 // A com.android.server.power.PowerManagerService.WakeLock object.
205 message WakeLockProto {
206 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
207
208 message WakeLockFlagsProto {
209 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
210
211 // Turn the screen on when the wake lock is acquired.
212 optional bool is_acquire_causes_wakeup = 1;
213 // When this wake lock is released, poke the user activity timer
214 // so the screen stays on for a little longer.
215 optional bool is_on_after_release = 2;
216 // The wakelock is held by the system server on request by another app.
217 optional bool system_wakelock = 3;
218 }
219
220 optional .android.os.WakeLockLevelEnum lock_level = 1;
221 optional string tag = 2;
222 optional WakeLockFlagsProto flags = 3;
223 optional bool is_disabled = 4;
224 // Acquire time in ms
225 optional int64 acq_ms = 5;
226 optional bool is_notified_long = 6;
227 // Owner UID
228 optional int32 uid = 7;
229 // Owner PID
230 optional int32 pid = 8;
231 optional .android.os.WorkSourceProto work_source = 9;
232 }
233
234 message PowerServiceSettingsAndConfigurationDumpProto {
235 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
236
237 message StayOnWhilePluggedInProto {
238 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
239
240 optional bool is_stay_on_while_plugged_in_ac = 1;
241 optional bool is_stay_on_while_plugged_in_usb = 2;
242 optional bool is_stay_on_while_plugged_in_wireless = 3;
243 optional bool is_stay_on_while_plugged_in_dock = 4;
244 }
245 message ScreenBrightnessSettingLimitsProto {
246 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
247
248 reserved 1, 2, 3; // setting_minimum, setting_maximum, setting_default
249 optional float setting_minimum_float = 4;
250 optional float setting_maximum_float = 5;
251 optional float setting_default_float = 6;
252 }
253
254 // True to decouple auto-suspend mode from the display state.
255 optional bool is_decouple_hal_auto_suspend_mode_from_display_config = 1;
256 // True to decouple interactive mode from the display state.
257 optional bool is_decouple_hal_interactive_mode_from_display_config = 2;
258 // True if the device should wake up when plugged or unplugged.
259 optional bool is_wake_up_when_plugged_or_unplugged_config = 3;
260 // True if the device should wake up when plugged or unplugged in theater mode.
261 optional bool is_wake_up_when_plugged_or_unplugged_in_theater_mode_config = 4;
262 // True if theater mode is enabled
263 optional bool is_theater_mode_enabled = 5;
264 // True if the device should suspend when the screen is off due to proximity.
265 optional bool is_suspend_when_screen_off_due_to_proximity_config = 6;
266 // True if dreams are supported on this device.
267 optional bool are_dreams_supported_config = 7;
268 // Default value for dreams enabled
269 optional bool are_dreams_enabled_by_default_config = 8;
270 // Default value for dreams activate-on-sleep
271 optional bool are_dreams_activated_on_sleep_by_default_config = 9;
272 // Default value for dreams activate-on-dock
273 optional bool are_dreams_activated_on_dock_by_default_config = 10;
274 // True if dreams can run while not plugged in.
275 optional bool are_dreams_enabled_on_battery_config = 11;
276 // Minimum battery level to allow dreaming when powered.
277 // Use -1 to disable this safety feature.
278 optional sint32 dreams_battery_level_minimum_when_powered_config = 12;
279 // Minimum battery level to allow dreaming when not powered.
280 // Use -1 to disable this safety feature.
281 optional sint32 dreams_battery_level_minimum_when_not_powered_config = 13;
282 // If the battery level drops by this percentage and the user activity
283 // timeout has expired, then assume the device is receiving insufficient
284 // current to charge effectively and terminate the dream. Use -1 to disable
285 // this safety feature.
286 optional sint32 dreams_battery_level_drain_cutoff_config = 14;
287 // True if dreams are enabled by the user.
288 optional bool are_dreams_enabled_setting = 15;
289 // True if dreams should be activated on sleep.
290 optional bool are_dreams_activate_on_sleep_setting = 16;
291 // True if dreams should be activated on dock.
292 optional bool are_dreams_activate_on_dock_setting = 17;
293 // True if doze should not be started until after the screen off transition.
294 optional bool is_doze_after_screen_off_config = 18;
295 // The minimum screen off timeout, in milliseconds.
296 optional int32 minimum_screen_off_timeout_config_ms = 19;
297 // The screen dim duration, in milliseconds.
298 optional int32 maximum_screen_dim_duration_config_ms = 20;
299 // The maximum screen dim time expressed as a ratio relative to the screen off timeout.
300 optional float maximum_screen_dim_ratio_config = 21;
301 // The screen off timeout setting value in milliseconds.
302 optional int32 screen_off_timeout_setting_ms = 22;
303 // The sleep timeout setting value in milliseconds. Default value is -1.
304 optional sint32 sleep_timeout_setting_ms = 23;
305 // The maximum allowable screen off timeout according to the device administration policy.
306 optional int32 maximum_screen_off_timeout_from_device_admin_ms = 24;
307 optional bool is_maximum_screen_off_timeout_from_device_admin_enforced_locked = 25;
308 // The stay on while plugged in setting.
309 // A set of battery conditions under which to make the screen stay on.
310 optional StayOnWhilePluggedInProto stay_on_while_plugged_in = 26;
311 // The screen brightness mode.
312 optional .android.providers.settings.SettingsProto.ScreenBrightnessMode screen_brightness_mode_setting = 27;
313 // The screen brightness setting override from the window manager
314 // to allow the current foreground activity to override the brightness.
315 // Use -1 to disable.
316 optional sint32 screen_brightness_override_from_window_manager = 28;
317 // The user activity timeout override from the window manager
318 // to allow the current foreground activity to override the user activity
319 // timeout. Use -1 to disable.
320 optional sint64 user_activity_timeout_override_from_window_manager_ms = 29;
321 // The window manager has determined the user to be inactive via other means.
322 // Set this to false to disable.
323 optional bool is_user_inactive_override_from_window_manager = 30;
324 // The screen state to use while dozing.
325 optional .android.view.DisplayStateEnum doze_screen_state_override_from_dream_manager = 31;
326 // The screen brightness to use while dozing.
327 optional float dozed_screen_brightness_override_from_dream_manager = 32;
328 // Screen brightness settings limits.
329 optional ScreenBrightnessSettingLimitsProto screen_brightness_setting_limits = 33;
330 // True if double tap to wake is enabled
331 optional bool is_double_tap_wake_enabled = 34;
332 // True if we are currently in VR Mode.
333 optional bool is_vr_mode_enabled = 35;
334 // True if Sidekick is controlling the display and we shouldn't change its power mode.
335 optional bool draw_wake_lock_override_from_sidekick = 36;
336 // The attentive timeout setting value in milliseconds. Default value is -1.
337 optional sint32 attentive_timeout_setting_ms = 37;
338 // The attentive timeout config value in milliseconds.
339 optional sint32 attentive_timeout_config_ms = 38;
340 // The attentive warning duration config value in milliseconds.
341 optional sint32 attentive_warning_duration_config_ms = 39;
342 }
343
344 message BatterySaverStateMachineProto {
345 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
346
347 // Whether battery saver is enabled.
348 optional bool enabled = 1;
349
350 enum StateEnum {
351 STATE_UNKNOWN = 0;
352 STATE_OFF = 1;
353 STATE_MANUAL_ON = 2;
354 STATE_AUTOMATIC_ON = 3;
355 STATE_OFF_AUTOMATIC_SNOOZED = 4;
356 STATE_PENDING_STICKY_ON = 5;
357 }
358 optional StateEnum state = 18;
359
360 // Whether full battery saver is enabled.
361 optional bool is_full_enabled = 14;
362
363 // Whether adaptive battery saver is enabled.
364 optional bool is_adaptive_enabled = 15;
365
366 // Whether the battery saver policy indicates that is_enabled should be
367 // advertised.
368 optional bool should_advertise_is_enabled = 16;
369
370 // Whether system has booted.
371 optional bool boot_completed = 2;
372
373 // Whether settings have been loaded already.
374 optional bool settings_loaded = 3;
375
376 // Whether battery status has been set at least once.
377 optional bool battery_status_set = 4;
378
379 reserved 5; // battery_saver_snoozing
380
381 // Whether the device is connected to any power source.
382 optional bool is_powered = 6;
383
384 // Current battery level in %, 0-100.
385 optional int32 battery_level = 7;
386
387 // Whether battery level is low or not.
388 optional bool is_battery_level_low = 8;
389
390 // Denotes which threshold should be used for automatic Battery Saver triggering.
391 enum AutomaticTriggerEnum {
392 TRIGGER_PERCENTAGE = 0;
393 TRIGGER_DYNAMIC = 1;
394 }
395 // The value of Global.AUTOMATIC_POWER_SAVE_MODE. This is a cached value, so it could
396 // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
397 optional AutomaticTriggerEnum setting_automatic_trigger = 19;
398
399 // The value of Global.LOW_POWER_MODE. This is a cached value, so it could
400 // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
401 optional bool setting_battery_saver_enabled = 9;
402
403 // The value of Global.LOW_POWER_MODE_STICKY. This is a cached value, so it could
404 // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
405 optional bool setting_battery_saver_enabled_sticky = 10;
406
407 // The value of Global.LOW_POWER_MODE_TRIGGER_LEVEL. This is a cached value, so it could
408 // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
409 optional int32 setting_battery_saver_trigger_threshold = 11;
410
411 // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED. This is a cached value, so
412 // it could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
413 optional bool setting_battery_saver_sticky_auto_disable_enabled = 12;
414
415 // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL. This is a cached value, so it
416 // could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
417 optional int32 setting_battery_saver_sticky_auto_disable_threshold = 13;
418
419 // The last time adaptive battery saver was changed by an external service,
420 // using elapsed realtime as the timebase.
421 optional int64 last_adaptive_battery_saver_changed_externally_elapsed = 17;
422
423 // The default disable threshold for Dynamic Power Savings enabled battery saver.
424 optional int32 default_dynamic_disable_threshold = 20;
425
426 // When to disable battery saver again if it was enabled due to an external suggestion.
427 // Corresponds to Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD. This is a cached value,
428 // so it could be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
429 optional int32 dynamic_disable_threshold = 21;
430
431 // Whether we've received a suggestion that battery saver should be on from an external app.
432 // Corresponds to Global.DYNAMIC_POWER_SAVINGS_ENABLED. This is a cached value, so it could
433 // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
434 optional bool dynamic_battery_saver_enabled = 22;
435
436 // Next tag: 23
437 }
438
439 message LowPowerStandbyControllerDumpProto {
440 option (.android.msg_privacy).dest = DEST_AUTOMATIC;
441
442 // True if Low Power Standby is active
443 optional bool is_active = 1;
444
445 // True if Low Power Standby is enabled
446 optional bool is_enabled = 2;
447
448 // True if Low Power Standby is supported
449 optional bool is_supported_config = 3;
450
451 // True if Low Power Standby is enabled by default
452 optional bool is_enabled_by_default_config = 4;
453
454 // True if the device is currently interactive
455 optional bool is_interactive = 5;
456
457 // Time (in elapsedRealtime) when the device was last interactive
458 optional int64 last_interactive_time = 6;
459
460 // Timeout (in milliseconds) after becoming non-interactive that Low Power Standby can activate
461 optional int32 standby_timeout_config = 7;
462
463 // True if the device has entered idle mode since becoming non-interactive
464 optional bool idle_since_non_interactive = 8;
465
466 // True if the device is currently in idle mode
467 optional bool is_device_idle = 9;
468
469 // Set of app ids that are exempt form low power standby
470 repeated int32 allowlist = 10;
471
472 // Next tag: 11
473 }