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    BATTERY_HEALTH_FAIR = 8;
35    BATTERY_HEALTH_NOT_AVAILABLE = 11;
36    BATTERY_HEALTH_INCONSISTENT = 12;
37}
38
39// Plug states, primarily used by android/os/BatteryManager.java.
40enum BatteryPluggedStateEnum {
41    // Note that NONE is not in BatteryManager.java's constants.
42    BATTERY_PLUGGED_NONE = 0;
43    // Power source is an AC charger.
44    BATTERY_PLUGGED_AC = 1;
45    // Power source is a USB port.
46    BATTERY_PLUGGED_USB = 2;
47    // Power source is wireless.
48    BATTERY_PLUGGED_WIRELESS = 4;
49    // Power source is dock.
50    BATTERY_PLUGGED_DOCK = 8;
51}
52
53// These constants are defined in hardware/interfaces/health/1.0/types.hal
54// They are primarily used by android/os/BatteryManager.java.
55enum BatteryStatusEnum {
56    BATTERY_STATUS_INVALID = 0;
57    BATTERY_STATUS_UNKNOWN = 1;
58    BATTERY_STATUS_CHARGING = 2;
59    BATTERY_STATUS_DISCHARGING = 3;
60    BATTERY_STATUS_NOT_CHARGING = 4;
61    BATTERY_STATUS_FULL = 5;
62}
63
64enum PowerComponentEnum {
65    POWER_COMPONENT_SCREEN = 0;
66    POWER_COMPONENT_CPU = 1;
67    POWER_COMPONENT_BLUETOOTH = 2;
68    POWER_COMPONENT_CAMERA = 3;
69    POWER_COMPONENT_AUDIO = 4;
70    POWER_COMPONENT_VIDEO = 5;
71    POWER_COMPONENT_FLASHLIGHT = 6;
72    POWER_COMPONENT_SYSTEM_SERVICES = 7;
73    POWER_COMPONENT_MOBILE_RADIO = 8;
74    POWER_COMPONENT_SENSORS = 9;
75    POWER_COMPONENT_GNSS = 10;
76    POWER_COMPONENT_WIFI = 11;
77    POWER_COMPONENT_WAKELOCK = 12;
78    POWER_COMPONENT_MEMORY = 13;
79    POWER_COMPONENT_PHONE = 14;
80    POWER_COMPONENT_AMBIENT_DISPLAY = 15;
81    POWER_COMPONENT_IDLE = 16;
82    // Power that is re-attributed to other battery consumers. For example, for System Server
83    // this represents the power attributed to apps requesting system services.
84    // The value should be negative or zero.
85    POWER_COMPONENT_REATTRIBUTED_TO_OTHER_CONSUMERS = 17;
86}
87
88// These constants are defined in hardware/interfaces/thermal/1.0/types.hal
89// and in hardware/interfaces/thermal/2.0/types.hal
90// They are primarily used by android/os/HardwarePropertiesManager.java.
91// Any change to the types in the thermal hal should be made here as well.
92enum TemperatureTypeEnum {
93    TEMPERATURE_TYPE_UNKNOWN = -1;
94    TEMPERATURE_TYPE_CPU = 0;
95    TEMPERATURE_TYPE_GPU = 1;
96    TEMPERATURE_TYPE_BATTERY = 2;
97    TEMPERATURE_TYPE_SKIN = 3;
98    TEMPERATURE_TYPE_USB_PORT = 4;
99    TEMPERATURE_TYPE_POWER_AMPLIFIER = 5;
100
101    // Battery Charge Limit - virtual thermal sensors.
102    TEMPERATURE_TYPE_BCL_VOLTAGE = 6;
103    TEMPERATURE_TYPE_BCL_CURRENT = 7;
104    TEMPERATURE_TYPE_BCL_PERCENTAGE = 8;
105
106    // Neural Processing Unit.
107    TEMPERATURE_TYPE_NPU = 9;
108    TEMPERATURE_TYPE_TPU = 10;
109    TEMPERATURE_TYPE_DISPLAY = 11;
110    TEMPERATURE_TYPE_MODEM = 12;
111    TEMPERATURE_TYPE_SOC = 13;
112    TEMPERATURE_TYPE_WIFI = 14;
113    TEMPERATURE_TYPE_CAMERA = 15;
114    TEMPERATURE_TYPE_FLASHLIGHT = 16;
115    TEMPERATURE_TYPE_SPEAKER = 17;
116    TEMPERATURE_TYPE_AMBIENT = 18;
117    TEMPERATURE_TYPE_POGO = 19;
118}
119
120// Device throttling severity
121// These constants are defined in hardware/interfaces/thermal/2.0/types.hal.
122// Any change to the types in the thermal hal should be made here as well.
123enum ThrottlingSeverityEnum {
124    // Not under throttling.
125    NONE = 0;
126    // Light throttling where UX is not impacted.
127    LIGHT = 1;
128    // Moderate throttling where UX is not largely impacted.
129    MODERATE = 2;
130    // Severe throttling where UX is largely impacted.
131    // Similar to 1.0 throttlingThreshold.
132    SEVERE = 3;
133    // Platform has done everything to reduce power.
134    CRITICAL = 4;
135    // Key components in platform are shutting down due to thermal condition.
136    // Device functionalities will be limited.
137    EMERGENCY = 5;
138    // Need shutdown immediately.
139    SHUTDOWN = 6;
140};
141
142// Device cooling device types.
143// These constants are defined in hardware/interfaces/thermal/2.0/types.hal.
144// Any change to the types in the thermal hal should be made here as well.
145enum CoolingTypeEnum {
146    FAN = 0;
147    BATTERY = 1;
148    CPU = 2;
149    GPU = 3;
150    MODEM = 4;
151    NPU = 5;
152    COMPONENT = 6;
153    TPU = 7;
154    POWER_AMPLIFIER = 8;
155    DISPLAY = 9;
156    SPEAKER = 10;
157    WIFI = 11;
158    CAMERA = 12;
159    FLASHLIGHT = 13;
160    USB_PORT = 14;
161};
162
163// Wakelock types, primarily used by android/os/PowerManager.java.
164enum WakeLockLevelEnum {
165    // NOTE: Wake lock levels were previously defined as a bit field, except
166    // that only a few combinations were actually supported so the bit field
167    // was removed. This explains why the numbering scheme is so odd. If
168    // adding a new wake lock level, any unused value can be used.
169
170    // Ensures that the CPU is running; the screen and keyboard backlight
171    // will be allowed to go off.
172    PARTIAL_WAKE_LOCK = 1;
173
174    // Ensures that the screen is on (but may be dimmed); the keyboard
175    // backlight will be allowed to go off. If the user presses the power
176    // button, then the SCREEN_DIM_WAKE_LOCK will be implicitly released by
177    // the system, causing both the screen and the CPU to be turned off.
178    SCREEN_DIM_WAKE_LOCK = 6 [deprecated = true];
179
180    // Ensures that the screen is on at full brightness; the keyboard
181    // backlight will be allowed to go off. If the user presses the power
182    // button, then the SCREEN_BRIGHT_WAKE_LOCK will be implicitly released
183    // by the system, causing both the screen and the CPU to be turned off.
184    SCREEN_BRIGHT_WAKE_LOCK = 10 [deprecated = true];
185
186    // Ensures that the screen and keyboard backlight are on at full
187    // brightness. If the user presses the power button, then the
188    // FULL_WAKE_LOCK will be implicitly released by the system, causing
189    // both the screen and the CPU to be turned off.
190    FULL_WAKE_LOCK = 26 [deprecated = true];
191
192    // Turns the screen off when the proximity sensor activates. If the
193    // proximity sensor detects that an object is nearby, the screen turns
194    // off immediately. Shortly after the object moves away, the screen
195    // turns on again.
196    // A proximity wake lock does not prevent the device from falling asleep
197    // unlike FULL_WAKE_LOCK, SCREEN_BRIGHT_WAKE_LOCK and
198    // SCREEN_DIM_WAKE_LOCK. If there is no user activity and no other wake
199    // locks are held, then the device will fall asleep (and lock) as usual.
200    // However, the device will not fall asleep while the screen has been
201    // turned off by the proximity sensor because it effectively counts as
202    // ongoing user activity.
203    PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
204
205    // Put the screen in a low power state and allow the CPU to suspend if
206    // no other wake locks are held. This is used by the dream manager to
207    // implement doze mode. It currently has no effect unless the power
208    // manager is in the dozing state.
209    DOZE_WAKE_LOCK = 64;
210
211    // Keep the device awake enough to allow drawing to occur. This is used
212    // by the window manager to allow applications to draw while the system
213    // is dozing. It currently has no effect unless the power manager is in
214    // the dozing state.
215    DRAW_WAKE_LOCK = 128;
216
217    // Allow system service could override the current screen timeout
218    // according to the polcy.
219    SCREEN_TIMEOUT_OVERRIDE_WAKE_LOCK = 256;
220}
221
222// They are primarily used by android/os/BatteryManager.java.
223enum BatteryChargingStatusEnum {
224    BATTERY_STATUS_NORMAL = 1;
225    BATTERY_STATUS_TOO_COLD = 2;
226    BATTERY_STATUS_TOO_HOT = 3;
227    BATTERY_STATUS_LONG_LIFE = 4;
228    BATTERY_STATUS_ADAPTIVE = 5;
229}
230
231
232// They are primarily used by android/os/BatteryManager.java.
233enum BatteryChargingPolicyEnum {
234    CHARGING_POLICY_DEFAULT = 1;
235    CHARGING_POLICY_ADAPTIVE_AON = 2;
236    CHARGING_POLICY_ADAPTIVE_AC = 3;
237    CHARGING_POLICY_ADAPTIVE_LONGLIFE = 4;
238}
239