From 20715cbb1d1d3f508642fde24f66c7db873e95a1 Mon Sep 17 00:00:00 2001 From: Ihab Awad Date: Tue, 3 Jun 2014 18:49:09 -0700 Subject: 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) --- InCallUI/res/values/strings.xml | 4 +- .../src/com/android/incallui/InCallActivity.java | 62 +++++++++++++++++----- .../com/android/incallui/InCallServiceImpl.java | 6 +-- 3 files changed, 53 insertions(+), 19 deletions(-) (limited to 'InCallUI') 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 @@ No SIM or SIM error - Out of service area + Mobile network not available Outgoing calls are restricted by FDN. @@ -225,6 +225,8 @@ Unable to reject call. Unable to release call(s). + + Voicemail number unknown. Internet call 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()); -- cgit v1.2.3