blob: cc4b1308d25ef160ead31770d3b04b0ebddfc565 [file] [log] [blame]
Wei Wang61c2a332020-01-08 16:51:47 -08001/*
2 * Copyright (C) 2020 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
17package android.hardware.power;
18
19@VintfStability
20@Backing(type="int")
21enum Mode {
22 /**
23 * This mode indicates that the device is to allow wake up when the
24 * screen is tapped twice.
25 */
26 DOUBLE_TAP_TO_WAKE,
27
28 /**
Wei Wang0cbdab72020-02-07 11:45:52 -080029 * This mode indicates Low power mode is activated or not. Low power
Wei Wang61c2a332020-01-08 16:51:47 -080030 * mode is intended to save battery at the cost of performance.
31 */
32 LOW_POWER,
33
34 /**
Wei Wang0cbdab72020-02-07 11:45:52 -080035 * This mode indicates Sustained Performance mode is activated or not.
Wei Wang61c2a332020-01-08 16:51:47 -080036 * Sustained performance mode is intended to provide a consistent level of
37 * performance for a prolonged amount of time.
38 */
39 SUSTAINED_PERFORMANCE,
40
41 /**
Dan Stozacca80272020-01-13 13:06:13 -080042 * Sets the device to a fixed performance level which can be sustained under
43 * normal indoor conditions for at least 10 minutes.
44 *
45 * This is similar to sustained performance mode, except that whereas
46 * sustained performance mode puts an upper bound on performance in the
47 * interest of long-term stability, fixed performance mode puts both upper
48 * and lower bounds on performance such that any workload run while in a
49 * fixed performance mode should complete in a repeatable amount of time
50 * (except if the device is under thermal throttling).
51 *
52 * This mode is not intended for general purpose use, but rather to enable
53 * games and other performance-sensitive applications to reduce the number
54 * of variables during profiling and performance debugging. As such, while
55 * it is valid to set the device to minimum clocks for all subsystems in
56 * this mode, it is preferable to attempt to make the relative performance
57 * of the CPU, GPU, and other subsystems match typical usage, even if the
58 * frequencies have to be reduced to provide sustainability.
59 *
60 * To calibrate this mode, follow these steps:
61 *
62 * 1) Build and push the HWUI macrobench as described in
63 * //frameworks/base/libs/hwui/tests/macrobench/how_to_run.txt
64 * 2) Run the macrobench as follows:
65 * while true; do \
66 * adb shell /data/benchmarktest/hwuimacro/hwuimacro shadowgrid2 -c 200 -r 10; \
67 * done
68 * 3) Determine a fixed set of device clocks such that the loop in (2) can
69 * run for at least 10 minutes, starting from an idle device on a desk
70 * at room temperature (roughly 22 Celsius), without hitting thermal
71 * throttling.
72 * 4) After setting those clocks, set the system property
73 * ro.power.fixed_performance_scale_factor to a value N, where N is the
74 * number of times the loop from (2) runs during the 10 minute test
75 * cycle. It is expected that in FIXED_PERFORMANCE mode, unless there is
76 * thermal throttling, the loop will run N to N+1 times (inclusive).
77 *
78 * After calibrating this, while in FIXED_PERFORMANCE mode, the macrobench
79 * results obtained while running the loop in (2) should be consistent both
80 * within a given run and from the first run in the 10 minute window through
81 * the last run in the window.
82 */
83 FIXED_PERFORMANCE,
84
85 /**
Wei Wang0cbdab72020-02-07 11:45:52 -080086 * This mode indicates VR Mode is activated or not. VR mode is intended
Wei Wang61c2a332020-01-08 16:51:47 -080087 * to provide minimum guarantee for performance for the amount of time the
88 * device can sustain it.
89 */
90 VR,
91
92 /**
93 * This mode indicates that an application has been launched.
94 */
95 LAUNCH,
96
97 /**
98 * This mode indicates that the device is about to enter a period of
99 * expensive rendering.
100 */
101 EXPENSIVE_RENDERING,
102
103 /**
104 * This mode indicates that the device is about entering/leaving
105 * interactive state. (that is, the system is awake and ready for
106 * interaction, often with UI devices such as display and touchscreen
107 * enabled) or non-interactive state (the
108 * system appears asleep, display usually turned off). The
109 * non-interactive state may be entered after a period of
110 * inactivity in order to conserve battery power during
111 * such inactive periods.
112 *
113 * Typical actions are to turn on or off devices and adjust
114 * cpufreq parameters. This function may also call the
115 * appropriate interfaces to allow the kernel to suspend the
116 * system to low-power sleep state when entering non-interactive
117 * state, and to disallow low-power suspend when the system is in
118 * interactive state. When low-power suspend state is allowed, the
119 * kernel may suspend the system whenever no wakelocks are held.
120 */
121 INTERACTIVE,
122
Wei Wang0cbdab72020-02-07 11:45:52 -0800123 /**
124 * This mode indicates the device is in device idle, externally known as doze.
125 * More details on:
126 * https://developer.android.com/training/monitoring-device-state/doze-standby
127 */
128 DEVICE_IDLE,
129
130 /**
131 * This mode indicates that display is either off or still on but is optimized
132 * for low-power.
133 */
134 DISPLAY_INACTIVE,
Wei Wang61c2a332020-01-08 16:51:47 -0800135
136 /**
137 * Below hints are currently not sent in Android framework but OEM might choose to
138 * implement for power/perf optimizations.
139 */
140
141 /**
142 * This mode indicates that low latency audio is active.
143 */
144 AUDIO_STREAMING_LOW_LATENCY,
145
146 /**
147 * This hint indicates that camera secure stream is being started.
148 */
149 CAMERA_STREAMING_SECURE,
150
151 /**
152 * This hint indicates that camera low resolution stream is being started.
153 */
154 CAMERA_STREAMING_LOW,
155
156 /**
157 * This hint indicates that camera mid resolution stream is being started.
158 */
159 CAMERA_STREAMING_MID,
160
161 /**
162 * This hint indicates that camera high resolution stream is being started.
163 */
164 CAMERA_STREAMING_HIGH,
Jim Blackler7e54e602021-11-17 16:39:37 +0000165
166 /**
Wei Wangae386342022-01-13 16:14:17 -0800167 * This mode indicates that user is playing a game.
168 */
169 GAME,
170
171 /**
Jim Blackler7e54e602021-11-17 16:39:37 +0000172 * This mode indicates that the user is waiting for loading in a game.
173 */
174 GAME_LOADING,
Wei Wang61c2a332020-01-08 16:51:47 -0800175}