diff options
author | DvTonder <david.vantonder@gmail.com> | 2012-11-22 16:23:02 -0500 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2012-11-22 16:23:02 -0500 |
commit | 09592c64798b36c7cdc2737191e5ec71fb786d71 (patch) | |
tree | 47c30770fb6bb734b009d33141960c3f22875a4c /media | |
parent | 5ae717b363381264a6fdfa1fdd83315a3a8f7027 (diff) | |
download | frameworks_base-09592c64798b36c7cdc2737191e5ec71fb786d71.zip frameworks_base-09592c64798b36c7cdc2737191e5ec71fb786d71.tar.gz frameworks_base-09592c64798b36c7cdc2737191e5ec71fb786d71.tar.bz2 |
Forward port Volume panel style and Linked volumes
Original author ptunstal
Change-Id: I4359550fabd110ced6359d2bdcd321561b08fae0
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; + } } } } |