Stuck partial wake locks Android

I recently updated my game to use SDL2 for platform support, since converting my game there have been two new issues one being stuck partial wake locks. Does SDL2 use wake locks anywhere?

I’m pretty sure this is caused by my audio library but wanted to see if SDL2 has them anywhere…

“API that lets developers keep the CPU running after a device’s display turns off (whether due to system timeout or the user pressing the power button). Your app acquires a partial wake lock by calling acquire() with the PARTIAL_WAKE_LOCK flag.”

Via Android Vitals in the Play Store apparently 1.5% of my players are experiencing this: “Percentage of battery sessions during which users experienced at least one partial wake lock of more than one hour while the app was in the background.”

This issue also affects me: Android Vitals reports ~0.15% Stuck partial wake locks (background). Although it seems low, it appears to be quite important and my apps are in the 5% bottom for this criteria.

If I look at this measure by device, affected devices are mostly “Sony Xperia”.

did any one managed to solve it?
is there a way to halt the sdl mixer thread(if it have one) when app in background? if i knew where it loops i would try it

I found and solved the wake locks for myself, it was not SDL or any of my code, it was hilariously Google Analytics causing the issue. Flurry requires GA, so once I removed Flurry I didn’t need GA anymore so I removed it as well.

I searched the manifest, turns out Google Analytics brings them in, which I added to use Flurry. I have searched regarding this and some people have said that simply forcing the removal of the wake lock permission fixed it and everything worked, others reported that it caused random app crashing if the permission is removed. I didn’t want to risk crashing and can live without analytics and Flurry so I simply removed them.

<!-- Optional permission for Analytics to run. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />

thanks for the info, unfortunately i removed the wakelock permission from the manifest and confirmed that the compiled apk does not have that permission in it and still google play dashboard reports stuck partial wake locks background issues.

google docs mentioned that it happen only due to wake lock permission so i was sure that removing it would solve it.

is there any other way to solve this?

Are you only looking at the version you think is fixed? People with old versions will report wakelocks until they are updated, some never update, so there will always be some.

im segmenting the latest build version which is 10 days old.

can general android api such as alarm manager can hold a wake lock to run onReceive even if its removed from the manifest? i suspect it might be related to it.