From 7b86f5621bb130bc1517db11a706d1518d141a52 Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 16 Nov 2017 11:24:09 -0800 Subject: Merge the following methods in InCallActivityCommon into InCallActivity: 1. maybeShowErrorDialogOnDisconnect(DisconnectMessage), 2. onDialogDismissed(), 3. showErrorDialog(Dialog, CharSequence), 4. showInternationalCallOnWifiDialog(DialerCall), 5. showWifiFailedDialog(DialerCall), and 6. showWifiToLteHandoverToast(DialerCall). Renaming in InCallActivity: 1. "maybeShowErrorDialogOnDisconnect" -> "showDialogOrToastForDisconnectedCall", 2. "onHandoverToWifiFailed" -> "showDialogOrToastForWifiHandoverFailure", 3. "onInternationalCallOnWifi" -> "showDialogForInternationalCallOnWifi", and 4. "onWiFiToLteHandover" -> "showToastForWiFiToLteHandover". This is part of the effort to delete InCallActivityCommon. Bug: 69272096 Test: None PiperOrigin-RevId: 175991784 Change-Id: I0b31bd93437e633d2f77b09982e0c7fc94ad8a32 --- java/com/android/incallui/InCallPresenter.java | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) (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 fc2f34efe..3ba2ccff6 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -467,7 +467,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud // By the time the UI finally comes up, the call may already be disconnected. // If that's the case, we may need to show an error dialog. if (mCallList != null && mCallList.getDisconnectedCall() != null) { - maybeShowErrorDialogOnDisconnect(mCallList.getDisconnectedCall()); + showDialogOrToastForDisconnectedCall(mCallList.getDisconnectedCall()); } // When the UI comes up, we need to first check the in-call state. @@ -681,14 +681,14 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud @Override public void onWiFiToLteHandover(DialerCall call) { if (mInCallActivity != null) { - mInCallActivity.onWiFiToLteHandover(call); + mInCallActivity.showToastForWiFiToLteHandover(call); } } @Override public void onHandoverToWifiFailed(DialerCall call) { if (mInCallActivity != null) { - mInCallActivity.onHandoverToWifiFailed(call); + mInCallActivity.showDialogOrToastForWifiHandoverFailure(call); } } @@ -696,7 +696,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud public void onInternationalCallOnWifi(@NonNull DialerCall call) { LogUtil.enterBlock("InCallPresenter.onInternationalCallOnWifi"); if (mInCallActivity != null) { - mInCallActivity.onInternationalCallOnWifi(call); + mInCallActivity.showDialogForInternationalCallOnWifi(call); } } @@ -832,7 +832,7 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud */ @Override public void onDisconnect(DialerCall call) { - maybeShowErrorDialogOnDisconnect(call); + showDialogOrToastForDisconnectedCall(call); // We need to do the run the same code as onCallListChange. onCallListChange(mCallList); @@ -1241,19 +1241,19 @@ public class InCallPresenter implements CallList.Listener, AudioModeProvider.Aud } } - /** - * For some disconnected causes, we show a dialog. This calls into the activity to show the dialog - * if appropriate for the call. - */ - private void maybeShowErrorDialogOnDisconnect(DialerCall call) { + /** Instruct the in-call activity to show an error dialog or toast for a disconnected call. */ + private void showDialogOrToastForDisconnectedCall(DialerCall call) { + if (!isActivityStarted() || call.getState() != DialerCall.State.DISCONNECTED) { + return; + } + // For newly disconnected calls, we may want to show a dialog on specific error conditions - if (isActivityStarted() && call.getState() == DialerCall.State.DISCONNECTED) { - if (call.getAccountHandle() == null && !call.isConferenceCall()) { - setDisconnectCauseForMissingAccounts(call); - } - mInCallActivity.maybeShowErrorDialogOnDisconnect( - new DisconnectMessage(mInCallActivity, call)); + if (call.getAccountHandle() == null && !call.isConferenceCall()) { + setDisconnectCauseForMissingAccounts(call); } + + mInCallActivity.showDialogOrToastForDisconnectedCall( + new DisconnectMessage(mInCallActivity, call)); } /** -- cgit v1.2.3