am 8abc9e9b: Merge "Don\'t play a sound if a volume key press is canceled." into gingerbread
Merge commit '8abc9e9b9917760a63cc38a030e64f207aeef86d' into gingerbread-plus-aosp * commit '8abc9e9b9917760a63cc38a030e64f207aeef86d': Don't play a sound if a volume key press is canceled.
This commit is contained in:
@@ -1317,18 +1317,20 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_VOLUME_UP:
|
||||
case KeyEvent.KEYCODE_VOLUME_DOWN: {
|
||||
AudioManager audioManager = (AudioManager) getContext().getSystemService(
|
||||
Context.AUDIO_SERVICE);
|
||||
if (audioManager != null) {
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
audioManager.adjustSuggestedStreamVolume(
|
||||
AudioManager.ADJUST_SAME,
|
||||
mVolumeControlStreamType,
|
||||
AudioManager.FLAG_PLAY_SOUND);
|
||||
mVolumeKeyUpTime = SystemClock.uptimeMillis();
|
||||
if (!event.isCanceled()) {
|
||||
AudioManager audioManager = (AudioManager) getContext().getSystemService(
|
||||
Context.AUDIO_SERVICE);
|
||||
if (audioManager != null) {
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
audioManager.adjustSuggestedStreamVolume(
|
||||
AudioManager.ADJUST_SAME,
|
||||
mVolumeControlStreamType,
|
||||
AudioManager.FLAG_PLAY_SOUND);
|
||||
mVolumeKeyUpTime = SystemClock.uptimeMillis();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user