am 401d93f0: Merge "Use libsuspend to trigger suspend" into jb-dev
* commit '401d93f0dbc21673316ebccae2fdaaf84f5169cd': Use libsuspend to trigger suspend
This commit is contained in:
@@ -218,6 +218,7 @@ LOCAL_SHARED_LIBRARIES := \
|
||||
libusbhost \
|
||||
libharfbuzz \
|
||||
libz \
|
||||
libsuspend \
|
||||
|
||||
ifeq ($(USE_OPENGL_RENDERER),true)
|
||||
LOCAL_SHARED_LIBRARIES += libhwui
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <hardware/power.h>
|
||||
#include <hardware_legacy/power.h>
|
||||
#include <cutils/android_reboot.h>
|
||||
#include <suspend/autosuspend.h>
|
||||
|
||||
static struct power_module *sPowerModule;
|
||||
|
||||
@@ -70,8 +71,14 @@ setLastUserActivityTimeout(JNIEnv *env, jobject clazz, jlong timeMS)
|
||||
static int
|
||||
setScreenState(JNIEnv *env, jobject clazz, jboolean on)
|
||||
{
|
||||
if (sPowerModule)
|
||||
sPowerModule->setInteractive(sPowerModule, on);
|
||||
if (on) {
|
||||
autosuspend_disable();
|
||||
sPowerModule->setInteractive(sPowerModule, true);
|
||||
} else {
|
||||
sPowerModule->setInteractive(sPowerModule, false);
|
||||
autosuspend_enable();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user