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 | |
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')
-rw-r--r-- | InCallUI/res/values/strings.xml | 4 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 62 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallServiceImpl.java | 6 |
3 files changed, 53 insertions, 19 deletions
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index 266ac582b..4fef3f69b 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -61,7 +61,7 @@ <!-- In-call screen: call failure reason (SIM error) --> <string name="callFailed_simError">No SIM or SIM error</string> <!-- In-call screen: call failure reason (out of service) --> - <string name="callFailed_outOfService">Out of service area</string> + <string name="callFailed_outOfService">Mobile network not available</string> <!-- In-call screen: call failure reason (call denied because of current FDN setting) --> <string name="callFailed_fdn_only">Outgoing calls are restricted by FDN.</string> <!-- In-call screen: call failure reason (call denied because call barring is on) --> @@ -225,6 +225,8 @@ <string name="incall_error_supp_service_reject">Unable to reject call.</string> <!-- In-call screen: message displayed in an error dialog --> <string name="incall_error_supp_service_hangup">Unable to release call(s).</string> + <!-- In-call screen: message displayed in an error dialog --> + <string name="incall_error_missing_voicemail_number">Voicemail number unknown.</string> <!-- In-call screen: "call type" indication for a SIP call [CHAR LIMIT=30] --> <string name="incall_call_type_label_sip">Internet call</string> 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() { diff --git a/InCallUI/src/com/android/incallui/InCallServiceImpl.java b/InCallUI/src/com/android/incallui/InCallServiceImpl.java index bcafbee4f..1ca19db46 100644 --- a/InCallUI/src/com/android/incallui/InCallServiceImpl.java +++ b/InCallUI/src/com/android/incallui/InCallServiceImpl.java @@ -17,13 +17,11 @@ package com.android.incallui; import android.telecomm.CallAudioState; -import android.telecomm.CallCapabilities; import android.telecomm.CallState; -import android.telecomm.GatewayInfo; +import android.telecomm.ConnectionRequest; import android.telecomm.InCallAdapter; import android.telecomm.InCallCall; import android.telecomm.InCallService; -import android.telephony.DisconnectCause; import com.google.common.collect.ImmutableList; @@ -118,7 +116,7 @@ public class InCallServiceImpl extends InCallService { private void updateCall(Call call, InCallCall telecommCall) { call.setHandle(telecommCall.getHandle()); - call.setDisconnectCause(telecommCall.getDisconnectCause()); + call.setDisconnectCause(telecommCall.getDisconnectCauseCode()); call.setCapabilities(telecommCall.getCapabilities()); call.setConnectTimeMillis(telecommCall.getConnectTimeMillis()); call.setGatewayInfo(telecommCall.getGatewayInfo()); |