Route volume commands whenever media stream is in use

Found a regression in volume handling. Previously we handled
volume commands as long as the media stream was active but we were only
handling them when there was an active session on L. This adds a check to
make sure we handle volume if anything is playing on the media stream.

bug:17498479
Change-Id: Iddd745c8a762cf7ebedb37f1b26fc934db01fba0
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index a12dd1c..aaa29fc 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -31,6 +31,7 @@
 import android.content.pm.PackageManager;
 import android.database.ContentObserver;
 import android.media.AudioManager;
+import android.media.AudioSystem;
 import android.media.IAudioService;
 import android.media.IRemoteVolumeController;
 import android.media.session.IActiveSessionsListener;
@@ -800,7 +801,8 @@
 
             }
             if (session == null) {
-                if ((flags & AudioManager.FLAG_ACTIVE_MEDIA_ONLY) != 0) {
+                if ((flags & AudioManager.FLAG_ACTIVE_MEDIA_ONLY) != 0
+                        && !AudioSystem.isStreamActive(AudioManager.STREAM_MUSIC, 0)) {
                     if (DEBUG) {
                         Log.d(TAG, "No active session to adjust, skipping media only volume event");
                     }