Audio focus lost when resuming after call

This could be a idea. I have never had problems before for years. And now for some months I am using Android Auto.

I have another point related to this topic. Most of the articles here are talking about “losing the focus” related to another player.

But I am losing the focus without the interception of another player. What I mean is not another player pops up and takes over sound control but nothing happens. Non of my players react on the button press on my BT headset. And this happens in the scenario described by [signaleleven] on March 20 above. You presss Pause, talk some words to another person and bang… you can’t restart AntennaPod within seconds.

1 Like

I’m having this issue without using Android Auto, so it’s not limited to that case.

I just installed LineageOS 18.1 on an old Samsung Galaxy S5 with AntennaPod and AudioAnchor. I’m going to see if I can recreate the behavior reliably with open source applications per cos’s comment above.

In the mean time, I had this behavior with LOS 18.1 and Sony + F-Droid-V 2.5.2, too. There’s an app “android auto” present, but not actively in use. But as stated elsewhere: it’s hard to tell if this is a feature (Automatic small rewind when starting back - #13 by MCBuhl)

I just have to repeat what I wrote 21d ago: I have the situation that I pause my podcast (e. g. to talk to someone) and AntennaPod won’t start playback after that. And no other player starts!

Noone will tell me this is “works as intended”, won’t you?

I tried a lot of different things this weeks. I kept the focus on AntennaPod as ‘foreground app’. I chose all of AntennePods Screens. I always killed all other audio apps (probably thats why no other app intercepted anymore). Nothing helped. This is also reproducable with BT Speakers which have a play/pause button and obviously act like a headset.

I still hope that sometime someone will look at this and find a solution.

(My frustration is big enough that I uninstalled AntennaPod and use another Podcatcher in the meantime.)

Some more datapoints:

  • on a recent car trip, I used the split screen functionality to keep AntennaPod on the screen together with the navigation app. The problem was NOT present. (when a traffic announcement is detected on the radio, my car pauses whatever playback is running, including bluetooth sources, and then goes back to it. It’s functionally the same as hitting pause on a bluetooth speaker and starting it again after some variable, short, time). So on a long drive I have several automatic test runs of this issue. But the problem can be even triggered by pauses due to turn-by-turn instructions).
    As soon as I put Maps fullscreen, the problem presented itself after the first interruption.

  • whether “another app starts” or “nothing starts” when recovering depends indeed if there are other applications running. This should address the question whether this is due to another app’s behavior. It is reproducible with Antennapod being the only application.

I’m not an Android developer and I’m not sure if I can find the relevant part of the code. When “doing it right” is mentioned, is this due to some Android dev guideline? If this is damaging the user experience, and the guideline is ignored by pretty much everybody else, can AntennaPod follow suite?

I really wish I could help more with this issue.

And the help could come by… looking at logcat, for instance.

not knowing any better, I started logcat and grepping case-insensitive for antennapod

A few seconds after pausing playback, the following message appeared.

06-01 13:04:04.949  1596  3603 I ActivityManager: Process de.danoeh.antennapod (pid 20313) has died: svcb SVC 

06-01 13:04:04.953  1596  3603 W ActivityManagerServiceInjector: AMS will block de.danoeh.antennapod(de.danoeh.antennapod) autostart due to process is killed by lmk in low memory

Attempts to restart it (twice) from the headphones control lead to nothing playing, but these two messages.

06-01 13:04:05.490 12013 12569 E music   : MediaInfo{currVol=22, maxVol=30, artist='Nosaj Thing - Aquarium', album='Digitalis', title='Digitalis', duration=-1, pos=0, state=1, mediaPlayerName='AntennaPod', playerHasGone=0, stateChangeTimeMs=1654081428602, speed=0.0}

06-01 13:04:11.140 12013 12569 E music   : MediaInfo{currVol=22, maxVol=30, artist='Nosaj Thing - Aquarium', album='Digitalis', title='Digitalis', duration=-1, pos=0, state=1, mediaPlayerName='AntennaPod', playerHasGone=0, stateChangeTimeMs=1654081450634, speed=0.0}

Digitalis is a radio I was playing yesterday with the SomaFM player. Note how it shows metadata from SomaFM, but still “AntennaPod” as mediaPlayerName.
Again, nothing was playing.
Insisting on hitting play/pause on the headphones, eventually started SomaFM, but this message appeared:

06-01 13:04:26.500 21534 21534 V LASTMESSAGEi: Removed update AntennaPod - Loading. If this does not go away, play any episode and contact us.

Now, let’s see if there’s a way to tune or exclude the AntennaPod service from lmk (low memory killer - more vicious than the zodiac killer)

This blog post shows the rules the lmk uses to rank sacrificeable processes. No wonder than keeping the activity (UI) of AntennaPod visible with the screen on “solves” the problem"

