This CL implements a simple force_suspend(). This function takes a
timeoutMs argument that is currently ignored. It also uses a two-stage
init process that spawns the suspend_thread when autosuspend is in use.
Follow-up CLs will:
- Implement file locking to prevent multiple libsuspend instances from
starting multiple suspend threads in the system.
- Fully implement timout for force_suspend.
- Integrate force_suspend with suspend_thred.
Bug: 70669809
Test: autosuspend still works
Change-Id: I6b2c72d0c61d1bec6db0f0b28481ffe0e20ec615
autosleep and earlysuspend are long-deprecated, so remove them to make
libsuspend slightly more comprehensible.
Test: builds and still suspends on marlin
bug 32621856
Change-Id: I66a904c3fce0111fb5e9d1ab9d205c97617ae210
Should use android/log.h instead of cutils/log.h as a good example
to all others. Adjust header order to comply with Android Coding
standards.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
Use the wakeup count interface for requesting suspend, instead of
autosleep, to allow userspace to collect stats on suspend/resume
activity.
Change-Id: I44b5ef031b2bdc5b09c904fb2adbbe16370c2984
Prevents possible SIGSEGV on second autosuspend_enable attempt when
first intialization attempt fails. autosuspend_inited should only
be set once autosuspend_ops has been assigned.
Consider the first call to autosuspend_enable().
autosuspend_init() sets its inited flag to true, and attempts to
set autosuspend_ops. If all the other autosuspend_*_init() attempts
fail, autosuspend_init() returns -1, which autosuspend_enable()
will return as a failure. A second call to autosuspend_enable()
will check autosuspend_init() and see that autosuspend has already
been initialized. It will attempt to access autosuspend_ops, which
were not set in the first initialization attempt, causing a SIGSEGV.
Change-Id: Ib2d3ee62fee4c3b6d0323e5b7f3709a23c6b923f
libsuspend provides functions autosuspend_enable() and
autosuspend_disable() to trigger suspend on a variety of different
kernels.
Change-Id: I5dc28fb51532fa7c514330f1cfde7698d31d734c