diff options
author | Yorke Lee <yorkelee@google.com> | 2013-09-03 23:14:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-03 23:14:41 +0000 |
commit | 000b7aaeae220791fe50d0a372f1cad4fb9258b1 (patch) | |
tree | 6f19ab3d97482b3bb9db8b9a5b98ba5b4f023e20 | |
parent | c6d8461a2b7f0684a1246ba36b3da5638cfada37 (diff) | |
parent | 37fa54617a6eb207284ea619133ed50a1156ff1d (diff) |
Merge "Automatically unmute call if user decides not to add call" into klp-dev
-rw-r--r-- | InCallUI/src/com/android/incallui/AudioModeProvider.java | 4 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonPresenter.java | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/AudioModeProvider.java b/InCallUI/src/com/android/incallui/AudioModeProvider.java index 36ec20ffa..8224d3e20 100644 --- a/InCallUI/src/com/android/incallui/AudioModeProvider.java +++ b/InCallUI/src/com/android/incallui/AudioModeProvider.java @@ -84,6 +84,10 @@ import java.util.List; return mAudioMode; } + public boolean getMute() { + return mMuted; + } + /* package */ interface AudioModeListener { void onAudioMode(int newMode); void onMute(boolean muted); diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 6e64e65c4..bc9efe507 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -32,6 +32,8 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto private Call mCall; private AudioModeProvider mAudioModeProvider; private ProximitySensor mProximitySensor; + private boolean mAutomaticallyMuted = false; + private boolean mPreviousMuteState = false; public CallButtonPresenter() { } @@ -166,6 +168,11 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } public void addCallClicked() { + // Automatically mute the current call + mAutomaticallyMuted = true; + mPreviousMuteState = mAudioModeProvider.getMute(); + getUi().setMute(true); + CallCommandClient.getInstance().addCall(); } @@ -204,6 +211,12 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto ui.showMerge(call.can(Capabilities.MERGE_CALLS)); ui.showSwap(call.can(Capabilities.SWAP_CALLS)); ui.showAddCall(call.can(Capabilities.ADD_CALL)); + + // Restore the previous mute state + if (mAutomaticallyMuted && mAudioModeProvider.getMute() != mPreviousMuteState) { + ui.setMute(mPreviousMuteState); + mAutomaticallyMuted = false; + } } } |