• 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/content/intent.proto";
23import "frameworks/base/core/proto/android/os/looper.proto";
24import "frameworks/base/core/proto/android/os/powermanager.proto";
25import "frameworks/base/core/proto/android/os/worksource.proto";
26import "frameworks/base/core/proto/android/providers/settings.proto";
27import "frameworks/base/core/proto/android/server/wirelesschargerdetector.proto";
28import "frameworks/base/core/proto/android/privacy.proto";
29import "frameworks/proto_logging/stats/enums/app/enums.proto";
30import "frameworks/proto_logging/stats/enums/os/enums.proto";
31import "frameworks/proto_logging/stats/enums/view/enums.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        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 always respect the wake locks for.
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}
191
192// A com.android.server.power.PowerManagerService.SuspendBlockerImpl object.
193message SuspendBlockerProto {
194    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
195
196    optional string name = 1;
197    optional int32 reference_count = 2;
198}
199
200// A com.android.server.power.PowerManagerService.WakeLock object.
201message WakeLockProto {
202    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
203
204    message WakeLockFlagsProto {
205        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
206
207        // Turn the screen on when the wake lock is acquired.
208        optional bool is_acquire_causes_wakeup = 1;
209        // When this wake lock is released, poke the user activity timer
210        // so the screen stays on for a little longer.
211        optional bool is_on_after_release = 2;
212    }
213
214    optional .android.os.WakeLockLevelEnum lock_level = 1;
215    optional string tag = 2;
216    optional WakeLockFlagsProto flags = 3;
217    optional bool is_disabled = 4;
218    // Acquire time in ms
219    optional int64 acq_ms = 5;
220    optional bool is_notified_long = 6;
221    // Owner UID
222    optional int32 uid = 7;
223    // Owner PID
224    optional int32 pid = 8;
225    optional .android.os.WorkSourceProto work_source = 9;
226}
227
228message PowerServiceSettingsAndConfigurationDumpProto {
229    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
230
231    message StayOnWhilePluggedInProto {
232        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
233
234        optional bool is_stay_on_while_plugged_in_ac = 1;
235        optional bool is_stay_on_while_plugged_in_usb = 2;
236        optional bool is_stay_on_while_plugged_in_wireless = 3;
237    }
238    message ScreenBrightnessSettingLimitsProto {
239        option (.android.msg_privacy).dest = DEST_AUTOMATIC;
240
241        reserved 1, 2, 3; // setting_minimum, setting_maximum, setting_default
242        optional float setting_minimum_float = 4;
243        optional float setting_maximum_float = 5;
244        optional float setting_default_float = 6;
245    }
246
247    // True to decouple auto-suspend mode from the display state.
248    optional bool is_decouple_hal_auto_suspend_mode_from_display_config = 1;
249    // True to decouple interactive mode from the display state.
250    optional bool is_decouple_hal_interactive_mode_from_display_config = 2;
251    // True if the device should wake up when plugged or unplugged.
252    optional bool is_wake_up_when_plugged_or_unplugged_config = 3;
253    // True if the device should wake up when plugged or unplugged in theater mode.
254    optional bool is_wake_up_when_plugged_or_unplugged_in_theater_mode_config = 4;
255    // True if theater mode is enabled
256    optional bool is_theater_mode_enabled = 5;
257    // True if the device should suspend when the screen is off due to proximity.
258    optional bool is_suspend_when_screen_off_due_to_proximity_config = 6;
259    // True if dreams are supported on this device.
260    optional bool are_dreams_supported_config = 7;
261    // Default value for dreams enabled
262    optional bool are_dreams_enabled_by_default_config = 8;
263    // Default value for dreams activate-on-sleep
264    optional bool are_dreams_activated_on_sleep_by_default_config = 9;
265    // Default value for dreams activate-on-dock
266    optional bool are_dreams_activated_on_dock_by_default_config = 10;
267    // True if dreams can run while not plugged in.
268    optional bool are_dreams_enabled_on_battery_config = 11;
269    // Minimum battery level to allow dreaming when powered.
270    // Use -1 to disable this safety feature.
271    optional sint32 dreams_battery_level_minimum_when_powered_config = 12;
272    // Minimum battery level to allow dreaming when not powered.
273    // Use -1 to disable this safety feature.
274    optional sint32 dreams_battery_level_minimum_when_not_powered_config = 13;
275    // If the battery level drops by this percentage and the user activity
276    // timeout has expired, then assume the device is receiving insufficient
277    // current to charge effectively and terminate the dream.  Use -1 to disable
278    // this safety feature.
279    optional sint32 dreams_battery_level_drain_cutoff_config = 14;
280    // True if dreams are enabled by the user.
281    optional bool are_dreams_enabled_setting = 15;
282    // True if dreams should be activated on sleep.
283    optional bool are_dreams_activate_on_sleep_setting = 16;
284    // True if dreams should be activated on dock.
285    optional bool are_dreams_activate_on_dock_setting = 17;
286    // True if doze should not be started until after the screen off transition.
287    optional bool is_doze_after_screen_off_config = 18;
288    // The minimum screen off timeout, in milliseconds.
289    optional int32 minimum_screen_off_timeout_config_ms = 19;
290    // The screen dim duration, in milliseconds.
291    optional int32 maximum_screen_dim_duration_config_ms = 20;
292    // The maximum screen dim time expressed as a ratio relative to the screen off timeout.
293    optional float maximum_screen_dim_ratio_config = 21;
294    // The screen off timeout setting value in milliseconds.
295    optional int32 screen_off_timeout_setting_ms = 22;
296    // The sleep timeout setting value in milliseconds. Default value is -1.
297    optional sint32 sleep_timeout_setting_ms = 23;
298    // The maximum allowable screen off timeout according to the device administration policy.
299    optional int32 maximum_screen_off_timeout_from_device_admin_ms = 24;
300    optional bool is_maximum_screen_off_timeout_from_device_admin_enforced_locked = 25;
301    // The stay on while plugged in setting.
302    // A set of battery conditions under which to make the screen stay on.
303    optional StayOnWhilePluggedInProto stay_on_while_plugged_in = 26;
304    // The screen brightness mode.
305    optional .android.providers.settings.SettingsProto.ScreenBrightnessMode screen_brightness_mode_setting = 27;
306    // The screen brightness setting override from the window manager
307    // to allow the current foreground activity to override the brightness.
308    // Use -1 to disable.
309    optional sint32 screen_brightness_override_from_window_manager = 28;
310    // The user activity timeout override from the window manager
311    // to allow the current foreground activity to override the user activity
312    // timeout. Use -1 to disable.
313    optional sint64 user_activity_timeout_override_from_window_manager_ms = 29;
314    // The window manager has determined the user to be inactive via other means.
315    // Set this to false to disable.
316    optional bool is_user_inactive_override_from_window_manager = 30;
317    // The screen state to use while dozing.
318    optional .android.view.DisplayStateEnum doze_screen_state_override_from_dream_manager = 31;
319    // The screen brightness to use while dozing.
320    optional float dozed_screen_brightness_override_from_dream_manager = 32;
321    // Screen brightness settings limits.
322    optional ScreenBrightnessSettingLimitsProto screen_brightness_setting_limits = 33;
323    // True if double tap to wake is enabled
324    optional bool is_double_tap_wake_enabled = 34;
325    // True if we are currently in VR Mode.
326    optional bool is_vr_mode_enabled = 35;
327    // True if Sidekick is controlling the display and we shouldn't change its power mode.
328    optional bool draw_wake_lock_override_from_sidekick = 36;
329    // The attentive timeout setting value in milliseconds. Default value is -1.
330    optional sint32 attentive_timeout_setting_ms = 37;
331    // The attentive timeout config value in milliseconds.
332    optional sint32 attentive_timeout_config_ms = 38;
333    // The attentive warning duration config value in milliseconds.
334    optional sint32 attentive_warning_duration_config_ms = 39;
335}
336
337message BatterySaverStateMachineProto {
338    option (.android.msg_privacy).dest = DEST_AUTOMATIC;
339
340    // Whether battery saver is enabled.
341    optional bool enabled = 1;
342
343    enum StateEnum {
344        STATE_UNKNOWN = 0;
345        STATE_OFF = 1;
346        STATE_MANUAL_ON = 2;
347        STATE_AUTOMATIC_ON = 3;
348        STATE_OFF_AUTOMATIC_SNOOZED = 4;
349        STATE_PENDING_STICKY_ON = 5;
350    }
351    optional StateEnum state = 18;
352
353    // Whether full battery saver is enabled.
354    optional bool is_full_enabled = 14;
355
356    // Whether adaptive battery saver is enabled.
357    optional bool is_adaptive_enabled = 15;
358
359    // Whether the battery saver policy indicates that is_enabled should be
360    // advertised.
361    optional bool should_advertise_is_enabled = 16;
362
363    // Whether system has booted.
364    optional bool boot_completed = 2;
365
366    // Whether settings have been loaded already.
367    optional bool settings_loaded = 3;
368
369    // Whether battery status has been set at least once.
370    optional bool battery_status_set = 4;
371
372    reserved 5; // battery_saver_snoozing
373
374    // Whether the device is connected to any power source.
375    optional bool is_powered = 6;
376
377    // Current battery level in %, 0-100.
378    optional int32 battery_level = 7;
379
380    // Whether battery level is low or not.
381    optional bool is_battery_level_low = 8;
382
383    // Denotes which threshold should be used for automatic Battery Saver triggering.
384    enum AutomaticTriggerEnum {
385        TRIGGER_PERCENTAGE = 0;
386        TRIGGER_DYNAMIC = 1;
387    }
388    // The value of Global.AUTOMATIC_POWER_SAVE_MODE. This is a cached value, so it could
389    // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
390    optional AutomaticTriggerEnum setting_automatic_trigger = 19;
391
392    // The value of Global.LOW_POWER_MODE. This is a cached value, so it could
393    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
394    optional bool setting_battery_saver_enabled = 9;
395
396    // The value of Global.LOW_POWER_MODE_STICKY. This is a cached value, so it could
397    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
398    optional bool setting_battery_saver_enabled_sticky = 10;
399
400    // The value of Global.LOW_POWER_MODE_TRIGGER_LEVEL. This is a cached value, so it could
401    // be slightly different from what's in GlobalSettingsProto.LowPowerMode.
402    optional int32 setting_battery_saver_trigger_threshold = 11;
403
404    // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_ENABLED. This is a cached value, so
405    // it could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
406    optional bool setting_battery_saver_sticky_auto_disable_enabled = 12;
407
408    // The value of Global.LOW_POWER_MODE_STICKY_AUTO_DISABLE_LEVEL. This is a cached value, so it
409    // could be slightly different from what's in GlobalSettingsProto.LowPowerMode.
410    optional int32 setting_battery_saver_sticky_auto_disable_threshold = 13;
411
412    // The last time adaptive battery saver was changed by an external service,
413    // using elapsed realtime as the timebase.
414    optional int64 last_adaptive_battery_saver_changed_externally_elapsed = 17;
415
416    // The default disable threshold for Dynamic Power Savings enabled battery saver.
417    optional int32 default_dynamic_disable_threshold = 20;
418
419    // When to disable battery saver again if it was enabled due to an external suggestion.
420    // Corresponds to Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD. This is a cached value,
421    // so it could be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
422    optional int32 dynamic_disable_threshold = 21;
423
424    // Whether we've received a suggestion that battery saver should be on from an external app.
425    // Corresponds to Global.DYNAMIC_POWER_SAVINGS_ENABLED. This is a cached value, so it could
426    // be slightly different from what's in GlobalSettingsProto.DynamicPowerSavings.
427    optional bool dynamic_battery_saver_enabled = 22;
428
429    // Next tag: 23
430}
431