Dave McLaughlin
Dave McLaughlin

Reputation: 41

How to enabled wake on touch as part of Android source code build?

I need to figure out how to enable wake on touch with Android source build.

At present the device is awoken with the power button similar to a mobile phone but I need to be able to do this from touch. Main power on is via the button but I need to wake it up with touch after it has gone to sleep after the preset time.

Doing cat /dev/input/event1 gives me data when the screen is touched, on or off so there is still power to the touch controller.

Anyone know if this can be done and if so, any pointers to the part of the OS that handles this?

Upvotes: 1

Views: 443

Answers (1)

shizhen
shizhen

Reputation: 12583

Try below code in your code.

WakeLock screenLock = ((PowerManager)getSystemService(POWER_SERVICE)).newWakeLock(
     PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "YOUR_TAG");
screenLock.acquire();

Upvotes: 0

Related Questions