fix: don't restart alarm sound service automatically
This sets the alarm sound service to not be sticky. If AAPS is stopped while an alarm is playing, the alarm sound service will be started again by the system but there's no built-in way to stop it after this happens. This commit makes it so the alarm sound service won't be restarted by Android, thereby avoiding the aforementioned issue.
This commit is contained in:
parent
dfbe0ba0e6
commit
d7ad74056d
1 changed files with 2 additions and 2 deletions
|
@ -74,7 +74,7 @@ class AlarmSoundService : DaggerService() {
|
|||
if (intent?.hasExtra(ErrorHelperActivity.SOUND_ID) == true) resourceId = intent.getIntExtra(ErrorHelperActivity.SOUND_ID, R.raw.error)
|
||||
player = MediaPlayer()
|
||||
try {
|
||||
val afd = rh.openRawResourceFd(resourceId) ?: return START_STICKY
|
||||
val afd = rh.openRawResourceFd(resourceId) ?: return START_NOT_STICKY
|
||||
player?.setDataSource(afd.fileDescriptor, afd.startOffset, afd.length)
|
||||
afd.close()
|
||||
player?.isLooping = true
|
||||
|
@ -94,7 +94,7 @@ class AlarmSoundService : DaggerService() {
|
|||
aapsLogger.error("Unhandled exception", e)
|
||||
}
|
||||
aapsLogger.debug(LTag.CORE, "onStartCommand End")
|
||||
return START_STICKY
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
|
Loading…
Reference in a new issue