checkWakeLocks caught Exception when asleep

  • Replies:2
  • OpenNot stickiedUnanswered
  • Forum posts: 2

Nov 9, 2012 11:03:11 PM via Website

I have an app that calls a class from the receiver below. It works fine when the phone is awake, but as soon as it is put to sleep, it returns the following error from logcat: E/DeepSleepService(745): checkWakeLocks caught Exception /sys/power/active_wake_lock: open failed: ENOENT (No such file or directory)

I am testing on Android 4.0.4; DROID RAZR Build/6.7.2-180_DHD-16_M4-31

Here is the the receiver class:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.util.Log;

public class OnAlarmReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "wakelock");
context.startService(new Intent(context, Track.class));




Here is the AlarmAlertWakeLock class:
import android.content.Context;
import android.os.PowerManager;
import android.util.Log;

class AlarmAlertWakeLock {
private static PowerManager.WakeLock sCpuWakeLock;

static void acquireCpuWakeLock(Context context) {
if (sCpuWakeLock != null) {
PowerManager pm =
(PowerManager) context.getSystemService(Context.POWER_SERVICE);

sCpuWakeLock = pm.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, "AlarmAlertWakeLock");

static void releaseCpuLock() {
if (sCpuWakeLock != null) {
sCpuWakeLock = null;

I have registered the receiver and added permission in my manifest:
<uses-permission android:name="android.permission.WAKE_LOCK" />

<receiver android:name="com.myApp.OnAlarmReceiver"

Any idea what is causing this error when the phone is put to sleep, and how to fix?
  • Forum posts: 15

Dec 5, 2012 4:11:14 PM via Website

I really don't know.
  • Forum posts: 2

Dec 5, 2012 4:23:16 PM via Website

Nevermind. I fixed the problem by stopping the service when the phone went to sleep, and starting the service when it wakes.