am 0f17d95e: am 9e070715: am f338fcba: Merge "Use the suggested stream if it\'s currently active" into lmp-mr1-dev
* commit '0f17d95e6fc0fb49fbaa87dbd3f04662e6d7e9cc': Use the suggested stream if it's currently active
This commit is contained in:
@@ -805,7 +805,12 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
+ flags + ", suggestedStream=" + suggestedStream);
|
||||
|
||||
}
|
||||
if (session == null) {
|
||||
boolean preferSuggestedStream = false;
|
||||
if (isValidLocalStreamType(suggestedStream)
|
||||
&& AudioSystem.isStreamActive(suggestedStream, 0)) {
|
||||
preferSuggestedStream = true;
|
||||
}
|
||||
if (session == null || preferSuggestedStream) {
|
||||
if ((flags & AudioManager.FLAG_ACTIVE_MEDIA_ONLY) != 0
|
||||
&& !AudioSystem.isStreamActive(AudioManager.STREAM_MUSIC, 0)) {
|
||||
if (DEBUG) {
|
||||
@@ -959,6 +964,12 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
return keyCode == KeyEvent.KEYCODE_HEADSETHOOK;
|
||||
}
|
||||
|
||||
// we only handle public stream types, which are 0-5
|
||||
private boolean isValidLocalStreamType(int streamType) {
|
||||
return streamType >= AudioManager.STREAM_VOICE_CALL
|
||||
&& streamType <= AudioManager.STREAM_NOTIFICATION;
|
||||
}
|
||||
|
||||
private KeyEventWakeLockReceiver mKeyEventReceiver = new KeyEventWakeLockReceiver(mHandler);
|
||||
|
||||
class KeyEventWakeLockReceiver extends ResultReceiver implements Runnable,
|
||||
|
||||
Reference in New Issue
Block a user