nyxkn / meditation

Essential meditation timer for Android
GNU General Public License v3.0
27 stars 2 forks source link

Speaker off after end of meditation #7

Open android-outliner opened 9 months ago

android-outliner commented 9 months ago

I have a Pixel 7 and have been using the App for a year or so without issues. Inside the App "Do Not Disturb" is configured. Screen is not kept on. Intervalls are off. After upgrading the device from Andoid 13 to 14 I have the strange issue, that "Do Not Disturb" starts and stops correctly, but after about 50% of the meditations the device speaker is turned off (the device setting where I can choose on/off/vibrate). I see the symbol in the notification bar and must turn on the speaker manually. I can't see any difference between the case when in works and when it doesn't.

I attached a log from a case where the speaker was off at the end. But unfortunately the content is the same when everything works. log_Meditation1.log My device is rooted, so I can provide additional logs with a test version if you want to provide one.

nyxkn commented 9 months ago

Heya! Thank you very much for the report!

It is very possible something's changed with android 14. I haven't tested that at all yet so I'll give it a try. If I can't reproduce I'll be back and ask you for more help :)

android-outliner commented 9 months ago

Thanks for looking into the issue.

I tried a few things to better understand when and why it happens that the device speaker is off after the timer ends.

I tried manually start and finish the meditation many times in intervals of just a few seconds. "Do not disturb" enables/disables always correctly. System speaker stays on. So everything good.

I tried a short interval of a minute a few times. Started timer, switched off the device and waited until the end. Everything good.

I tried my standard interval of 30 minutes. Started timer, switched off the device and waited until the end. In most cases device speaker is off afterwards. Issue reproduced.

Not a real idea what the reason is but I try to guess a bit - maybe it leads us to some further ideas. For me it looks like as if this is connected with a doze or sleep mode. During the 30 minutes the device never goes to Deep Doze. Just to Light doze. Which is because you use a foreground service and a wake lock I think. Light doze is interrupted by 2 maintanance modes. In my own App I stumbled upon the problem, that for Android 14 and the Pixel 7, Google sends Apps in background into sleep mode within 10 seconds. This was a few minutes before. My apps does some sync in the background, when the user changes data and then switches to another App. Depending on the sync method and the amount of changed data this may take longer then 10s. In this case my App freezes and stops syncing in background. Only after coming into foreground again, syncing continues. I tried to send your App into background in the 1-minute test. Never reproduced the problem.

I will let you know if I find anything else.

android-outliner commented 9 months ago

I tried to find out whats the different if it works and if it doesn't. I have an educated guess now.

The Pixel has an AMOLED display. That means you can enable "Always On Display" (AOD) showing notifications and the clock even if the screen is off. It seems now, that everything works if "Always On Display" is enabled. If it is disabled, the speaker stays on after the timer stops.

The difference could be some energy saving level. With "AOD on" the device never enters deep doze. However this also is not the case with a wake lock. Light doze and maintanance modes are the same during meditation timer with or without AOD.

nyxkn commented 5 months ago

Hey! Sorry, I haven't looked into this yet. But the latest version of the app uses a newer version of Flutter and explicitly targets Android 14. If you find that this improves anything do let me know.

android-outliner commented 4 months ago

I have been trying the new version for two weeks now and could not reproduce the issue any more. So we may be lucky and it's solved now. I suggest to wait a few more days. If all is good, I will close the issue if you agree.