private static void releaseWakeLock(Integer wakeLockId) { if (wakeLockId != null) { TracingWakeLock wl = wakeLocks.remove(wakeLockId); if (wl != null) { if (Secure9.DEBUG) Log.v(Secure9.LOG_TAG, "CoreReceiver Releasing wakeLock " + wakeLockId); wl.release(); } else { Log.w(Secure9.LOG_TAG, "BootReceiver WakeLock " + wakeLockId + " doesn't exist"); } } }
private static Integer getWakeLock(Context context) { TracingPowerManager pm = TracingPowerManager.getPowerManager(context); TracingWakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "CoreReceiver getWakeLock"); wakeLock.setReferenceCounted(false); wakeLock.acquire(Secure9.BOOT_RECEIVER_WAKE_LOCK_TIMEOUT); Integer tmpWakeLockId = wakeLockSeq.getAndIncrement(); wakeLocks.put(tmpWakeLockId, wakeLock); if (Secure9.DEBUG) Log.v(Secure9.LOG_TAG, "CoreReceiver Created wakeLock " + tmpWakeLockId); return tmpWakeLockId; }