From 8c478132fbc07bd075df6aba85bcfd2990bbd66a Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 29 Aug 2013 04:06:45 -0700 Subject: Support visual indication of mute from headset This change uses new binder api changes to bring down mute status from TeleService. mute state routed through AudioModeProvider. bug:10395427 Change-Id: Ie15efcc780e99072363188de2a954a1888eec9dd --- .../src/com/android/incallui/AudioModeProvider.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'InCallUI/src/com/android/incallui/AudioModeProvider.java') diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java index 6ac8e23c2..36ec20ffa 100644 --- a/InCallUI/src/com/android/incallui/AudioModeProvider.java +++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java @@ -30,17 +30,26 @@ import java.util.List; private static AudioModeProvider sAudioModeProvider; private int mAudioMode = AudioMode.EARPIECE; + private boolean mMuted = false; private int mSupportedModes = AudioMode.ALL_MODES; private final List mListeners = Lists.newArrayList(); public AudioModeProvider() { } - public void onAudioModeChange(int newMode) { - mAudioMode = newMode; + public void onAudioModeChange(int newMode, boolean muted) { + if (mAudioMode != newMode) { + mAudioMode = newMode; + for (AudioModeListener l : mListeners) { + l.onAudioMode(mAudioMode); + } + } - for (AudioModeListener l : mListeners) { - l.onAudioMode(mAudioMode); + if (mMuted != muted) { + mMuted = muted; + for (AudioModeListener l : mListeners) { + l.onMute(mMuted); + } } } @@ -57,6 +66,7 @@ import java.util.List; mListeners.add(listener); listener.onSupportedAudioMode(mSupportedModes); listener.onAudioMode(mAudioMode); + listener.onMute(mMuted); } } @@ -76,6 +86,7 @@ import java.util.List; /* package */ interface AudioModeListener { void onAudioMode(int newMode); + void onMute(boolean muted); void onSupportedAudioMode(int modeMask); } } -- cgit v1.2.3