1/*
2 * Copyright (C) 2018 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 android.os;
19
20option java_outer_classname = "OsProtoEnums";
21option java_multiple_files = true;
22
23// These constants are defined in hardware/interfaces/health/1.0/types.hal
24// They are primarily used by android/os/BatteryManager.java.
25enum BatteryHealthEnum {
26    BATTERY_HEALTH_INVALID = 0;
27    BATTERY_HEALTH_UNKNOWN = 1;
28    BATTERY_HEALTH_GOOD = 2;
29    BATTERY_HEALTH_OVERHEAT = 3;
30    BATTERY_HEALTH_DEAD = 4;
31    BATTERY_HEALTH_OVER_VOLTAGE = 5;
32    BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6;
33    BATTERY_HEALTH_COLD = 7;
34}
35
36// Plug states, primarily used by android/os/BatteryManager.java.
37enum BatteryPluggedStateEnum {
38    // Note that NONE is not in BatteryManager.java's constants.
39    BATTERY_PLUGGED_NONE = 0;
40    // Power source is an AC charger.
41    BATTERY_PLUGGED_AC = 1;
42    // Power source is a USB port.
43    BATTERY_PLUGGED_USB = 2;
44    // Power source is wireless.
45    BATTERY_PLUGGED_WIRELESS = 4;
46}
47
48// These constants are defined in hardware/interfaces/health/1.0/types.hal
49// They are primarily used by android/os/BatteryManager.java.
50enum BatteryStatusEnum {
51    BATTERY_STATUS_INVALID = 0;
52    BATTERY_STATUS_UNKNOWN = 1;
53    BATTERY_STATUS_CHARGING = 2;
54    BATTERY_STATUS_DISCHARGING = 3;
55    BATTERY_STATUS_NOT_CHARGING = 4;
56    BATTERY_STATUS_FULL = 5;
57}
58
59// These constants are defined in hardware/interfaces/thermal/1.0/types.hal
60// and in hardware/interfaces/thermal/2.0/types.hal
61// They are primarily used by android/os/HardwarePropertiesManager.java.
62// Any change to the types in the thermal hal should be made here as well.
63enum TemperatureTypeEnum {
64    TEMPERATURE_TYPE_UNKNOWN = -1;
65    TEMPERATURE_TYPE_CPU = 0;
66    TEMPERATURE_TYPE_GPU = 1;
67    TEMPERATURE_TYPE_BATTERY = 2;
68    TEMPERATURE_TYPE_SKIN = 3;
69    TEMPERATURE_TYPE_USB_PORT = 4;
70    TEMPERATURE_TYPE_POWER_AMPLIFIER = 5;
71
72    // Battery Charge Limit - virtual thermal sensors.
73    TEMPERATURE_TYPE_BCL_VOLTAGE = 6;
74    TEMPERATURE_TYPE_BCL_CURRENT = 7;
75    TEMPERATURE_TYPE_BCL_PERCENTAGE = 8;
76
77    // Neural Processing Unit.
78    TEMPERATURE_TYPE_NPU = 9;
79}
80
81// Device throttling severity
82// These constants are defined in hardware/interfaces/thermal/2.0/types.hal.
83// Any change to the types in the thermal hal should be made here as well.
84enum ThrottlingSeverityEnum {
85    // Not under throttling.
86    NONE = 0;
87    // Light throttling where UX is not impacted.
88    LIGHT = 1;
89    // Moderate throttling where UX is not largely impacted.
90    MODERATE = 2;
91    // Severe throttling where UX is largely impacted.
92    // Similar to 1.0 throttlingThreshold.
93    SEVERE = 3;
94    // Platform has done everything to reduce power.
95    CRITICAL = 4;
96    // Key components in platform are shutting down due to thermal condition.
97    // Device functionalities will be limited.
98    EMERGENCY = 5;
99    // Need shutdown immediately.
100    SHUTDOWN = 6;
101};
102
103// Device cooling device types.
104// These constants are defined in hardware/interfaces/thermal/2.0/types.hal.
105// Any change to the types in the thermal hal should be made here as well.
106enum CoolingTypeEnum {
107    FAN = 0;
108    BATTERY = 1;
109    CPU = 2;
110    GPU = 3;
111    MODEM = 4;
112    NPU = 5;
113    COMPONENT = 6;
114};
115
116// Wakelock types, primarily used by android/os/PowerManager.java.
117enum WakeLockLevelEnum {
118    // NOTE: Wake lock levels were previously defined as a bit field, except
119    // that only a few combinations were actually supported so the bit field
120    // was removed. This explains why the numbering scheme is so odd. If
121    // adding a new wake lock level, any unused value can be used.
122
123    // Ensures that the CPU is running; the screen and keyboard backlight
124    // will be allowed to go off.
125    PARTIAL_WAKE_LOCK = 1;
126
127    // Ensures that the screen is on (but may be dimmed); the keyboard
128    // backlight will be allowed to go off. If the user presses the power
129    // button, then the SCREEN_DIM_WAKE_LOCK will be implicitly released by
130    // the system, causing both the screen and the CPU to be turned off.
131    SCREEN_DIM_WAKE_LOCK = 6 [deprecated = true];
132
133    // Ensures that the screen is on at full brightness; the keyboard
134    // backlight will be allowed to go off. If the user presses the power
135    // button, then the SCREEN_BRIGHT_WAKE_LOCK will be implicitly released
136    // by the system, causing both the screen and the CPU to be turned off.
137    SCREEN_BRIGHT_WAKE_LOCK = 10 [deprecated = true];
138
139    // Ensures that the screen and keyboard backlight are on at full
140    // brightness. If the user presses the power button, then the
141    // FULL_WAKE_LOCK will be implicitly released by the system, causing
142    // both the screen and the CPU to be turned off.
143    FULL_WAKE_LOCK = 26 [deprecated = true];
144
145    // Turns the screen off when the proximity sensor activates. If the
146    // proximity sensor detects that an object is nearby, the screen turns
147    // off immediately. Shortly after the object moves away, the screen
148    // turns on again.
149    // A proximity wake lock does not prevent the device from falling asleep
150    // unlike FULL_WAKE_LOCK, SCREEN_BRIGHT_WAKE_LOCK and
151    // SCREEN_DIM_WAKE_LOCK. If there is no user activity and no other wake
152    // locks are held, then the device will fall asleep (and lock) as usual.
153    // However, the device will not fall asleep while the screen has been
154    // turned off by the proximity sensor because it effectively counts as
155    // ongoing user activity.
156    PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
157
158    // Put the screen in a low power state and allow the CPU to suspend if
159    // no other wake locks are held. This is used by the dream manager to
160    // implement doze mode. It currently has no effect unless the power
161    // manager is in the dozing state.
162    DOZE_WAKE_LOCK = 64;
163
164    // Keep the device awake enough to allow drawing to occur. This is used
165    // by the window manager to allow applications to draw while the system
166    // is dozing. It currently has no effect unless the power manager is in
167    // the dozing state.
168    DRAW_WAKE_LOCK = 128;
169}
170