Monday, 9 November 2020

Stuck Partial Wake lock on session 0 - what does it mean and how to solve it

I have a "Music player" like application. it runs in a foreground service with notifications. It uses wake lock to keep listening to the volume buttons. Specific devices do not like this behavior and stops the wake lock onstart. I see on the android vitals that 99 percent of those wakelock rejection happens on session 0 - What does it mean? that those devices do not allow wake lock? The list is very diverse so I cannot blame it on specific manufacturer - mostly it is Huawei & oppo devices.

Galaxy A51 Galaxy J6 Huawei Y9 Prime 2019 Oppo A5 2020 Samsung Galaxy S10

This is how I get the wake lock

PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
serviceWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, powerTag);
serviceWakeLock.acquire();

I release the wakelock when the service finishes.

Is there a better way to keep listening to the volume buttons without using the wake lock?

Wakelock stops on session 0



from Stuck Partial Wake lock on session 0 - what does it mean and how to solve it

No comments:

Post a Comment