Specs: Samsung S5 Verizon
Model: SM-G900V
Android Ver: 5.0
Baseband Ver: G900VVRU2BOG5
Kernel: 3.4.0
Build: LRX21T.($baseband)
This has gotten seriously out of hand and it is INCREDIBLY frustrating! It's gotten so bad that I'll literally not be able to leave Google Maps running in the background (e.g. navigating somewhere) because when I start navigation then go to send a text letting them know my ETA, Android silently kills Google Maps! I mean, seriously Android, STOP IT!
This. Is. SPAAAAAAARTAAAA!
Nah, just kidding. This is indeed infuriating.
BTW. I find "Android is Silently Killing my Apps" a great title for category B good old sci-fi movie.
Anyway, I'm having the EXACT same issue with my Xiaomi Mi 5 (and before that, with Xiaomi Redmi Note 3 Pro). It had happened to me on stock MIUI ROM, then on clean LineageOS 14, then on AOSP Extended 4.6, then on AEX.mod 5.1 @ Android 8.1 Oreo.
This is EXTREMELY IRRITATING
MASSIVE CLUSTER*****
I find this error not connected to any particular brand (as I see, it's not the "problem" of Xiaomi, it's also "belongs" to Samsung or any other vendor), this is certainly NOT connected with any specific ROM (stock or custom), but I see it as core Android problem itself.
Case study for me:
[1]
I'm launching at least 2 apps while driving: Google Maps for navigation and Google Play Music for music; sometimes Yanosik (Polish version of Waze with police & radars warnings), but it doesn't matter, because it also crash when only Maps & Music are up.
[2]
Music is playing (sometimes, when the app is working) in my car audio through Bluetooth. I put then Maps on front and Music is supposed to play in the background (stream to BT). I get like 5-30 kills during couple of minutes. I resume play - whether is by pushing physically BT "Play" button in my car audio system or by Android app, then it get kills right away again. Sometimes even after like 2 seconds! Sometimes music is killed 13 times right after I push-to-play, sometimes it's playing for 5 minutes, then kill is after the song is over. There is no rule (not even one ring to rule them all...)
[3]
It doesn't matter if I'm using Google Play Music or Spotify, or whatever, every music app is vulnerable (Android Is Silently Killing This App - sorry, but I'm in love with this title!

). I was using Spotify previously - the same result. BAM! App killed (in the background).
[4]
Of course all persistent notifications of each app is on (ofc Android just doesn't care and kill them apps - I have apps working in background, for which I disabled notifications and suprisingly THEY ARE working, but Maps & Music have notification ON, and they are killed).
[5]
Battery optimisation for Google Maps & Play Music is OFF.
[6]
AOSP Extended has these switches in "Permissions":
+ auto start (launch at boot)
+ keep awake (ironically - do not kill

)
+ launch in backround
All 3 switches are ON for Maps & Music.
[7]
New Oreo 8.1 has this function "Picture in Picture" (PIP), so when navi is working, you can toggle to another app and there's this little window with maps showing. It doesn't matter. Android can kill Maps also even with PIP on.
[8]
Android can kill Maps and/or Music even in divided screen mode (I divide the screen in half and put Play Music on one half and Maps on second). Yup... Android is killing music. Or maps. Or both.
[9]
I was trying even to change the AVRCP version of Bluetooth, but it does not seem to help in any way. From 1.3 to 1.6 - result: DEAD. BAAAAM!!!
[10]
Root, no root - does not matter. Magisk on - does not matter. EX Kernel, CPU and swap set to "performance" - DOES NOT F....NG MATTER.
All of it makes me want to go to Google Developers, find people responsible for it, and beat them with a chair until they will fix it. (well, this is a joke**, I know NSA is watching

)
* yes, it's officially approved scientifically term
** no, it's not (kinda is, but then... well... it depends)