summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/incallui/CallButtonPresenter.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java
index 3fd3ee64b..a8b060daa 100644
--- a/java/com/android/incallui/CallButtonPresenter.java
+++ b/java/com/android/incallui/CallButtonPresenter.java
@@ -62,13 +62,14 @@ public class CallButtonPresenter
Listener,
InCallButtonUiDelegate {
- private static final String KEY_AUTOMATICALLY_MUTED = "incall_key_automatically_muted";
+ private static final String KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL =
+ "incall_key_automatically_muted_by_add_call";
private static final String KEY_PREVIOUS_MUTE_STATE = "incall_key_previous_mute_state";
private final Context context;
private InCallButtonUi inCallButtonUi;
private DialerCall call;
- private boolean automaticallyMuted = false;
+ private boolean automaticallyMutedByAddCall = false;
private boolean previousMuteState = false;
private boolean isInCallButtonUiReady;
private PhoneAccountHandle otherAccount;
@@ -276,8 +277,14 @@ public class CallButtonPresenter
DialerImpression.Type.IN_CALL_ADD_CALL_BUTTON_PRESSED,
call.getUniqueCallId(),
call.getTimeAddedMs());
+ if (automaticallyMutedByAddCall) {
+ // 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. Otherwise,
+ // we set previousMuteState wrong.
+ return;
+ }
// Automatically mute the current call
- automaticallyMuted = true;
+ automaticallyMutedByAddCall = true;
previousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted();
// Simulate a click on the mute button
muteClicked(true /* checked */, false /* clickedByUser */);
@@ -540,25 +547,27 @@ public class CallButtonPresenter
@Override
public void refreshMuteState() {
// Restore the previous mute state
- if (automaticallyMuted
+ if (automaticallyMutedByAddCall
&& AudioModeProvider.getInstance().getAudioState().isMuted() != previousMuteState) {
if (inCallButtonUi == null) {
return;
}
muteClicked(previousMuteState, false /* clickedByUser */);
}
- automaticallyMuted = false;
+ automaticallyMutedByAddCall = false;
}
@Override
public void onSaveInstanceState(Bundle outState) {
- outState.putBoolean(KEY_AUTOMATICALLY_MUTED, automaticallyMuted);
+ outState.putBoolean(KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall);
outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState);
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
- automaticallyMuted = savedInstanceState.getBoolean(KEY_AUTOMATICALLY_MUTED, automaticallyMuted);
+ automaticallyMutedByAddCall =
+ savedInstanceState.getBoolean(
+ KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall);
previousMuteState = savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState);
}