Loading java/com/android/incallui/CallButtonPresenter.java +3 −41 Original line number Diff line number Diff line Loading @@ -62,15 +62,9 @@ public class CallButtonPresenter InCallButtonUiDelegate, DialerCallListener { 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 automaticallyMutedByAddCall = false; private boolean previousMuteState = false; private boolean isInCallButtonUiReady; private PhoneAccountHandle otherAccount; Loading Loading @@ -288,18 +282,7 @@ 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 automaticallyMutedByAddCall = true; previousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted(); // Simulate a click on the mute button muteClicked(true /* checked */, false /* clickedByUser */); TelecomAdapter.getInstance().addCall(); InCallPresenter.getInstance().addCallClicked(); } @Override Loading Loading @@ -554,31 +537,10 @@ public class CallButtonPresenter } @Override public void refreshMuteState() { // Restore the previous mute state if (automaticallyMutedByAddCall && AudioModeProvider.getInstance().getAudioState().isMuted() != previousMuteState) { if (inCallButtonUi == null) { return; } muteClicked(previousMuteState, false /* clickedByUser */); } automaticallyMutedByAddCall = false; } @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall); outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState); } public void onSaveInstanceState(Bundle outState) {} @Override public void onRestoreInstanceState(Bundle savedInstanceState) { automaticallyMutedByAddCall = savedInstanceState.getBoolean( KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall); previousMuteState = savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState); } public void onRestoreInstanceState(Bundle savedInstanceState) {} @Override public void onCameraPermissionGranted() { Loading java/com/android/incallui/InCallPresenter.java +39 −1 Original line number Diff line number Diff line Loading @@ -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() {} Loading Loading @@ -1226,7 +1229,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud proximitySensor.onInCallShowing(showing); } if (!showing) { if (showing) { refreshMuteState(); } else { updateIsChangingConfigurations(); } Loading Loading @@ -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<>(); } java/com/android/incallui/callpending/CallPendingActivity.java +0 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,6 @@ public class CallPendingActivity extends FragmentActivity @Override public void onRestoreInstanceState(Bundle savedInstanceState) {} @Override public void refreshMuteState() {} @Override public void addCallClicked() {} Loading java/com/android/incallui/incall/impl/InCallFragment.java +0 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,6 @@ public class InCallFragment extends Fragment @Override public void onResume() { super.onResume(); inCallButtonUiDelegate.refreshMuteState(); inCallScreenDelegate.onInCallScreenResumed(); } Loading java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java +0 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ public interface InCallButtonUiDelegate { void onRestoreInstanceState(Bundle savedInstanceState); void refreshMuteState(); void addCallClicked(); void muteClicked(boolean checked, boolean clickedByUser); Loading Loading
java/com/android/incallui/CallButtonPresenter.java +3 −41 Original line number Diff line number Diff line Loading @@ -62,15 +62,9 @@ public class CallButtonPresenter InCallButtonUiDelegate, DialerCallListener { 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 automaticallyMutedByAddCall = false; private boolean previousMuteState = false; private boolean isInCallButtonUiReady; private PhoneAccountHandle otherAccount; Loading Loading @@ -288,18 +282,7 @@ 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 automaticallyMutedByAddCall = true; previousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted(); // Simulate a click on the mute button muteClicked(true /* checked */, false /* clickedByUser */); TelecomAdapter.getInstance().addCall(); InCallPresenter.getInstance().addCallClicked(); } @Override Loading Loading @@ -554,31 +537,10 @@ public class CallButtonPresenter } @Override public void refreshMuteState() { // Restore the previous mute state if (automaticallyMutedByAddCall && AudioModeProvider.getInstance().getAudioState().isMuted() != previousMuteState) { if (inCallButtonUi == null) { return; } muteClicked(previousMuteState, false /* clickedByUser */); } automaticallyMutedByAddCall = false; } @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall); outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState); } public void onSaveInstanceState(Bundle outState) {} @Override public void onRestoreInstanceState(Bundle savedInstanceState) { automaticallyMutedByAddCall = savedInstanceState.getBoolean( KEY_AUTOMATICALLY_MUTED_BY_ADD_CALL, automaticallyMutedByAddCall); previousMuteState = savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, previousMuteState); } public void onRestoreInstanceState(Bundle savedInstanceState) {} @Override public void onCameraPermissionGranted() { Loading
java/com/android/incallui/InCallPresenter.java +39 −1 Original line number Diff line number Diff line Loading @@ -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() {} Loading Loading @@ -1226,7 +1229,9 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud proximitySensor.onInCallShowing(showing); } if (!showing) { if (showing) { refreshMuteState(); } else { updateIsChangingConfigurations(); } Loading Loading @@ -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<>(); }
java/com/android/incallui/callpending/CallPendingActivity.java +0 −3 Original line number Diff line number Diff line Loading @@ -231,9 +231,6 @@ public class CallPendingActivity extends FragmentActivity @Override public void onRestoreInstanceState(Bundle savedInstanceState) {} @Override public void refreshMuteState() {} @Override public void addCallClicked() {} Loading
java/com/android/incallui/incall/impl/InCallFragment.java +0 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,6 @@ public class InCallFragment extends Fragment @Override public void onResume() { super.onResume(); inCallButtonUiDelegate.refreshMuteState(); inCallScreenDelegate.onInCallScreenResumed(); } Loading
java/com/android/incallui/incall/protocol/InCallButtonUiDelegate.java +0 −2 Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ public interface InCallButtonUiDelegate { void onRestoreInstanceState(Bundle savedInstanceState); void refreshMuteState(); void addCallClicked(); void muteClicked(boolean checked, boolean clickedByUser); Loading