summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-09-12 17:53:38 -0700
committerJeff Brown <jeffbrown@google.com>2010-09-12 18:09:11 -0700
commit8b7a982d290b368407e0c419c10105d5d4306b4b (patch)
tree6ad648db5631a201cff980df8b4b1a91028d7382 /policy
parent692065128e66de77470de2c50ead2bef0452952a (diff)
downloadframeworks_base-8b7a982d290b368407e0c419c10105d5d4306b4b.zip
frameworks_base-8b7a982d290b368407e0c419c10105d5d4306b4b.tar.gz
frameworks_base-8b7a982d290b368407e0c419c10105d5d4306b4b.tar.bz2
Don't play a sound if a volume key press is canceled.
Change-Id: I8e45af20ec83a81565e10be3648b95686fa897af
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java26
1 files changed, 14 insertions, 12 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index b9232c8..dffccf8 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -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;
}