From a702084a20b3edc6536c5e3527b065c1d99640e4 Mon Sep 17 00:00:00 2001 From: Sekine Yasuaki Date: Thu, 31 May 2018 17:10:12 +0900 Subject: Fix the issue that automatic mute state remains ON after adding VT call An issue occurs because InCallFragment#onResume() that release the automatic mute state is not called when switching fragments by adding call. To resolve this issue, handle automatic mute state in InCallActivity. Bug: 110815828 Test: Checked that the mute state is turned OFF when add a video call during a voice call. Change-Id: Ided7c58e1148f6ee12bdfeaa813d596a4716c1d6 --- java/com/android/incallui/InCallPresenter.java | 40 +++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'java/com/android/incallui/InCallPresenter.java') 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 inCallUiLocks = new ArraySet<>(); } -- cgit v1.2.3