Android Stuck Wake Lock

Previous topic - Next topic

MrPlow

Hi Guys

This might be usual info for some of you...
I was investigating the wakelocks for some of my busier apps - in the region of 2 - 3% of sessions have stuck wakelocks - Google bad behaviour allows for 0.10% so it's a problem and Google said it would affect store visibility if not addressed.

The main tag that seems to be the culprit is Audiomix (so sound and music) - possibly related to users switching jumping in and out of apps or due to adverts.

In order to try and fix this I modified some of the SDL Java file slightly...to perform a release of sound resources before native pause - and so far, it seems to be reducing my wakelocks!! Yay!!

My test app was 2.10% wakelock and is now down to 1.49% and that is with only a small portion of the total installs on the new version...If it gets down even further I will let you know.

Code (html) Select
public void surfaceDestroyed(SurfaceHolder holder) {
        Log.i("glbasic", "surfaceDestroyed()");
if (SDLActivity.usePauseCall==true)
SDLActivity.glbasicOnPause(1); // 1=pause
        if (!SDLActivity.mIsPaused) {
            SDLActivity.mIsPaused = true;
SDLActivity.androidAudio.pauseMusic(); // gp
SDLActivity.androidAudio.release(); // gp - releasing sound resources
SDLActivity.nativePause(); // SDL2 - moved down in sequence
           
}
        enableSensor(Sensor.TYPE_ACCELEROMETER, false);
    }
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

do you uses AUTOPAUSE FALSE or AUTOPAUSE TRUE?
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi

ALLOWESCAPE FALSE
AUTOPAUSE TRUE

i think it was necessarily for Autopause True if ads are present?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

yes im see in the source code both subs is not called when AUTOPAUSE is set to FALSE and might is harder to control or checking if HIBERNATE is got stuck.

Could look like a similar issue, even in Windows 10, where a paused HIBERNATE() state dosent not allways resumed or killed correctly?

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi All

Just to let you know - so far I have managed to reduce wake locks from 2.10% to 1%
It's still above the threshold but much better.

Audiomix is still the tag that seems to be causing it so any other suggestions to try to decrease are most welcome :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs