xref: /aosp_15_r20/hardware/libhardware_legacy/include/hardware_legacy/power.h (revision 79330504eb3d14022296e3b041867f86289dd52c)
1*79330504STreehugger Robot /*
2*79330504STreehugger Robot  * Copyright (C) 2008 The Android Open Source Project
3*79330504STreehugger Robot  *
4*79330504STreehugger Robot  * Licensed under the Apache License, Version 2.0 (the "License");
5*79330504STreehugger Robot  * you may not use this file except in compliance with the License.
6*79330504STreehugger Robot  * You may obtain a copy of the License at
7*79330504STreehugger Robot  *
8*79330504STreehugger Robot  *      http://www.apache.org/licenses/LICENSE-2.0
9*79330504STreehugger Robot  *
10*79330504STreehugger Robot  * Unless required by applicable law or agreed to in writing, software
11*79330504STreehugger Robot  * distributed under the License is distributed on an "AS IS" BASIS,
12*79330504STreehugger Robot  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*79330504STreehugger Robot  * See the License for the specific language governing permissions and
14*79330504STreehugger Robot  * limitations under the License.
15*79330504STreehugger Robot  */
16*79330504STreehugger Robot 
17*79330504STreehugger Robot #ifndef _HARDWARE_POWER_H
18*79330504STreehugger Robot #define _HARDWARE_POWER_H
19*79330504STreehugger Robot 
20*79330504STreehugger Robot #include <stdint.h>
21*79330504STreehugger Robot 
22*79330504STreehugger Robot #if __cplusplus
23*79330504STreehugger Robot extern "C" {
24*79330504STreehugger Robot #endif
25*79330504STreehugger Robot 
26*79330504STreehugger Robot enum {
27*79330504STreehugger Robot     PARTIAL_WAKE_LOCK = 1,  // the cpu stays on, but the screen is off
28*79330504STreehugger Robot     FULL_WAKE_LOCK = 2      // the screen is also on
29*79330504STreehugger Robot };
30*79330504STreehugger Robot 
31*79330504STreehugger Robot // while you have a lock held, the device will stay on at least at the
32*79330504STreehugger Robot // level you request.
33*79330504STreehugger Robot int acquire_wake_lock(int lock, const char* id);
34*79330504STreehugger Robot int release_wake_lock(const char* id);
35*79330504STreehugger Robot 
36*79330504STreehugger Robot 
37*79330504STreehugger Robot #if __cplusplus
38*79330504STreehugger Robot } // extern "C"
39*79330504STreehugger Robot #endif
40*79330504STreehugger Robot 
41*79330504STreehugger Robot #endif // _HARDWARE_POWER_H
42