Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 401d93f0 authored by Colin Cross's avatar Colin Cross Committed by Android (Google) Code Review
Browse files

Merge "Use libsuspend to trigger suspend" into jb-dev

parents 8e11051a 51d81f3c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ LOCAL_SHARED_LIBRARIES := \
	libusbhost \
	libharfbuzz \
	libz \
	libsuspend \

ifeq ($(USE_OPENGL_RENDERER),true)
	LOCAL_SHARED_LIBRARIES += libhwui
+9 −2
Original line number Diff line number Diff line
@@ -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;
}