diff options
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r-- | java/com/android/incallui/InCallActivity.java | 54 | ||||
-rw-r--r-- | java/com/android/incallui/InCallActivityCommon.java | 70 |
2 files changed, 77 insertions, 47 deletions
diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index 93534697c..f9311f8d3 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -16,6 +16,7 @@ package com.android.incallui; +import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.graphics.drawable.GradientDrawable; @@ -35,6 +36,7 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; +import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.ThreadUtil; @@ -60,6 +62,7 @@ import com.android.incallui.incall.protocol.InCallButtonUiDelegateFactory; import com.android.incallui.incall.protocol.InCallScreen; import com.android.incallui.incall.protocol.InCallScreenDelegate; import com.android.incallui.incall.protocol.InCallScreenDelegateFactory; +import com.android.incallui.telecomeventui.InternationalCallOnWifiDialogFragment; import com.android.incallui.video.bindings.VideoBindings; import com.android.incallui.video.protocol.VideoCallScreen; import com.android.incallui.video.protocol.VideoCallScreenDelegate; @@ -77,8 +80,9 @@ public class InCallActivity extends TransactionSafeFragmentActivity public static final int PENDING_INTENT_REQUEST_CODE_FULL_SCREEN = 1; public static final int PENDING_INTENT_REQUEST_CODE_BUBBLE = 2; - private static final String TAG_IN_CALL_SCREEN = "tag_in_call_screen"; private static final String TAG_ANSWER_SCREEN = "tag_answer_screen"; + private static final String TAG_INTERNATIONAL_CALL_ON_WIFI = "tag_international_call_on_wifi"; + private static final String TAG_IN_CALL_SCREEN = "tag_in_call_screen"; private static final String TAG_VIDEO_CALL_SCREEN = "tag_video_call_screen"; private static final String DID_SHOW_ANSWER_SCREEN_KEY = "did_show_answer_screen"; @@ -442,21 +446,47 @@ public class InCallActivity extends TransactionSafeFragmentActivity } public void dismissPendingDialogs() { - if (isVisible) { - LogUtil.i("InCallActivity.dismissPendingDialogs", ""); - common.dismissPendingDialogs(); - AnswerScreen answerScreen = getAnswerScreen(); - if (answerScreen != null) { - answerScreen.dismissPendingDialogs(); - } - needDismissPendingDialogs = false; - } else { - // The activity is not visible and onSaveInstanceState may have been called so defer the - // dismissing action. + LogUtil.i("InCallActivity.dismissPendingDialogs", ""); + + if (!isVisible) { + // Defer the dismissing action as the activity is not visible and onSaveInstanceState may have + // been called. LogUtil.i( "InCallActivity.dismissPendingDialogs", "defer actions since activity is not visible"); needDismissPendingDialogs = true; + return; + } + + // Dismiss the error dialog + Dialog errorDialog = common.getErrorDialog(); + if (errorDialog != null) { + errorDialog.dismiss(); + common.setErrorDialog(null); } + + // Dismiss the phone account selection dialog + SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment = + common.getSelectPhoneAccountDialogFragment(); + if (selectPhoneAccountDialogFragment != null) { + selectPhoneAccountDialogFragment.dismiss(); + common.setSelectPhoneAccountDialogFragment(null); + } + + // Dismiss the dialog for international call on WiFi + InternationalCallOnWifiDialogFragment internationalCallOnWifiFragment = + (InternationalCallOnWifiDialogFragment) + getSupportFragmentManager().findFragmentByTag(TAG_INTERNATIONAL_CALL_ON_WIFI); + if (internationalCallOnWifiFragment != null) { + internationalCallOnWifiFragment.dismiss(); + } + + // Dismiss the answer screen + AnswerScreen answerScreen = getAnswerScreen(); + if (answerScreen != null) { + answerScreen.dismissPendingDialogs(); + } + + needDismissPendingDialogs = false; } private void enableInCallOrientationEventListener(boolean enable) { diff --git a/java/com/android/incallui/InCallActivityCommon.java b/java/com/android/incallui/InCallActivityCommon.java index 3914e386c..e9c2467ef 100644 --- a/java/com/android/incallui/InCallActivityCommon.java +++ b/java/com/android/incallui/InCallActivityCommon.java @@ -105,7 +105,7 @@ public class InCallActivityCommon { private boolean showPostCharWaitDialogOnResume; private String showPostCharWaitDialogCallId; private String showPostCharWaitDialogChars; - private Dialog dialog; + private Dialog errorDialog; private SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment; private InCallOrientationEventListener inCallOrientationEventListener; private Animation dialpadSlideInAnimation; @@ -346,8 +346,8 @@ public class InCallActivityCommon { InCallPresenter.getInstance().onActivityStopped(); if (!isRecreating) { InCallPresenter.getInstance().onUiShowing(false); - if (dialog != null) { - dialog.dismiss(); + if (errorDialog != null) { + errorDialog.dismiss(); } } } @@ -574,29 +574,6 @@ public class InCallActivityCommon { } } - void dismissPendingDialogs() { - if (dialog != null) { - dialog.dismiss(); - dialog = null; - } - if (selectPhoneAccountDialogFragment != null) { - selectPhoneAccountDialogFragment.dismiss(); - selectPhoneAccountDialogFragment = null; - } - - InternationalCallOnWifiDialogFragment internationalCallOnWifiFragment = - (InternationalCallOnWifiDialogFragment) - inCallActivity - .getSupportFragmentManager() - .findFragmentByTag(TAG_INTERNATIONAL_CALL_ON_WIFI); - if (internationalCallOnWifiFragment != null) { - LogUtil.i( - "InCallActivityCommon.dismissPendingDialogs", - "dismissing InternationalCallOnWifiDialogFragment"); - internationalCallOnWifiFragment.dismiss(); - } - } - private void showErrorDialog(Dialog dialog, CharSequence message) { LogUtil.i("InCallActivityCommon.showErrorDialog", "message: %s", message); inCallActivity.dismissPendingDialogs(); @@ -607,7 +584,7 @@ public class InCallActivityCommon { return; } - this.dialog = dialog; + this.errorDialog = dialog; InCallUiLock lock = InCallPresenter.getInstance().acquireInCallUiLock("showErrorDialog"); dialog.setOnDismissListener( new OnDismissListener() { @@ -623,7 +600,7 @@ public class InCallActivityCommon { } private void onDialogDismissed() { - dialog = null; + errorDialog = null; CallList.getInstance().onErrorDialogDismissed(); } @@ -687,7 +664,7 @@ public class InCallActivityCommon { return; } - dismissPendingDialogs(); + inCallActivity.dismissPendingDialogs(); AlertDialog.Builder builder = new AlertDialog.Builder(inCallActivity) @@ -701,7 +678,7 @@ public class InCallActivityCommon { wifiHandoverFailureCheckbox.setChecked(false); InCallUiLock lock = InCallPresenter.getInstance().acquireInCallUiLock("WifiFailedDialog"); - dialog = + errorDialog = builder .setView(dialogCheckBoxView) .setMessage(R.string.video_call_lte_to_wifi_failed_message) @@ -727,7 +704,7 @@ public class InCallActivityCommon { .create(); LogUtil.i("InCallActivityCommon.showWifiFailedDialog", "as dialog"); - dialog.show(); + errorDialog.show(); } void updateNavigationBar(boolean isDialpadVisible) { @@ -852,10 +829,6 @@ public class InCallActivityCommon { inCallActivity.setTaskDescription(td); } - public boolean hasPendingDialogs() { - return dialog != null; - } - private void internalResolveIntent(Intent intent) { if (!intent.getAction().equals(Intent.ACTION_MAIN)) { return; @@ -925,4 +898,31 @@ public class InCallActivityCommon { inCallActivity.getFragmentManager(), TAG_SELECT_ACCOUNT_FRAGMENT); return true; } + + /** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */ + @Deprecated + @Nullable + Dialog getErrorDialog() { + return errorDialog; + } + + /** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */ + @Deprecated + void setErrorDialog(@Nullable Dialog errorDialog) { + this.errorDialog = errorDialog; + } + + /** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */ + @Deprecated + @Nullable + SelectPhoneAccountDialogFragment getSelectPhoneAccountDialogFragment() { + return selectPhoneAccountDialogFragment; + } + + /** @deprecated Only for temporary use during the deprecation of {@link InCallActivityCommon} */ + @Deprecated + void setSelectPhoneAccountDialogFragment( + @Nullable SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment) { + this.selectPhoneAccountDialogFragment = selectPhoneAccountDialogFragment; + } } |