Only play sound effects if stream is not muted.

Calling playSoundEffect() currently results in audio data being sent to
audioflinger regardless of whether or not the system stream is muted.

Although this already produces no audio, when nothing else is using the
audio system it does have the less desirable effect of waking up the
hardware to play 3+ seconds of silence before audioflinger goes idle
again - probably a waste of power.

Change-Id: I81a6cb17efe4036285f4af0567c3f0a31dda1152
Signed-off-by: David Overton <therealdave32@gmail.com>
(cherry picked from commit f0252a3a6ad5e1025003ef56a7723e9c8fabc077)
This commit is contained in:
David Overton
2012-05-17 21:52:28 +01:00
committed by Jean-Michel Trivi
parent 053893568a
commit ac918900cc

View File

@@ -3987,7 +3987,7 @@ public class AudioService extends IAudioService.Stub
/** @see AudioManager#playSoundEffect(int, float) */
public void playSoundEffectVolume(int effectType, float volume) {
// do not try to play the sound effect if the system stream is muted
if (isStreamMutedByRingerOrZenMode(STREAM_SYSTEM)) {
if (isStreamMute(STREAM_SYSTEM)) {
return;
}