Actually, I guess the AMs behavior is reasonable in this case - it
can't tell the difference between an OOM kill and an actual crash of
the process. Even if it could, suppressing the restart until there's
more memory sounds tricky. This wouldn't matter, except that the
MediaPlaybackService doesn't shut itself down after 60 seconds like
it's supposed so. I read the code and can't figure it out.
When the MediaPlaybackService is OOM killed it'll be restarted in the
normal manner 5 seconds later, which means onStart will be called.
That registers a delayed message for 60 seconds later. That message
handler calls stopSelf() which RPCs back to the AM into stopService(),
which then calls bringServiceDownLocked. The first return statement
can't be taken, and "adb bugreport" shows no connections to the MPS so
the second codepath that could return can't be taken either. But then
it logs into the EventManager am_destroy_service .... and yet that
event is never logged. I can clearly see other services getting
destroyed like this but not the MPS, so it must bail out during one of
the steps I outlined (assuming messages don't get lost in the binder).
The only thing I can think of is that findService(Intent...) returns
null, in which case stopService silently returns. I haven't explored
what this function does yet but it looks pretty complicated.
I uploaded a bugreport file here:
http://plan99.net/~mike/log2.txt