| /* |
| * Copyright (C) 2017 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| syntax = "proto3"; |
| |
| package android.service.power; |
| |
| option java_multiple_files = true; |
| option java_outer_classname = "PowerServiceProto"; |
| |
| import "frameworks/base/core/proto/android/os/looper.proto"; |
| import "frameworks/base/core/proto/android/os/worksource.proto"; |
| import "frameworks/base/core/proto/android/service/wirelesschargerdetector.proto"; |
| |
| message PowerServiceDumpProto { |
| message ConstantsProto { |
| bool is_no_cached_wake_locks = 1; |
| } |
| message ActiveWakeLocksProto { |
| bool is_cpu = 1; |
| bool is_screen_bright = 2; |
| bool is_screen_dim = 3; |
| bool is_button_bright = 4; |
| bool is_proximity_screen_off = 5; |
| // only set if already awake |
| bool is_stay_awake = 6; |
| bool is_doze = 7; |
| bool is_draw = 8; |
| } |
| message UserActivityProto { |
| bool is_screen_bright = 1; |
| bool is_screen_dim = 2; |
| bool is_screen_dream = 3; |
| } |
| message UidProto { |
| // Enum values gotten from ActivityManager.java |
| enum ProcessState { |
| // Process is a persistent system process. |
| PROCESS_STATE_PERSISTENT = 0; |
| // Process is a persistent system process and is doing UI. |
| PROCESS_STATE_PERSISTENT_UI = 1; |
| // Process is hosting the current top activities. Note that this |
| // covers all activities that are visible to the user. |
| PROCESS_STATE_TOP = 2; |
| // Process is hosting a foreground service due to a system binding. |
| PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3; |
| // Process is hosting a foreground service. |
| PROCESS_STATE_FOREGROUND_SERVICE = 4; |
| // Same as {@link #PROCESS_STATE_TOP} but while device is sleeping. |
| PROCESS_STATE_TOP_SLEEPING = 5; |
| // Process is important to the user, and something they are aware of. |
| PROCESS_STATE_IMPORTANT_FOREGROUND = 6; |
| // Process is important to the user, but not something they are aware of. |
| PROCESS_STATE_IMPORTANT_BACKGROUND = 7; |
| // Process is in the background running a backup/restore operation. |
| PROCESS_STATE_BACKUP = 8; |
| // Process is in the background, but it can't restore its state so |
| // we want to try to avoid killing it. |
| PROCESS_STATE_HEAVY_WEIGHT = 9; |
| // Process is in the background running a service. |
| PROCESS_STATE_SERVICE = 10; |
| // Process is in the background running a receiver. |
| PROCESS_STATE_RECEIVER = 11; |
| // Process is in the background but hosts the home activity. |
| PROCESS_STATE_HOME = 12; |
| // Process is in the background but hosts the last shown activity. |
| PROCESS_STATE_LAST_ACTIVITY = 13; |
| // Process is being cached for later use and contains activities. |
| PROCESS_STATE_CACHED_ACTIVITY = 14; |
| // Process is being cached for later use and is a client of another |
| // cached process that contains activities. |
| PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15; |
| // Process is being cached for later use and is empty. |
| PROCESS_STATE_CACHED_EMPTY = 16; |
| // Process does not exist. |
| PROCESS_STATE_NONEXISTENT = 17; |
| } |
| int32 uid = 1; |
| string uid_string = 2; |
| bool is_active = 3; |
| int32 num_wake_locks = 4; |
| bool is_process_state_unknown = 5; |
| ProcessState process_state = 6; |
| } |
| |
| // Enum values gotten from PowerManagerInternal.java |
| enum Wakefulness { |
| WAKEFULNESS_ASLEEP = 0; |
| WAKEFULNESS_AWAKE = 1; |
| WAKEFULNESS_DREAMING = 2; |
| WAKEFULNESS_DOZING = 3; |
| WAKEFULNESS_UNKNOWN = 4; |
| } |
| // Enum values gotten from BatteryManager.java |
| enum PlugType { |
| PLUG_TYPE_NONE = 0; |
| PLUG_TYPE_PLUGGED_AC = 1; |
| PLUG_TYPE_PLUGGED_USB = 2; |
| PLUG_TYPE_PLUGGED_WIRELESS = 4; |
| } |
| // Enum values gotten from Intent.java |
| enum DockState { |
| DOCK_STATE_UNDOCKED = 0; |
| DOCK_STATE_DESK = 1; |
| DOCK_STATE_CAR = 2; |
| DOCK_STATE_LE_DESK = 3; |
| DOCK_STATE_HE_DESK = 4; |
| } |
| |
| ConstantsProto constants = 1; |
| // A bitfield that indicates what parts of the power state have |
| // changed and need to be recalculated. |
| int32 dirty = 2; |
| // Indicates whether the device is awake or asleep or somewhere in between. |
| Wakefulness wakefulness = 3; |
| bool is_wakefulness_changing = 4; |
| // True if the device is plugged into a power source. |
| bool is_powered = 5; |
| // The current plug type |
| PlugType plug_type = 6; |
| // The current battery level percentage. |
| int32 battery_level = 7; |
| // The battery level percentage at the time the dream started. |
| int32 battery_level_when_dream_started = 8; |
| // The current dock state. |
| DockState dock_state = 9; |
| // True if the device should stay on. |
| bool is_stay_on = 10; |
| // True if the proximity sensor reads a positive result. |
| bool is_proximity_positive = 11; |
| // True if boot completed occurred. We keep the screen on until this happens. |
| bool is_boot_completed = 12; |
| // True if systemReady() has been called. |
| bool is_system_ready = 13; |
| // True if auto-suspend mode is enabled. |
| bool is_hal_auto_suspend_mode_enabled = 14; |
| // True if interactive mode is enabled. |
| bool is_hal_auto_interactive_mode_enabled = 15; |
| // Summarizes the state of all active wakelocks. |
| ActiveWakeLocksProto active_wake_locks = 16; |
| // Have we scheduled a message to check for long wake locks? This is when |
| // we will check. (In milliseconds timestamp) |
| int64 notify_long_scheduled_ms = 17; |
| // Last time we checked for long wake locks. (In milliseconds timestamp) |
| int64 notify_long_dispatched_ms = 18; |
| // The time we decided to do next long check. (In milliseconds timestamp) |
| int64 notify_long_next_check_ms = 19; |
| // Summarizes the effect of the user activity timer. |
| UserActivityProto user_activity = 20; |
| // If true, instructs the display controller to wait for the proximity |
| // sensor to go negative before turning the screen on. |
| bool is_request_wait_for_negative_proximity = 21; |
| // True if MSG_SANDMAN has been scheduled. |
| bool is_sandman_scheduled = 22; |
| // True if the sandman has just been summoned for the first time since entering |
| // the dreaming or dozing state. Indicates whether a new dream should begin. |
| bool is_sandman_summoned = 23; |
| // If true, the device is in low power mode. |
| bool is_low_power_mode_enabled = 24; |
| // True if the battery level is currently considered low. |
| bool is_battery_level_low = 25; |
| // True if we are currently in light device idle mode. |
| bool is_light_device_idle_mode = 26; |
| // True if we are currently in device idle mode. |
| bool is_device_idle_mode = 27; |
| // Set of app ids that we will always respect the wake locks for. |
| repeated int32 device_idle_whitelist = 28; |
| // Set of app ids that are temporarily allowed to acquire wakelocks due to |
| // high-pri message |
| repeated int32 device_idle_temp_whitelist = 29; |
| // Timestamp of the last time the device was awoken. |
| int64 last_wake_time_ms = 30; |
| // Timestamp of the last time the device was put to sleep. |
| int64 last_sleep_time_ms = 31; |
| // Timestamp of the last call to user activity. |
| int64 last_user_activity_time_ms = 32; |
| int64 last_user_activity_time_no_change_lights_ms = 33; |
| // Timestamp of last interactive power hint. |
| int64 last_interactive_power_hint_time_ms = 34; |
| // Timestamp of the last screen brightness boost. |
| int64 last_screen_brightness_boost_time_ms = 35; |
| // True if screen brightness boost is in progress. |
| bool is_screen_brightness_boost_in_progress = 36; |
| // True if the display power state has been fully applied, which means the |
| // display is actually on or actually off or whatever was requested. |
| bool is_display_ready = 37; |
| // True if the wake lock suspend blocker has been acquired. |
| bool is_holding_wake_lock_suspend_blocker = 38; |
| // The suspend blocker used to keep the CPU alive when the display is on, the |
| // display is getting ready or there is user activity (in which case the |
| // display must be on). |
| bool is_holding_display_suspend_blocker = 39; |
| // Settings and configuration |
| PowerServiceSettingsAndConfigurationDumpProto settings_and_configuration = 40; |
| // Sleep timeout in ms |
| sint32 sleep_timeout_ms = 41; |
| // Screen off timeout in ms |
| int32 screen_off_timeout_ms = 42; |
| // Screen dim duration in ms |
| int32 screen_dim_duration_ms = 43; |
| // We are currently in the middle of a batch change of uids. |
| bool are_uids_changing = 44; |
| // Some uids have actually changed while mUidsChanging was true. |
| bool are_uids_changed = 45; |
| // List of UIDs and their states |
| repeated UidProto uids = 46; |
| android.os.LooperProto looper = 47; |
| // List of all wake locks acquired by applications. |
| repeated WakeLockProto wake_locks = 48; |
| // List of all suspend blockers. |
| repeated SuspendBlockerProto suspend_blockers = 49; |
| WirelessChargerDetectorProto wireless_charger_detector = 50; |
| } |
| |
| message SuspendBlockerProto { |
| string name = 1; |
| int32 reference_count = 2; |
| } |
| |
| message WakeLockProto { |
| message WakeLockFlagsProto { |
| // Turn the screen on when the wake lock is acquired. |
| bool is_acquire_causes_wakeup = 1; |
| // When this wake lock is released, poke the user activity timer |
| // so the screen stays on for a little longer. |
| bool is_on_after_release = 2; |
| } |
| |
| // Enum values gotten from PowerManager.java |
| enum LockLevel { |
| WAKE_LOCK_INVALID = 0; |
| // Ensures that the CPU is running. |
| PARTIAL_WAKE_LOCK = 1; |
| // Ensures that the screen is on (but may be dimmed). |
| SCREEN_DIM_WAKE_LOCK = 6; |
| // Ensures that the screen is on at full brightness. |
| SCREEN_BRIGHT_WAKE_LOCK = 10; |
| // Ensures that the screen and keyboard backlight are on at full brightness. |
| FULL_WAKE_LOCK = 26; |
| // Turns the screen off when the proximity sensor activates. |
| PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; |
| // Put the screen in a low power state and allow the CPU to suspend |
| // if no other wake locks are held. |
| DOZE_WAKE_LOCK = 64; |
| // Keep the device awake enough to allow drawing to occur. |
| DRAW_WAKE_LOCK = 128; |
| } |
| |
| LockLevel lock_level = 1; |
| string tag = 2; |
| WakeLockFlagsProto flags = 3; |
| bool is_disabled = 4; |
| // Acquire time in ms |
| int64 acq_ms = 5; |
| bool is_notified_long = 6; |
| // Owner UID |
| int32 uid = 7; |
| // Owner PID |
| int32 pid = 8; |
| android.os.WorkSourceProto work_source = 9; |
| } |
| |
| message PowerServiceSettingsAndConfigurationDumpProto { |
| message StayOnWhilePluggedInProto { |
| bool is_stay_on_while_plugged_in_ac = 1; |
| bool is_stay_on_while_plugged_in_usb = 2; |
| bool is_stay_on_while_plugged_in_wireless = 3; |
| } |
| message ScreenBrightnessSettingLimitsProto { |
| int32 setting_minimum = 1; |
| int32 setting_maximum = 2; |
| int32 setting_default = 3; |
| int32 setting_for_vr_default = 4; |
| } |
| |
| // Enum values gotten from Settings.java |
| enum ScreenBrightnessMode { |
| SCREEN_BRIGHTNESS_MODE_MANUAL = 0; |
| SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; |
| } |
| // Enum values gotten from Display.java |
| enum DisplayState { |
| DISPLAY_STATE_UNKNOWN = 0; |
| DISPLAY_STATE_OFF = 1; |
| DISPLAY_STATE_ON = 2; |
| DISPLAY_STATE_DOZE = 3; |
| DISPLAY_STATE_DOZE_SUSPEND = 4; |
| DISPLAY_STATE_VR = 5; |
| } |
| |
| |
| // True to decouple auto-suspend mode from the display state. |
| bool is_decouple_hal_auto_suspend_mode_from_display_config = 1; |
| // True to decouple interactive mode from the display state. |
| bool is_decouple_hal_interactive_mode_from_display_config = 2; |
| // True if the device should wake up when plugged or unplugged. |
| bool is_wake_up_when_plugged_or_unplugged_config = 3; |
| // True if the device should wake up when plugged or unplugged in theater mode. |
| bool is_wake_up_when_plugged_or_unplugged_in_theater_mode_config = 4; |
| // True if theater mode is enabled |
| bool is_theater_mode_enabled = 5; |
| // True if the device should suspend when the screen is off due to proximity. |
| bool is_suspend_when_screen_off_due_to_proximity_config = 6; |
| // True if dreams are supported on this device. |
| bool are_dreams_supported_config = 7; |
| // Default value for dreams enabled |
| bool are_dreams_enabled_by_default_config = 8; |
| // Default value for dreams activate-on-sleep |
| bool are_dreams_activated_on_sleep_by_default_config = 9; |
| // Default value for dreams activate-on-dock |
| bool are_dreams_activated_on_dock_by_default_config = 10; |
| // True if dreams can run while not plugged in. |
| bool are_dreams_enabled_on_battery_config = 11; |
| // Minimum battery level to allow dreaming when powered. |
| // Use -1 to disable this safety feature. |
| sint32 dreams_battery_level_minimum_when_powered_config = 12; |
| // Minimum battery level to allow dreaming when not powered. |
| // Use -1 to disable this safety feature. |
| sint32 dreams_battery_level_minimum_when_not_powered_config = 13; |
| // If the battery level drops by this percentage and the user activity |
| // timeout has expired, then assume the device is receiving insufficient |
| // current to charge effectively and terminate the dream. Use -1 to disable |
| // this safety feature. |
| sint32 dreams_battery_level_drain_cutoff_config = 14; |
| // True if dreams are enabled by the user. |
| bool are_dreams_enabled_setting = 15; |
| // True if dreams should be activated on sleep. |
| bool are_dreams_activate_on_sleep_setting = 16; |
| // True if dreams should be activated on dock. |
| bool are_dreams_activate_on_dock_setting = 17; |
| // True if doze should not be started until after the screen off transition. |
| bool is_doze_after_screen_off_config = 18; |
| // If true, the device is in low power mode. |
| bool is_low_power_mode_setting = 19; |
| // Current state of whether the settings are allowing auto low power mode. |
| bool is_auto_low_power_mode_configured = 20; |
| // The user turned off low power mode below the trigger level |
| bool is_auto_low_power_mode_snoozing = 21; |
| // The minimum screen off timeout, in milliseconds. |
| int32 minimum_screen_off_timeout_config_ms = 22; |
| // The screen dim duration, in milliseconds. |
| int32 maximum_screen_dim_duration_config_ms = 23; |
| // The maximum screen dim time expressed as a ratio relative to the screen off timeout. |
| float maximum_screen_dim_ratio_config = 24; |
| // The screen off timeout setting value in milliseconds. |
| int32 screen_off_timeout_setting_ms = 25; |
| // The sleep timeout setting value in milliseconds. |
| sint32 sleep_timeout_setting_ms = 26; |
| // The maximum allowable screen off timeout according to the device administration policy. |
| int32 maximum_screen_off_timeout_from_device_admin_ms = 27; |
| bool is_maximum_screen_off_timeout_from_device_admin_enforced_locked = 28; |
| // The stay on while plugged in setting. |
| // A set of battery conditions under which to make the screen stay on. |
| StayOnWhilePluggedInProto stay_on_while_plugged_in = 29; |
| // The screen brightness setting, from 0 to 255. |
| // Use -1 if no value has been set. |
| sint32 screen_brightness_setting = 30; |
| // The screen auto-brightness adjustment setting, from -1 to 1. |
| // Use 0 if there is no adjustment. |
| float screen_auto_brightness_adjustment_setting = 31; |
| // The screen brightness mode. |
| ScreenBrightnessMode screen_brightness_mode_setting = 32; |
| // The screen brightness setting override from the window manager |
| // to allow the current foreground activity to override the brightness. |
| // Use -1 to disable. |
| sint32 screen_brightness_override_from_window_manager = 33; |
| // The user activity timeout override from the window manager |
| // to allow the current foreground activity to override the user activity |
| // timeout. Use -1 to disable. |
| sint64 user_activity_timeout_override_from_window_manager_ms = 34; |
| // The window manager has determined the user to be inactive via other means. |
| // Set this to false to disable. |
| bool is_user_inactive_override_from_window_manager = 35; |
| // The screen brightness setting override from the settings application |
| // to temporarily adjust the brightness until next updated, |
| // Use -1 to disable. |
| sint32 temporary_screen_brightness_setting_override = 36; |
| // The screen brightness adjustment setting override from the settings |
| // application to temporarily adjust the auto-brightness adjustment factor |
| // until next updated, in the range -1..1. |
| // Use NaN to disable. |
| float temporary_screen_auto_brightness_adjustment_setting_override = 37; |
| // The screen state to use while dozing. |
| DisplayState doze_screen_state_override_from_dream_manager = 38; |
| // The screen brightness to use while dozing. |
| float dozed_screen_brightness_override_from_dream_manager = 39; |
| // Screen brightness settings limits. |
| ScreenBrightnessSettingLimitsProto screen_brightness_setting_limits = 40; |
| // The screen brightness setting, from 0 to 255, to be used while in VR Mode. |
| int32 screen_brightness_for_vr_setting = 41; |
| // True if double tap to wake is enabled |
| bool is_double_tap_wake_enabled = 42; |
| // True if we are currently in VR Mode. |
| bool is_vr_mode_enabled = 43; |
| } |