Skip to content

Commit bf2e088

Browse files
author
Jean-Baptiste Queru
committed
Merge into jb-mr1-dev
Change-Id: Iba23d16643b8754f6e0a7288b2ca242f722f1bdd
2 parents 164ff6b + 9903e26 commit bf2e088

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

media/java/android/media/AudioService.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,11 @@ public void onError(int error) {
388388
private Looper mSoundPoolLooper = null;
389389
// volume applied to sound played with playSoundEffect()
390390
private static int sSoundEffectVolumeDb;
391-
// getActiveStreamType() will return STREAM_NOTIFICATION during this period after a notification
391+
// getActiveStreamType() will return:
392+
// - STREAM_NOTIFICATION on tablets during this period after a notification stopped
393+
// - STREAM_MUSIC on phones during this period after music or talkback/voice search prompt
392394
// stopped
393-
private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000;
395+
private static final int DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS = 5000;
394396
// previous volume adjustment direction received by checkForRingerModeChange()
395397
private int mPrevVolDirection = AudioManager.ADJUST_SAME;
396398
// Keyguard manager proxy
@@ -2341,7 +2343,8 @@ private int getActiveStreamType(int suggestedStreamType) {
23412343
if (DEBUG_VOL)
23422344
Log.v(TAG, "getActiveStreamType: Forcing STREAM_REMOTE_MUSIC");
23432345
return STREAM_REMOTE_MUSIC;
2344-
} else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)) {
2346+
} else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC,
2347+
DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS)) {
23452348
if (DEBUG_VOL)
23462349
Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC stream active");
23472350
return AudioSystem.STREAM_MUSIC;
@@ -2370,9 +2373,9 @@ private int getActiveStreamType(int suggestedStreamType) {
23702373
return AudioSystem.STREAM_VOICE_CALL;
23712374
}
23722375
} else if (AudioSystem.isStreamActive(AudioSystem.STREAM_NOTIFICATION,
2373-
NOTIFICATION_VOLUME_DELAY_MS) ||
2376+
DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS) ||
23742377
AudioSystem.isStreamActive(AudioSystem.STREAM_RING,
2375-
NOTIFICATION_VOLUME_DELAY_MS)) {
2378+
DEFAULT_STREAM_TYPE_OVERRIDE_DELAY_MS)) {
23762379
if (DEBUG_VOL) Log.v(TAG, "getActiveStreamType: Forcing STREAM_NOTIFICATION");
23772380
return AudioSystem.STREAM_NOTIFICATION;
23782381
} else if (suggestedStreamType == AudioManager.USE_DEFAULT_STREAM_TYPE) {

0 commit comments

Comments
 (0)