diff options
author | Ta-wei Yen <twyen@google.com> | 2019-04-16 23:22:29 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-16 23:22:29 +0000 |
commit | ebd9bf21e5ae8d31ce99a35b03ced9301e0ef86c (patch) | |
tree | 00a079993169ab7e1a15cff6f866d389c2b8bee6 /java/com/android/incallui/InCallPresenter.java | |
parent | 9cd154587cdecc6480b3dffa7c575c8e7ce14b86 (diff) | |
parent | a702084a20b3edc6536c5e3527b065c1d99640e4 (diff) |
Merge "Fix the issue that automatic mute state remains ON after adding VT call"
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<>(); } |