diff options
6 files changed, 36 insertions, 8 deletions
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<AudioModeListener> 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); } } diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index a1592924b..bd193818a 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -201,6 +201,8 @@ public class CallButtonFragment @Override public void setAudio(int mode) { + updateAudioButtons(getPresenter().getSupportedAudio()); + refreshAudioModePopup(); } @Override diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 9db383fdd..6e64e65c4 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -79,6 +79,13 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } } + @Override + public void onMute(boolean muted) { + if (getUi() != null) { + getUi().setMute(muted); + } + } + public int getAudioMode() { if (mAudioModeProvider != null) { return mAudioModeProvider.getAudioMode(); @@ -140,7 +147,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto Log.d(this, "turning on mute: " + checked); CallCommandClient.getInstance().mute(checked); - getUi().setMute(checked); } public void holdClicked(boolean checked) { diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index c06806926..0b6f54104 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -199,6 +199,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> public void onSupportedAudioMode(int mask) { } + @Override + public void onMute(boolean muted) { + } + public void updateCallTime() { final CallCardUi ui = getUi(); diff --git a/InCallUI/src/com/android/incallui/CallHandlerService.java b/InCallUI/src/com/android/incallui/CallHandlerService.java index ca749aa46..b73135590 100644 --- a/InCallUI/src/com/android/incallui/CallHandlerService.java +++ b/InCallUI/src/com/android/incallui/CallHandlerService.java @@ -155,10 +155,11 @@ public class CallHandlerService extends Service { } @Override - public void onAudioModeChange(int mode) { + public void onAudioModeChange(int mode, boolean muted) { try { Log.d(CallHandlerService.this, "onAudioModeChange : " + AudioMode.toString(mode)); - mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode, 0, null)); + mMainHandler.sendMessage(mMainHandler.obtainMessage(ON_AUDIO_MODE, mode, + muted ? 1 : 0, null)); } catch (Exception e) { Log.e(TAG, "Error processing onAudioModeChange() call.", e); } @@ -223,7 +224,7 @@ public class CallHandlerService extends Service { mCallList.onDisconnect((Call) msg.obj); break; case ON_AUDIO_MODE: - mAudioModeProvider.onAudioModeChange(msg.arg1); + mAudioModeProvider.onAudioModeChange(msg.arg1, msg.arg2 == 1); break; case ON_SUPPORTED_AUDIO_MODE: mAudioModeProvider.onSupportedAudioModeChange(msg.arg1); diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java index 0012e8a0f..4befb2b25 100644 --- a/InCallUI/src/com/android/incallui/ProximitySensor.java +++ b/InCallUI/src/com/android/incallui/ProximitySensor.java @@ -96,6 +96,10 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene public void onSupportedAudioMode(int modeMask) { } + @Override + public void onMute(boolean muted) { + } + /** * Called when the audio mode changes during a call. */ |