Loading core/java/android/view/VolumePanel.java +2 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie mDialog.setOnDismissListener(new OnDismissListener() { public void onDismiss(DialogInterface dialog) { mActiveStreamType = -1; mAudioManager.forceVolumeControlStream(mActiveStreamType); } }); // Change some window properties Loading Loading @@ -483,6 +484,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } if (!mDialog.isShowing()) { mAudioManager.forceVolumeControlStream(streamType); mDialog.setContentView(mView); // Showing dialog - use collapsed state collapse(); Loading media/java/android/media/AudioManager.java +31 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public class AudioManager { private final Context mContext; private final Handler mHandler; private long mVolumeKeyUpTime; private int mVolumeControlStream = -1; private static String TAG = "AudioManager"; private static boolean DEBUG = false; private static boolean localLOGV = DEBUG || android.util.Config.LOGV; Loading Loading @@ -262,6 +262,13 @@ public class AudioManager { */ public static final int FLAG_VIBRATE = 1 << 4; /** * forces use of specified stream * @hide */ public static final int FLAG_FORCE_STREAM = 1 << 5; /** * Ringer mode that will be silent and will not vibrate. (This overrides the * vibrate setting.) Loading Loading @@ -392,12 +399,17 @@ public class AudioManager { * Adjust the volume in on key down since it is more * responsive to the user. */ int flags = FLAG_SHOW_UI | FLAG_VIBRATE; if (mVolumeControlStream != -1) { stream = mVolumeControlStream; flags |= FLAG_FORCE_STREAM; } adjustSuggestedStreamVolume( keyCode == KeyEvent.KEYCODE_VOLUME_UP ? ADJUST_RAISE : ADJUST_LOWER, stream, FLAG_SHOW_UI | FLAG_VIBRATE); flags); break; case KeyEvent.KEYCODE_VOLUME_MUTE: // TODO: Actually handle MUTE. Loading @@ -416,10 +428,15 @@ public class AudioManager { * Play a sound. This is done on key up since we don't want the * sound to play when a user holds down volume down to mute. */ int flags = FLAG_PLAY_SOUND; if (mVolumeControlStream != -1) { stream = mVolumeControlStream; flags |= FLAG_FORCE_STREAM; } adjustSuggestedStreamVolume( ADJUST_SAME, stream, FLAG_PLAY_SOUND); flags); mVolumeKeyUpTime = SystemClock.uptimeMillis(); break; Loading Loading @@ -682,6 +699,17 @@ public class AudioManager { } } /** * forces the stream controlled by hard volume keys * specifying streamType == -1 releases control to the * logic. * * @hide */ public void forceVolumeControlStream(int streamType) { mVolumeControlStream = streamType; } /** * Returns whether a particular type should vibrate according to user * settings and the current ringer mode. Loading media/java/android/media/AudioService.java +13 −1 Original line number Diff line number Diff line Loading @@ -417,6 +417,9 @@ public class AudioService extends IAudioService.Stub { (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)| (1 << AudioSystem.STREAM_MUSIC))); if (!mVoiceCapable) { mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } mMuteAffectedStreams = System.getInt(cr, System.MUTE_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_MUSIC)|(1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_SYSTEM))); Loading Loading @@ -461,7 +464,12 @@ public class AudioService extends IAudioService.Stub { /** @see AudioManager#adjustVolume(int, int, int) */ public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags) { int streamType = getActiveStreamType(suggestedStreamType); int streamType; if ((flags & AudioManager.FLAG_FORCE_STREAM) != 0) { streamType = suggestedStreamType; } else { streamType = getActiveStreamType(suggestedStreamType); } // Don't play sound on other streams if (streamType != AudioSystem.STREAM_RING && (flags & AudioManager.FLAG_PLAY_SOUND) != 0) { Loading Loading @@ -2025,6 +2033,10 @@ public class AudioService extends IAudioService.Stub { int ringerModeAffectedStreams = Settings.System.getInt(mContentResolver, Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); if (!mVoiceCapable) { ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } if (ringerModeAffectedStreams != mRingerModeAffectedStreams) { /* * Ensure all stream types that should be affected by ringer mode Loading Loading
core/java/android/view/VolumePanel.java +2 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie mDialog.setOnDismissListener(new OnDismissListener() { public void onDismiss(DialogInterface dialog) { mActiveStreamType = -1; mAudioManager.forceVolumeControlStream(mActiveStreamType); } }); // Change some window properties Loading Loading @@ -483,6 +484,7 @@ public class VolumePanel extends Handler implements OnSeekBarChangeListener, Vie } if (!mDialog.isShowing()) { mAudioManager.forceVolumeControlStream(streamType); mDialog.setContentView(mView); // Showing dialog - use collapsed state collapse(); Loading
media/java/android/media/AudioManager.java +31 −3 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public class AudioManager { private final Context mContext; private final Handler mHandler; private long mVolumeKeyUpTime; private int mVolumeControlStream = -1; private static String TAG = "AudioManager"; private static boolean DEBUG = false; private static boolean localLOGV = DEBUG || android.util.Config.LOGV; Loading Loading @@ -262,6 +262,13 @@ public class AudioManager { */ public static final int FLAG_VIBRATE = 1 << 4; /** * forces use of specified stream * @hide */ public static final int FLAG_FORCE_STREAM = 1 << 5; /** * Ringer mode that will be silent and will not vibrate. (This overrides the * vibrate setting.) Loading Loading @@ -392,12 +399,17 @@ public class AudioManager { * Adjust the volume in on key down since it is more * responsive to the user. */ int flags = FLAG_SHOW_UI | FLAG_VIBRATE; if (mVolumeControlStream != -1) { stream = mVolumeControlStream; flags |= FLAG_FORCE_STREAM; } adjustSuggestedStreamVolume( keyCode == KeyEvent.KEYCODE_VOLUME_UP ? ADJUST_RAISE : ADJUST_LOWER, stream, FLAG_SHOW_UI | FLAG_VIBRATE); flags); break; case KeyEvent.KEYCODE_VOLUME_MUTE: // TODO: Actually handle MUTE. Loading @@ -416,10 +428,15 @@ public class AudioManager { * Play a sound. This is done on key up since we don't want the * sound to play when a user holds down volume down to mute. */ int flags = FLAG_PLAY_SOUND; if (mVolumeControlStream != -1) { stream = mVolumeControlStream; flags |= FLAG_FORCE_STREAM; } adjustSuggestedStreamVolume( ADJUST_SAME, stream, FLAG_PLAY_SOUND); flags); mVolumeKeyUpTime = SystemClock.uptimeMillis(); break; Loading Loading @@ -682,6 +699,17 @@ public class AudioManager { } } /** * forces the stream controlled by hard volume keys * specifying streamType == -1 releases control to the * logic. * * @hide */ public void forceVolumeControlStream(int streamType) { mVolumeControlStream = streamType; } /** * Returns whether a particular type should vibrate according to user * settings and the current ringer mode. Loading
media/java/android/media/AudioService.java +13 −1 Original line number Diff line number Diff line Loading @@ -417,6 +417,9 @@ public class AudioService extends IAudioService.Stub { (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)| (1 << AudioSystem.STREAM_MUSIC))); if (!mVoiceCapable) { mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } mMuteAffectedStreams = System.getInt(cr, System.MUTE_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_MUSIC)|(1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_SYSTEM))); Loading Loading @@ -461,7 +464,12 @@ public class AudioService extends IAudioService.Stub { /** @see AudioManager#adjustVolume(int, int, int) */ public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags) { int streamType = getActiveStreamType(suggestedStreamType); int streamType; if ((flags & AudioManager.FLAG_FORCE_STREAM) != 0) { streamType = suggestedStreamType; } else { streamType = getActiveStreamType(suggestedStreamType); } // Don't play sound on other streams if (streamType != AudioSystem.STREAM_RING && (flags & AudioManager.FLAG_PLAY_SOUND) != 0) { Loading Loading @@ -2025,6 +2033,10 @@ public class AudioService extends IAudioService.Stub { int ringerModeAffectedStreams = Settings.System.getInt(mContentResolver, Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); if (!mVoiceCapable) { ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } if (ringerModeAffectedStreams != mRingerModeAffectedStreams) { /* * Ensure all stream types that should be affected by ringer mode Loading