am 401d93f0: Merge "Use libsuspend to trigger suspend" into jb-dev

* commit '401d93f0dbc21673316ebccae2fdaaf84f5169cd':
  Use libsuspend to trigger suspend
This commit is contained in:
Colin Cross
2012-05-09 01:44:47 -07:00
committed by Android Git Automerger
2 changed files with 10 additions and 2 deletions

View File

@@ -218,6 +218,7 @@ LOCAL_SHARED_LIBRARIES := \
libusbhost \
libharfbuzz \
libz \
libsuspend \
ifeq ($(USE_OPENGL_RENDERER),true)
LOCAL_SHARED_LIBRARIES += libhwui

View File

@@ -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;
}