diff options
author | Ihab Awad <ihab@google.com> | 2014-06-03 18:49:09 -0700 |
---|---|---|
committer | Ihab Awad <ihab@google.com> | 2014-06-05 05:58:32 +0000 |
commit | 20715cbb1d1d3f508642fde24f66c7db873e95a1 (patch) | |
tree | cdfa05cb7a91a1346fdee4afba96b33bfce7214a /InCallUI/src/com/android/incallui/InCallActivity.java | |
parent | abffbe0a23b2e132a8ba0c9190ce9fba396d238d (diff) |
DO NOT MERGE. Implement connection error dialogs (4/4)
Implement reporting of connection errors from ConnectionServices through
Telecomm to the InCallUI.
Bug: 15195720
Bug: 15117141
Change-Id: Ie466efb8badaab6785fb474c1c3d843a3234757a
(cherry picked from commit 8656969cd1a34c01a5f2a2d254f124a63df362df)
Diffstat (limited to 'InCallUI/src/com/android/incallui/InCallActivity.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 7769a0b7b..6deae1fe7 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -515,21 +515,55 @@ public class InCallActivity extends Activity { } private int getResIdForDisconnectCause(int cause) { - int resId = INVALID_RES_ID; - - if (cause == DisconnectCause.CALL_BARRED) { - resId = R.string.callFailed_cb_enabled; - } else if (cause == DisconnectCause.FDN_BLOCKED) { - resId = R.string.callFailed_fdn_only; - } else if (cause == DisconnectCause.CS_RESTRICTED) { - resId = R.string.callFailed_dsac_restricted; - } else if (cause == DisconnectCause.CS_RESTRICTED_EMERGENCY) { - resId = R.string.callFailed_dsac_restricted_emergency; - } else if (cause == DisconnectCause.CS_RESTRICTED_NORMAL) { - resId = R.string.callFailed_dsac_restricted_normal; + switch (cause) { + case DisconnectCause.CALL_BARRED: + return R.string.callFailed_cb_enabled; + case DisconnectCause.FDN_BLOCKED: + return R.string.callFailed_fdn_only; + case DisconnectCause.CS_RESTRICTED: + return R.string.callFailed_dsac_restricted; + case DisconnectCause.CS_RESTRICTED_EMERGENCY: + return R.string.callFailed_dsac_restricted_emergency; + case DisconnectCause.CS_RESTRICTED_NORMAL: + return R.string.callFailed_dsac_restricted_normal; + case DisconnectCause.ERROR_UNSPECIFIED: + // We couldn't successfully place the call; there was some + // failure in the telephony layer. + // TODO: Need UI spec for this failure case; for now just + // show a generic error. + return R.string.incall_error_call_failed; + case DisconnectCause.POWER_OFF: + // Radio is explictly powered off, presumably because the + // device is in airplane mode. + // + // TODO: For now this UI is ultra-simple: we simply display + // a message telling the user to turn off airplane mode. + // But it might be nicer for the dialog to offer the option + // to turn the radio on right there (and automatically retry + // the call once network registration is complete.) + return R.string.incall_error_power_off; + case DisconnectCause.EMERGENCY_ONLY: + // Only emergency numbers are allowed, but we tried to dial + // a non-emergency number. + return R.string.incall_error_emergency_only; + case DisconnectCause.OUT_OF_SERVICE: + // No network connection. + return R.string.incall_error_out_of_service; + case DisconnectCause.NO_PHONE_NUMBER_SUPPLIED: + // The supplied Intent didn't contain a valid phone number. + // (This is rare and should only ever happen with broken + // 3rd-party apps.) For now just show a generic error. + return R.string.incall_error_no_phone_number_supplied; + case DisconnectCause.VOICEMAIL_NUMBER_MISSING: + // TODO: Need to bring up the "Missing Voicemail Number" dialog, which + // will ultimately take us to the Call Settings. + return R.string.incall_error_missing_voicemail_number; + case DisconnectCause.DIALED_MMI: + // TODO: Implement MMI; see MMIDialogActivity in packages/services/Telephony + return INVALID_RES_ID; + default: + return INVALID_RES_ID; } - - return resId; } private void onDialogDismissed() { |