App process does not die when stopping a bound foreground service
I have a bound foreground service that is supposed to live even when the app is removed from recents, but with the option to also stop the service when the app gets removed. That optional path is what I am having trouble with.
If the service is not set as foreground, stopping the service causes the process to die as well. This is the desired effect:
https://i.stack.imgur.com/2mblP.png▾
However, if the service is set as foreground, the app process does...