diff options
Diffstat (limited to 'java/com/android/incallui/InCallPresenter.java')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 150499f73..17af75691 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -273,6 +273,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud private SpeakEasyCallManager speakEasyCallManager; + private boolean addCallClicked = false; + private boolean automaticallyMutedByAddCall = false; + /** Inaccessible constructor. Must use getRunningInstance() to get this singleton. */ @VisibleForTesting InCallPresenter() {} @@ -1226,7 +1229,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud proximitySensor.onInCallShowing(showing); } - if (!showing) { + if (showing) { + refreshMuteState(); + } else { updateIsChangingConfigurations(); } @@ -2033,5 +2038,38 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud return true; } + public void addCallClicked() { + if (addCallClicked) { + // Since clicking add call button brings user to MainActivity and coming back refreshes mute + // state, add call button should only be clicked once during InCallActivity shows. + return; + } + addCallClicked = true; + if (!AudioModeProvider.getInstance().getAudioState().isMuted()) { + // Automatically mute the current call + TelecomAdapter.getInstance().mute(true); + automaticallyMutedByAddCall = true; + } + TelecomAdapter.getInstance().addCall(); + } + + /** Refresh mute state after call UI resuming from add call screen. */ + public void refreshMuteState() { + LogUtil.i( + "InCallPresenter.refreshMuteState", + "refreshMuteStateAfterAddCall: %b addCallClicked: %b", + automaticallyMutedByAddCall, + addCallClicked); + if (!addCallClicked) { + return; + } + if (automaticallyMutedByAddCall) { + // Restore the previous mute state + TelecomAdapter.getInstance().mute(false); + automaticallyMutedByAddCall = false; + } + addCallClicked = false; + } + private final Set<InCallUiLock> inCallUiLocks = new ArraySet<>(); } |