In a “black box” reasoning, I would assume that either we have to prevent this killing, or see if there is something wrong in the way the application is resumed after a pause.
I don’t see any other killing related to other media players in similar tests (though I see tons of others. Amazing how every other application tries to leave something running - even when there is no obvious reason for it)

Edit:
OnePlus is notorious for being overly zealous in killing apps. I set AntennaPod to “don’t optimize” (OneplusLingo for avoiding background kills for battery optimization) and it seems to… mitigate the problem. I could endure longer pauses without losing the ability to restart the playback, but after about 3 minutes…

06-01 13:30:07.241  1596  3604 D MediaSessionService: Sending KeyEvent { action=ACTION_UP, keyCode=KEYCODE_MEDIA_PAUSE, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=0, downTime=0, deviceId=-1, source=0x0, displayId=0 } to de.danoeh.antennapod/PlaybackService (userId=0)

06-01 13:30:07.249  6453  6453 D NotificationListener: onNotificationPosted# sbn: 135468050, package = de.danoeh.antennapod

06-01 13:30:07.256 26104 26104 D NeoBean_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.260 22511 22511 D Popcorn_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.260  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.268 12013 12013 E music   : onNotificationPosted...StatusBarNotification(pkg=de.danoeh.antennapod user=UserHandle{0} id=2131427989 tag=null key=0|de.danoeh.antennapod|2131427989|null|10261: Notification(channel=playing shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0x00000000 category=transport actions=4 vis=PUBLIC))

06-01 13:30:07.278  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.278  2565  2565 D InterruptionStateProvider: No pulsing: notification shouldn't alert: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.278  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.278 12013 12013 E music   : de.danoeh.antennapod

06-01 13:30:07.407 26104 26104 D NeoBean_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.440 12013 12013 E music   : onNotificationPosted...StatusBarNotification(pkg=de.danoeh.antennapod user=UserHandle{0} id=2131427989 tag=null key=0|de.danoeh.antennapod|2131427989|null|10261: Notification(channel=playing shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0x00000000 category=transport actions=4 vis=PUBLIC))

06-01 13:30:07.440 12013 12013 E music   : de.danoeh.antennapod

06-01 13:30:07.443 22511 22511 D Popcorn_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.456  6453  6453 D NotificationListener: onNotificationPosted# sbn: 136919011, package = de.danoeh.antennapod

06-01 13:30:07.473 12013 12013 E music   : onNotificationPosted...StatusBarNotification(pkg=de.danoeh.antennapod user=UserHandle{0} id=2131427989 tag=null key=0|de.danoeh.antennapod|2131427989|null|10261: Notification(channel=playing shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x8 color=0x00000000 category=transport actions=4 vis=PUBLIC))

06-01 13:30:07.473 12013 12013 E music   : de.danoeh.antennapod

06-01 13:30:07.482  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.484  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.484  2565  2565 D InterruptionStateProvider: No pulsing: notification shouldn't alert: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.484  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.491 22511 22511 D Popcorn_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.493 26104 26104 D NeoBean_NotificationListener: onNotificationPosted()::sbn.getPackageName() = de.danoeh.antennapod

06-01 13:30:07.498  6453  6453 D NotificationListener: onNotificationPosted# sbn: 86386144, package = de.danoeh.antennapod

06-01 13:30:07.542  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.544  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.544  2565  2565 D InterruptionStateProvider: No pulsing: notification shouldn't alert: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.544  2565  2565 D InterruptionStateProvider: No alerting: filtered notification: 0|de.danoeh.antennapod|2131427989|null|10261

06-01 13:30:07.721 12013 12569 E music   : MediaInfo{currVol=22, maxVol=30, artist='Back to Work', album='Back to Work', title='Episode 577: Transylvanian Meditation', duration=4929758, pos=2827362, state=2, mediaPlayerName='AntennaPod', playerHasGone=0, stateChangeTimeMs=1654083007134, speed=1.0}

06-01 13:32:57.646  1596  3595 I ActivityManager: Process de.danoeh.antennapod (pid 11549) has died: cch+94 SVC 

06-01 13:32:58.254 12013 12569 E music   : MediaInfo{currVol=22, maxVol=30, artist='BistroBoy - The fear of death', album='Digitalis', title='Digitalis', duration=-1, pos=1452, state=0, mediaPlayerName='AntennaPod', playerHasGone=0, stateChangeTimeMs=1654082486266, speed=0.0}

(note the last line. I bet I will get SomaFM playing when I press play. And I did)

So, clearly not 100% AntennaPod’s fault, but without special configuration other apps manage to stay alive. What, if anything, could be done to increase the survivability rate of antennapod in the eyes of the lmk?

1 Like

Very nice work! I hope this leeds to a solution.