a quran reading application for android
tldr; this release should actually fix the ANR in sha' Allah by properly handling media buttons.
the longer version - there were plenty of ANRs happening due to calling startForegroundService
on the AudioService
without actually going in the foreground. across many releases, various fixes were made to try to fix this (both fixing many potential performance issues, making sure the service started sooner, and dropping the startForegroundService
call from all services and calling startService
instead for all of them (since the app was always in the foreground at the time anyway). none of these actually fixed the problem, and the ANR remained the same, despite not having any startForegroundService
calls in the app.
it turns out that MediaButtonReceiver
handles a media button press by starting a foreground service. this is actually perfectly consistent with the ANR - 1. it happens when starting AudioService
in the foreground as the ANR message suggests, and 2. the app, in fact, never went to the foreground except for ACTION_PLAYBACK
events.
DownloadService
start as a background service (#1135).This release tackles some audio playback related issues that are likely causing ANRs.
State.Playing
until start()
is called on the MediaPlayer
. This is important because not doing so allows calls to pause, next, and previous to go through, all of which are illegal before MediaPlayer
's started state is reached. Consequently, these cause an error to be thrown, which kills the foreground notification, which could be a cause of ANRs due to starting the foreground service without starting foreground (#1113).AudioService
runs most logic off the ui thread nowmostly a bug fix release.