summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2010-11-01 15:24:01 -0700
committerJeff Brown <jeffbrown@google.com>2010-11-02 17:31:39 -0700
commitb0418da0e7594a8c2164a46985c5f1993632e010 (patch)
treef73f81b31796d4f75ef6530d1fb883fccc74031f /policy
parentc68134b74016b82e0c49c47b89d93b2d0921cbe5 (diff)
downloadframeworks_base-b0418da0e7594a8c2164a46985c5f1993632e010.zip
frameworks_base-b0418da0e7594a8c2164a46985c5f1993632e010.tar.gz
frameworks_base-b0418da0e7594a8c2164a46985c5f1993632e010.tar.bz2
Add plumbing for volume mute key.
Full support for the volume mute key will be implemented in a later change. Bug: 2912307 Change-Id: I98c27d6360f159c8b7447e04b45f442eff87b38a
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewBase.java4
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java1
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java9
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java4
4 files changed, 14 insertions, 4 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
index 0f1aa4e..34dbace 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
@@ -170,7 +170,8 @@ public abstract class KeyguardViewBase extends FrameLayout {
}
case KeyEvent.KEYCODE_VOLUME_UP:
- case KeyEvent.KEYCODE_VOLUME_DOWN: {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_MUTE: {
synchronized (this) {
if (mAudioManager == null) {
mAudioManager = (AudioManager) getContext().getSystemService(
@@ -179,6 +180,7 @@ public abstract class KeyguardViewBase extends FrameLayout {
}
// Volume buttons should only function for music.
if (mAudioManager.isMusicActive()) {
+ // TODO: Actually handle MUTE.
mAudioManager.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
keyCode == KeyEvent.KEYCODE_VOLUME_UP
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index c870503..42b73b9 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -786,6 +786,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_MUTE:
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_PLAY:
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index e944f9d..cd88821 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -1230,7 +1230,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
- case KeyEvent.KEYCODE_VOLUME_DOWN: {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_MUTE: {
AudioManager audioManager = (AudioManager) getContext().getSystemService(
Context.AUDIO_SERVICE);
if (audioManager != null) {
@@ -1238,6 +1239,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* Adjust the volume in on key down since it is more
* responsive to the user.
*/
+ // TODO: Actually handle MUTE.
audioManager.adjustSuggestedStreamVolume(
keyCode == KeyEvent.KEYCODE_VOLUME_UP
? AudioManager.ADJUST_RAISE
@@ -1405,7 +1407,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
- case KeyEvent.KEYCODE_VOLUME_DOWN: {
+ case KeyEvent.KEYCODE_VOLUME_DOWN:
+ case KeyEvent.KEYCODE_VOLUME_MUTE: {
if (!event.isCanceled()) {
AudioManager audioManager = (AudioManager) getContext().getSystemService(
Context.AUDIO_SERVICE);
@@ -1414,6 +1417,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* 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.
*/
+ // TODO: Actually handle MUTE.
audioManager.adjustSuggestedStreamVolume(
AudioManager.ADJUST_SAME,
mVolumeControlStreamType,
@@ -1720,6 +1724,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
* cancel the sound
*/
if (keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_VOLUME_UP
+ && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE
&& mVolumeKeyUpTime + VolumePanel.PLAY_SOUND_DELAY
> SystemClock.uptimeMillis()) {
/*
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index e950ae5..af1bf59 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1877,6 +1877,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// since audio is playing, we shouldn't have to hold a wake lock
// during the call, but we do it as a precaution for the rare possibility
// that the music stops right before we call this
+ // TODO: Actually handle MUTE.
mBroadcastWakeLock.acquire();
audioService.adjustStreamVolume(stream,
keycode == KeyEvent.KEYCODE_VOLUME_UP
@@ -1949,7 +1950,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Handle special keys.
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
- case KeyEvent.KEYCODE_VOLUME_UP: {
+ case KeyEvent.KEYCODE_VOLUME_UP:
+ case KeyEvent.KEYCODE_VOLUME_MUTE: {
if (down) {
ITelephony telephonyService = getTelephonyService();
if (telephonyService != null) {