private PowerManager.WakeLock sCpuWakeLock;
private void acquireCpuWakeLock(Context context) {
if (sCpuWakeLock != null) {
return;
}
Log.v(TAG3, "acquireCpuWakeLock");
sCpuWakeLock = createPartialWakeLock(context);
sCpuWakeLock.acquire();
}
private PowerManager.WakeLock createPartialWakeLock(Context context) {
Log.v(TAG3, "createPartialWakeLock");
String flag = "log";
PowerManager pm = (PowerManager) context
.getSystemService(Context.POWER_SERVICE);
return pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, flag);
}
public void releaseCpuLock() {
if (sCpuWakeLock != null) {
Log.v(TAG3, "releaseCpuLock");
sCpuWakeLock.release();
sCpuWakeLock = null;
}
}