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
This commit is contained in:
RoboErik
2014-09-14 13:54:31 -07:00
committed by Erik Pasternak
parent 2ae312e306
commit 94c716ea29

View File

@@ -31,6 +31,7 @@ import android.content.Intent;
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 @@ public class MediaSessionService extends SystemService implements Monitor {
}
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");
}