diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2013-04-21 22:59:43 +0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-05-07 12:47:27 -0700 |
commit | aa1d684f13593b1f8cbb6aec0eb22ca8a0cc77f9 (patch) | |
tree | 44d1ebe7536de2280f4668d7b372e3235673d01f /media | |
parent | 08410bd2b1e54db3d560bc4b93276b4146e8053a (diff) | |
download | frameworks_base-aa1d684f13593b1f8cbb6aec0eb22ca8a0cc77f9.zip frameworks_base-aa1d684f13593b1f8cbb6aec0eb22ca8a0cc77f9.tar.gz frameworks_base-aa1d684f13593b1f8cbb6aec0eb22ca8a0cc77f9.tar.bz2 |
Option to use volume keys to control media volume anytime (2/2)
See Settings part for description
Change-Id: I78d26b0bd41f5b58514ae9c68208a8c950396823
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; } } } |