Tweak the behavior of the MediaSessionStack

This makes the following changes in behavior:
-We will only cache a pending intent for a session if it reaches the
 one of the playing states.
-If a previously priority session is removed the next session only
 gets priority if it is in a playing state. Otherwise we use the removed
 session's PendingIntent.
-The last session to have been playing or to have been added gets
 priority after any currently playing sessions, but only if it is still
 in the list of active sessions.
-We will only use a session that isn't playing and isn't the most recently
 playing/added if we don't have a PendingIntent from the last playing session
 to fall back on.

bug:18589421
Change-Id: I650c56a782bb1f1d5e64d7574a7d2387606f3b17
2 files changed