• 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 = "proto3";
18
19package android.service.power;
20
21option java_multiple_files = true;
22option java_outer_classname = "PowerServiceProto";
23
24import "frameworks/base/core/proto/android/os/looper.proto";
25import "frameworks/base/core/proto/android/os/worksource.proto";
26import "frameworks/base/core/proto/android/service/wirelesschargerdetector.proto";
27
28message PowerServiceDumpProto {
29    message ConstantsProto {
30        bool is_no_cached_wake_locks = 1;
31    }
32    message ActiveWakeLocksProto {
33        bool is_cpu = 1;
34        bool is_screen_bright = 2;
35        bool is_screen_dim = 3;
36        bool is_button_bright = 4;
37        bool is_proximity_screen_off = 5;
38        // only set if already awake
39        bool is_stay_awake = 6;
40        bool is_doze = 7;
41        bool is_draw = 8;
42    }
43    message UserActivityProto {
44        bool is_screen_bright = 1;
45        bool is_screen_dim = 2;
46        bool is_screen_dream = 3;
47    }
48    message UidProto {
49        // Enum values gotten from ActivityManager.java
50        enum ProcessState {
51            // Process is a persistent system process.
52            PROCESS_STATE_PERSISTENT = 0;
53            // Process is a persistent system process and is doing UI.
54            PROCESS_STATE_PERSISTENT_UI = 1;
55            // Process is hosting the current top activities. Note that this
56            // covers all activities that are visible to the user.
57            PROCESS_STATE_TOP = 2;
58            // Process is hosting a foreground service due to a system binding.
59            PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3;
60            // Process is hosting a foreground service.
61            PROCESS_STATE_FOREGROUND_SERVICE = 4;
62            // Same as {@link #PROCESS_STATE_TOP} but while device is sleeping.
63            PROCESS_STATE_TOP_SLEEPING = 5;
64            // Process is important to the user, and something they are aware of.
65            PROCESS_STATE_IMPORTANT_FOREGROUND = 6;
66            // Process is important to the user, but not something they are aware of.
67            PROCESS_STATE_IMPORTANT_BACKGROUND = 7;
68            // Process is in the background running a backup/restore operation.
69            PROCESS_STATE_BACKUP = 8;
70            // Process is in the background, but it can't restore its state so
71            // we want to try to avoid killing it.
72            PROCESS_STATE_HEAVY_WEIGHT = 9;
73            // Process is in the background running a service.
74            PROCESS_STATE_SERVICE = 10;
75            // Process is in the background running a receiver.
76            PROCESS_STATE_RECEIVER = 11;
77            // Process is in the background but hosts the home activity.
78            PROCESS_STATE_HOME = 12;
79            // Process is in the background but hosts the last shown activity.
80            PROCESS_STATE_LAST_ACTIVITY = 13;
81            // Process is being cached for later use and contains activities.
82            PROCESS_STATE_CACHED_ACTIVITY = 14;
83            // Process is being cached for later use and is a client of another
84            // cached process that contains activities.
85            PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15;
86            // Process is being cached for later use and is empty.
87            PROCESS_STATE_CACHED_EMPTY = 16;
88            // Process does not exist.
89            PROCESS_STATE_NONEXISTENT = 17;
90        }
91        int32 uid = 1;
92        string uid_string = 2;
93        bool is_active = 3;
94        int32 num_wake_locks = 4;
95        bool is_process_state_unknown = 5;
96        ProcessState process_state = 6;
97    }
98
99    // Enum values gotten from PowerManagerInternal.java
100    enum Wakefulness {
101        WAKEFULNESS_ASLEEP = 0;
102        WAKEFULNESS_AWAKE = 1;
103        WAKEFULNESS_DREAMING = 2;
104        WAKEFULNESS_DOZING = 3;
105        WAKEFULNESS_UNKNOWN = 4;
106    }
107    // Enum values gotten from BatteryManager.java
108    enum PlugType {
109        PLUG_TYPE_NONE = 0;
110        PLUG_TYPE_PLUGGED_AC = 1;
111        PLUG_TYPE_PLUGGED_USB = 2;
112        PLUG_TYPE_PLUGGED_WIRELESS = 4;
113    }
114    // Enum values gotten from Intent.java
115    enum DockState {
116        DOCK_STATE_UNDOCKED = 0;
117        DOCK_STATE_DESK = 1;
118        DOCK_STATE_CAR = 2;
119        DOCK_STATE_LE_DESK = 3;
120        DOCK_STATE_HE_DESK = 4;
121    }
122
123    ConstantsProto constants = 1;
124    // A bitfield that indicates what parts of the power state have
125    // changed and need to be recalculated.
126    int32 dirty = 2;
127    // Indicates whether the device is awake or asleep or somewhere in between.
128    Wakefulness wakefulness = 3;
129    bool is_wakefulness_changing = 4;
130    // True if the device is plugged into a power source.
131    bool is_powered = 5;
132    // The current plug type
133    PlugType plug_type = 6;
134    // The current battery level percentage.
135    int32 battery_level = 7;
136    // The battery level percentage at the time the dream started.
137    int32 battery_level_when_dream_started = 8;
138    // The current dock state.
139    DockState dock_state = 9;
140    // True if the device should stay on.
141    bool is_stay_on = 10;
142    // True if the proximity sensor reads a positive result.
143    bool is_proximity_positive = 11;
144    // True if boot completed occurred.  We keep the screen on until this happens.
145    bool is_boot_completed = 12;
146    // True if systemReady() has been called.
147    bool is_system_ready = 13;
148    // True if auto-suspend mode is enabled.
149    bool is_hal_auto_suspend_mode_enabled = 14;
150    // True if interactive mode is enabled.
151    bool is_hal_auto_interactive_mode_enabled = 15;
152    // Summarizes the state of all active wakelocks.
153    ActiveWakeLocksProto active_wake_locks = 16;
154    // Have we scheduled a message to check for long wake locks?  This is when
155    // we will check. (In milliseconds timestamp)
156    int64 notify_long_scheduled_ms = 17;
157    // Last time we checked for long wake locks. (In milliseconds timestamp)
158    int64 notify_long_dispatched_ms = 18;
159    // The time we decided to do next long check. (In milliseconds timestamp)
160    int64 notify_long_next_check_ms = 19;
161    // Summarizes the effect of the user activity timer.
162    UserActivityProto user_activity = 20;
163    // If true, instructs the display controller to wait for the proximity
164    // sensor to go negative before turning the screen on.
165    bool is_request_wait_for_negative_proximity = 21;
166    // True if MSG_SANDMAN has been scheduled.
167    bool is_sandman_scheduled = 22;
168    // True if the sandman has just been summoned for the first time since entering
169    // the dreaming or dozing state.  Indicates whether a new dream should begin.
170    bool is_sandman_summoned = 23;
171    // If true, the device is in low power mode.
172    bool is_low_power_mode_enabled = 24;
173    // True if the battery level is currently considered low.
174    bool is_battery_level_low = 25;
175    // True if we are currently in light device idle mode.
176    bool is_light_device_idle_mode = 26;
177    // True if we are currently in device idle mode.
178    bool is_device_idle_mode = 27;
179    // Set of app ids that we will always respect the wake locks for.
180    repeated int32 device_idle_whitelist = 28;
181    // Set of app ids that are temporarily allowed to acquire wakelocks due to
182    // high-pri message
183    repeated int32 device_idle_temp_whitelist = 29;
184    // Timestamp of the last time the device was awoken.
185    int64 last_wake_time_ms = 30;
186    // Timestamp of the last time the device was put to sleep.
187    int64 last_sleep_time_ms = 31;
188    // Timestamp of the last call to user activity.
189    int64 last_user_activity_time_ms = 32;
190    int64 last_user_activity_time_no_change_lights_ms = 33;
191    // Timestamp of last interactive power hint.
192    int64 last_interactive_power_hint_time_ms = 34;
193    // Timestamp of the last screen brightness boost.
194    int64 last_screen_brightness_boost_time_ms = 35;
195    // True if screen brightness boost is in progress.
196    bool is_screen_brightness_boost_in_progress = 36;
197    // True if the display power state has been fully applied, which means the
198    // display is actually on or actually off or whatever was requested.
199    bool is_display_ready = 37;
200    // True if the wake lock suspend blocker has been acquired.
201    bool is_holding_wake_lock_suspend_blocker = 38;
202    // The suspend blocker used to keep the CPU alive when the display is on, the
203    // display is getting ready or there is user activity (in which case the
204    // display must be on).
205    bool is_holding_display_suspend_blocker = 39;
206    // Settings and configuration
207    PowerServiceSettingsAndConfigurationDumpProto settings_and_configuration = 40;
208    // Sleep timeout in ms
209    sint32 sleep_timeout_ms = 41;
210    // Screen off timeout in ms
211    int32 screen_off_timeout_ms = 42;
212    // Screen dim duration in ms
213    int32 screen_dim_duration_ms = 43;
214    // We are currently in the middle of a batch change of uids.
215    bool are_uids_changing = 44;
216    // Some uids have actually changed while mUidsChanging was true.
217    bool are_uids_changed = 45;
218    // List of UIDs and their states
219    repeated UidProto uids = 46;
220    android.os.LooperProto looper = 47;
221    // List of all wake locks acquired by applications.
222    repeated WakeLockProto wake_locks = 48;
223    // List of all suspend blockers.
224    repeated SuspendBlockerProto suspend_blockers = 49;
225    WirelessChargerDetectorProto wireless_charger_detector = 50;
226}
227
228message SuspendBlockerProto {
229    string name = 1;
230    int32 reference_count = 2;
231}
232
233message WakeLockProto {
234    message WakeLockFlagsProto {
235        // Turn the screen on when the wake lock is acquired.
236        bool is_acquire_causes_wakeup = 1;
237        // When this wake lock is released, poke the user activity timer
238        // so the screen stays on for a little longer.
239        bool is_on_after_release = 2;
240    }
241
242    // Enum values gotten from PowerManager.java
243    enum LockLevel {
244        WAKE_LOCK_INVALID = 0;
245        // Ensures that the CPU is running.
246        PARTIAL_WAKE_LOCK = 1;
247        // Ensures that the screen is on (but may be dimmed).
248        SCREEN_DIM_WAKE_LOCK = 6;
249        // Ensures that the screen is on at full brightness.
250        SCREEN_BRIGHT_WAKE_LOCK = 10;
251        // Ensures that the screen and keyboard backlight are on at full brightness.
252        FULL_WAKE_LOCK = 26;
253        // Turns the screen off when the proximity sensor activates.
254        PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
255        // Put the screen in a low power state and allow the CPU to suspend
256        // if no other wake locks are held.
257        DOZE_WAKE_LOCK = 64;
258        // Keep the device awake enough to allow drawing to occur.
259        DRAW_WAKE_LOCK = 128;
260    }
261
262    LockLevel lock_level = 1;
263    string tag = 2;
264    WakeLockFlagsProto flags = 3;
265    bool is_disabled = 4;
266    // Acquire time in ms
267    int64 acq_ms = 5;
268    bool is_notified_long = 6;
269    // Owner UID
270    int32 uid = 7;
271    // Owner PID
272    int32 pid = 8;
273    android.os.WorkSourceProto work_source = 9;
274}
275
276message PowerServiceSettingsAndConfigurationDumpProto {
277    message StayOnWhilePluggedInProto {
278        bool is_stay_on_while_plugged_in_ac = 1;
279        bool is_stay_on_while_plugged_in_usb = 2;
280        bool is_stay_on_while_plugged_in_wireless = 3;
281    }
282    message ScreenBrightnessSettingLimitsProto {
283        int32 setting_minimum = 1;
284        int32 setting_maximum = 2;
285        int32 setting_default = 3;
286        int32 setting_for_vr_default = 4;
287    }
288
289    // Enum values gotten from Settings.java
290    enum ScreenBrightnessMode {
291        SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
292        SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
293    }
294    // Enum values gotten from Display.java
295    enum DisplayState {
296        DISPLAY_STATE_UNKNOWN = 0;
297        DISPLAY_STATE_OFF = 1;
298        DISPLAY_STATE_ON = 2;
299        DISPLAY_STATE_DOZE = 3;
300        DISPLAY_STATE_DOZE_SUSPEND = 4;
301        DISPLAY_STATE_VR = 5;
302    }
303
304
305    // True to decouple auto-suspend mode from the display state.
306    bool is_decouple_hal_auto_suspend_mode_from_display_config = 1;
307    // True to decouple interactive mode from the display state.
308    bool is_decouple_hal_interactive_mode_from_display_config = 2;
309    // True if the device should wake up when plugged or unplugged.
310    bool is_wake_up_when_plugged_or_unplugged_config = 3;
311    // True if the device should wake up when plugged or unplugged in theater mode.
312    bool is_wake_up_when_plugged_or_unplugged_in_theater_mode_config = 4;
313    // True if theater mode is enabled
314    bool is_theater_mode_enabled = 5;
315    // True if the device should suspend when the screen is off due to proximity.
316    bool is_suspend_when_screen_off_due_to_proximity_config = 6;
317    // True if dreams are supported on this device.
318    bool are_dreams_supported_config = 7;
319    // Default value for dreams enabled
320    bool are_dreams_enabled_by_default_config = 8;
321    // Default value for dreams activate-on-sleep
322    bool are_dreams_activated_on_sleep_by_default_config = 9;
323    // Default value for dreams activate-on-dock
324    bool are_dreams_activated_on_dock_by_default_config = 10;
325    // True if dreams can run while not plugged in.
326    bool are_dreams_enabled_on_battery_config = 11;
327    // Minimum battery level to allow dreaming when powered.
328    // Use -1 to disable this safety feature.
329    sint32 dreams_battery_level_minimum_when_powered_config = 12;
330    // Minimum battery level to allow dreaming when not powered.
331    // Use -1 to disable this safety feature.
332    sint32 dreams_battery_level_minimum_when_not_powered_config = 13;
333    // If the battery level drops by this percentage and the user activity
334    // timeout has expired, then assume the device is receiving insufficient
335    // current to charge effectively and terminate the dream.  Use -1 to disable
336    // this safety feature.
337    sint32 dreams_battery_level_drain_cutoff_config = 14;
338    // True if dreams are enabled by the user.
339    bool are_dreams_enabled_setting = 15;
340    // True if dreams should be activated on sleep.
341    bool are_dreams_activate_on_sleep_setting = 16;
342    // True if dreams should be activated on dock.
343    bool are_dreams_activate_on_dock_setting = 17;
344    // True if doze should not be started until after the screen off transition.
345    bool is_doze_after_screen_off_config = 18;
346    // If true, the device is in low power mode.
347    bool is_low_power_mode_setting = 19;
348    // Current state of whether the settings are allowing auto low power mode.
349    bool is_auto_low_power_mode_configured = 20;
350    // The user turned off low power mode below the trigger level
351    bool is_auto_low_power_mode_snoozing = 21;
352    // The minimum screen off timeout, in milliseconds.
353    int32 minimum_screen_off_timeout_config_ms = 22;
354    // The screen dim duration, in milliseconds.
355    int32 maximum_screen_dim_duration_config_ms = 23;
356    // The maximum screen dim time expressed as a ratio relative to the screen off timeout.
357    float maximum_screen_dim_ratio_config = 24;
358    // The screen off timeout setting value in milliseconds.
359    int32 screen_off_timeout_setting_ms = 25;
360    // The sleep timeout setting value in milliseconds.
361    sint32 sleep_timeout_setting_ms = 26;
362    // The maximum allowable screen off timeout according to the device administration policy.
363    int32 maximum_screen_off_timeout_from_device_admin_ms = 27;
364    bool is_maximum_screen_off_timeout_from_device_admin_enforced_locked = 28;
365    // The stay on while plugged in setting.
366    // A set of battery conditions under which to make the screen stay on.
367    StayOnWhilePluggedInProto stay_on_while_plugged_in = 29;
368    // The screen brightness setting, from 0 to 255.
369    // Use -1 if no value has been set.
370    sint32 screen_brightness_setting = 30;
371    // The screen auto-brightness adjustment setting, from -1 to 1.
372    // Use 0 if there is no adjustment.
373    float screen_auto_brightness_adjustment_setting = 31;
374    // The screen brightness mode.
375    ScreenBrightnessMode screen_brightness_mode_setting = 32;
376    // The screen brightness setting override from the window manager
377    // to allow the current foreground activity to override the brightness.
378    // Use -1 to disable.
379    sint32 screen_brightness_override_from_window_manager = 33;
380    // The user activity timeout override from the window manager
381    // to allow the current foreground activity to override the user activity
382    // timeout. Use -1 to disable.
383    sint64 user_activity_timeout_override_from_window_manager_ms = 34;
384    // The window manager has determined the user to be inactive via other means.
385    // Set this to false to disable.
386    bool is_user_inactive_override_from_window_manager = 35;
387    // The screen brightness setting override from the settings application
388    // to temporarily adjust the brightness until next updated,
389    // Use -1 to disable.
390    sint32 temporary_screen_brightness_setting_override = 36;
391    // The screen brightness adjustment setting override from the settings
392    // application to temporarily adjust the auto-brightness adjustment factor
393    // until next updated, in the range -1..1.
394    // Use NaN to disable.
395    float temporary_screen_auto_brightness_adjustment_setting_override = 37;
396    // The screen state to use while dozing.
397    DisplayState doze_screen_state_override_from_dream_manager = 38;
398    // The screen brightness to use while dozing.
399    float dozed_screen_brightness_override_from_dream_manager = 39;
400    // Screen brightness settings limits.
401    ScreenBrightnessSettingLimitsProto screen_brightness_setting_limits = 40;
402    // The screen brightness setting, from 0 to 255, to be used while in VR Mode.
403    int32 screen_brightness_for_vr_setting = 41;
404    // True if double tap to wake is enabled
405    bool is_double_tap_wake_enabled = 42;
406    // True if we are currently in VR Mode.
407    bool is_vr_mode_enabled = 43;
408}
409