diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 315196e..fe98458 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -236,7 +236,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished { * NOTE: do not create loops in aliases! * Some streams alias to different streams according to device category (phone or tablet) or * use case (in call s off call...).See updateStreamVolumeAlias() for more details - * mStreamVolumeAlias contains the default aliases for a voice capable device (phone) and + * STREAM_VOLUME_ALIAS contains the default aliases for a voice capable device (phone) and * STREAM_VOLUME_ALIAS_NON_VOICE for a non voice capable device (tablet).*/ private final int[] STREAM_VOLUME_ALIAS = new int[] { AudioSystem.STREAM_VOICE_CALL, // STREAM_VOICE_CALL @@ -278,6 +278,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished { "STREAM_TTS" }; + private boolean mLinkNotificationWithVolume; + private final AudioSystem.ErrorCallback mAudioSystemCallback = new AudioSystem.ErrorCallback() { public void onError(int error) { switch (error) { @@ -619,6 +621,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished { dtmfStreamAlias = AudioSystem.STREAM_VOICE_CALL; } mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias; + + if (mLinkNotificationWithVolume) { + mStreamVolumeAlias[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_RING; + } else { + mStreamVolumeAlias[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_NOTIFICATION; + } + if (updateVolumes) { mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias], false /*lastAudible*/); @@ -721,6 +730,12 @@ public class AudioService extends IAudioService.Stub implements OnFinished { readDockAudioSettings(cr); } + //****************************************************************** + //TODO: should this be a user specific setting or device (see below) + mLinkNotificationWithVolume = Settings.System.getInt(cr, + Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1; + //****************************************************************** + mMuteAffectedStreams = System.getIntForUser(cr, System.MUTE_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_MUSIC)| @@ -3472,6 +3487,14 @@ public class AudioService extends IAudioService.Stub implements OnFinished { setRingerModeInt(getRingerMode(), false); } readDockAudioSettings(mContentResolver); + + mLinkNotificationWithVolume = Settings.System.getInt(mContentResolver, + Settings.System.VOLUME_LINK_NOTIFICATION, 1) == 1; + if (mLinkNotificationWithVolume) { + mStreamVolumeAlias[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_RING; + } else { + mStreamVolumeAlias[AudioSystem.STREAM_NOTIFICATION] = AudioSystem.STREAM_NOTIFICATION; + } } } } |