diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 3343ae8..338ba5e 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -448,6 +448,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished { private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED; + private boolean mVolumeKeysControlRingStream; + /////////////////////////////////////////////////////////////////////////// // Construction /////////////////////////////////////////////////////////////////////////// @@ -768,6 +770,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished { readDockAudioSettings(cr); mSafeVolumeEnabled = new Boolean(safeVolumeEnabled(cr)); + + mVolumeKeysControlRingStream = Settings.System.getIntForUser(cr, + Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM, 1, UserHandle.USER_CURRENT) == 1; } mLinkNotificationWithVolume = Settings.System.getIntForUser(cr, @@ -2538,9 +2543,15 @@ public class AudioService extends IAudioService.Stub implements OnFinished { Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC stream active"); return AudioSystem.STREAM_MUSIC; } else { - if (DEBUG_VOL) - Log.v(TAG, "getActiveStreamType: Forcing STREAM_RING b/c default"); - return AudioSystem.STREAM_RING; + if (mVolumeKeysControlRingStream) { + if (DEBUG_VOL) + Log.v(TAG, "getActiveStreamType: Forcing STREAM_RING b/c default"); + return AudioSystem.STREAM_RING; + } else { + if (DEBUG_VOL) + Log.v(TAG, "getActiveStreamType: Forcing STREAM_MUSIC b/c default setting"); + return AudioSystem.STREAM_MUSIC; + } } } else if (AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0)) { if (DEBUG_VOL) @@ -3544,6 +3555,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished { Settings.System.VOLUME_LINK_NOTIFICATION), false, this); mContentResolver.registerContentObserver(Settings.System.getUriFor( Settings.System.SAFE_HEADSET_VOLUME), false, this); + mContentResolver.registerContentObserver(Settings.System.getUriFor( + Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM), false, this); } @Override @@ -3595,6 +3608,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished { } else if (uri.equals(Settings.System.getUriFor(Settings.System.SAFE_HEADSET_VOLUME))) { mSafeVolumeEnabled = safeVolumeEnabled(mContentResolver); + } else if (uri.equals(Settings.System.getUriFor(Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM))) { + mVolumeKeysControlRingStream = Settings.System.getIntForUser(mContentResolver, + Settings.System.VOLUME_KEYS_CONTROL_RING_STREAM, 1, UserHandle.USER_CURRENT) == 1; } } } |