//先定义一个mWakeLock
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this
.getClass().getName());
//一直保持唤醒的话,就调用
mWakeLock.acquire();
//恢复正常睡眠
mWakeLock.release();
第二种比较简单,是通过adb命令实现的
在adb shell端,往/sys/power/wake_lock写进一个变量,就能让linux一直唤醒,黑屏也不会睡眠。
echo abc > /sys/power/wake_lock
关闭一直唤醒,把刚才的值写进/sys/power/wake_unlock即可
echo abc > /sys/power/wake_unlock



