Towing lock constantly throws exception on Nexus 5

We recently got a Nexus 5 for use as a test device. It is running Android 4.4.2. The problem is that it continuously throws the following exception in the form of a warning every 2-4 seconds:

01-02 22:33:33.482 751-894/? W/Binder๏น• Caught a RuntimeException from the binder stub implementation. java.lang.IllegalArgumentException: Wake lock not active at com.android.server.power.PowerManagerService.updateWakeLockWorkSourceInternal(PowerManagerService.java:794) at com.android.server.power.PowerManagerService.updateWakeLockWorkSource(PowerManagerService.java:780) at com.android.server.power.PowerManagerService.updateWakeLockUids(PowerManagerService.java:761) at android.os.IPowerManager$Stub.onTransact(IPowerManager.java:103) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method) 

No other phones we tested display the same warning (including Nexus 4 running 4.4.2)

We use permission WAKE_LOCK

 <uses-permission android:name="android.permission.WAKE_LOCK" /> 

for Google Cloud Messenger

I also made sure that this is happening in our application. The warning remains after filtering logcat by package name. It also stops as soon as you exit the application.

The main problem is that Android Studio is lagging after a while, so I need to clear logcat. Also, a runtime exception is not something that I just want to let lie. Any ideas why this is happening?

[change]
Here is the place where it is used in our code. It's just Google's GcmBroadcastReceiver

 public class GcmBroadcastReceiver extends WakefulBroadcastReceiver { public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Start the service, keeping the device awake while it is launching. startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK); } } 
+6
source share
2 answers

This may be the same issue as MediaPlayer. When I ask MediaPlayer to handle trace locks for me in my separate thread service, I get a Wake lock inactive every five seconds or so.

I found that this comes from the code I just copied from the sample code. If I throw an UnsupportedOperationException from the public IBinder onBind (intent intent), as in the example, I get the above exception. The intrusion lock is inactive every five seconds or so.

A simple solution is to return null instead of throwing an exception.

Hope this helps you.

0
source

I had the same error, but I call MediaPlayer.setVolume too often.

0
source

All Articles