diff options
author | Basudev Achary Konderpu <bkonde@codeaurora.org> | 2014-06-05 21:00:07 +0530 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-07-31 13:26:17 -0700 |
commit | c8a0f9945c3ca1e89c2c5fce8ada56f3ff4c4f9b (patch) | |
tree | 9d4b3b764dcf9cad25b80ff31fc44caeb8e8cb79 | |
parent | e33fd4cc7c5ee1459e395e91f9ada3259d70154d (diff) | |
download | android_frameworks_opt_telephony-c8a0f9945c3ca1e89c2c5fce8ada56f3ff4c4f9b.tar.gz android_frameworks_opt_telephony-c8a0f9945c3ca1e89c2c5fce8ada56f3ff4c4f9b.tar.bz2 android_frameworks_opt_telephony-c8a0f9945c3ca1e89c2c5fce8ada56f3ff4c4f9b.zip |
IMS : Notifying CallModifyRequest Fail or sucess
1)Added new registrant to handle CallModifyRequest
Fail or success.
2)Added Error codes.
3)This will ensure failed response to be propagated
properly.
Change-Id: Ib5671d57e227e4e46bb548cb99703292eb6d4f6e
CRs-Fixed: 667503
5 files changed, 110 insertions, 0 deletions
diff --git a/src/java/com/android/internal/telephony/CallManager.java b/src/java/com/android/internal/telephony/CallManager.java index 84809fbe3..968ea03f2 100644 --- a/src/java/com/android/internal/telephony/CallManager.java +++ b/src/java/com/android/internal/telephony/CallManager.java @@ -85,6 +85,7 @@ public class CallManager { private static final int EVENT_POST_DIAL_CHARACTER = 119; private static final int EVENT_SUPP_SERVICE_NOTIFY = 120; private static final int EVENT_CALL_MODIFY = 121; + private static final int EVENT_CALL_MODIFY_RESPONSE = 122; private static final String PROPERTY_QCHAT_ENABLED = "persist.atel.qchat_enabled"; @@ -188,6 +189,9 @@ public class CallManager { protected final RegistrantList mCallModifyRegistrants = new RegistrantList(); + protected final RegistrantList mModifyCallResponseRegistrants + = new RegistrantList(); + protected CallManager() { mPhones = new ArrayList<Phone>(); mRingingCalls = new ArrayList<Call>(); @@ -573,6 +577,8 @@ public class CallManager { phone.registerForEcmTimerReset(mHandler, EVENT_ECM_TIMER_RESET, null); try { phone.registerForModifyCallRequest(mHandler, EVENT_CALL_MODIFY, null); + phone.registerForModifyCallResponse( + mHandler, EVENT_CALL_MODIFY_RESPONSE, null); } catch (CallStateException e) { Rlog.e(LOG_TAG, "registerForModifyCallRequest: CallStateException:" + e); } @@ -624,6 +630,7 @@ public class CallManager { phone.unregisterForEcmTimerReset(mHandler); try { phone.unregisterForModifyCallRequest(mHandler); + phone.unregisterForModifyCallResponse(mHandler); } catch (CallStateException e) { Rlog.e(LOG_TAG, "unregisterForModifyCallRequest ", e); } @@ -1718,6 +1725,17 @@ public class CallManager { mCallModifyRegistrants.remove(h); } + /* + * Registrants for CallModify Failed or Succeed + */ + public void registerForCallModifyResponse(Handler h, int what, Object obj) { + mModifyCallResponseRegistrants.addUnique(h, what, obj); + } + + public void unregisterForCallModifyResponse(Handler h) { + mModifyCallResponseRegistrants.remove(h); + } + /* APIs to access foregroudCalls, backgroudCalls, and ringingCalls * 1. APIs to access list of calls * 2. APIs to check if any active call, which has connection other than @@ -2093,6 +2111,16 @@ public class CallManager { notifyMsg.sendToTarget(); } break; + case EVENT_CALL_MODIFY_RESPONSE: + if (VDBG) Rlog.d(LOG_TAG, " handleMessage (EVENT_CALL_MODIFY_RESPONSE)"); + AsyncResult res = (AsyncResult) msg.obj; + if (res != null && res.result != null && res.exception == null) { + mModifyCallResponseRegistrants.notifyRegistrants(new AsyncResult(null, + res.result, null)); + } else { + Rlog.e(LOG_TAG, "EVENT_MODIFY_CALL_RESPONSE AsyncResult res= " + res); + } + break; } } } diff --git a/src/java/com/android/internal/telephony/CallModify.java b/src/java/com/android/internal/telephony/CallModify.java index f6d9f26df..45fece77a 100644 --- a/src/java/com/android/internal/telephony/CallModify.java +++ b/src/java/com/android/internal/telephony/CallModify.java @@ -32,8 +32,23 @@ public class CallModify { // Keep this error codes in sync with error codes defined in // imsIF.proto file. public static int E_SUCCESS = 0; + public static int E_RADIO_NOT_AVAILABLE = 1; + public static int E_GENERIC_FAILURE = 2; + public static int E_REQUEST_NOT_SUPPORTED = 6; public static int E_CANCELLED = 7; public static int E_UNUSED = 16; + public static int E_INVALID_PARAMETER = 27; + public static int E_REJECTED_BY_REMOTE = 28; + public static int E_IMS_DEREGISTERED = 29; + + private static final String ERR_RADIO_NOT_AVAILABLE = "E_RADIO_NOT_AVAILABLE"; + private static final String ERR_GENERIC_FAILURE = "E_GENERIC_FAILURE"; + private static final String ERR_REQUEST_NOT_SUPPORTED = "E_REQUEST_NOT_SUPPORTED"; + private static final String ERR_CANCELLED = "E_CANCELLED"; + private static final String ERR_UNUSED = "E_UNUSED"; + private static final String ERR_INVALID_PARAMETER = "E_INVALID_PARAMETER"; + private static final String ERR_REJECTED_BY_REMOTE = "E_REJECTED_BY_REMOTE"; + private static final String ERR_IMS_DEREGISTERED = "E_IMS_DEREGISTERED"; public int call_index; @@ -45,6 +60,12 @@ public class CallModify { this(new CallDetails(), 0); } + public CallModify(CallModify callmodify) { + setCallDetails(callmodify.call_details); + call_index = callmodify.call_index; + error = callmodify.error; + } + public CallModify(CallDetails callDetails, int callIndex) { this(callDetails, callIndex, E_SUCCESS); } @@ -75,4 +96,27 @@ public class CallModify { + " " + call_details + " " + error); } + + /** + * @return error ID + */ + public int convertErrorTypeToInt(String errorType) { + if (ERR_REJECTED_BY_REMOTE.equalsIgnoreCase(errorType)) { + return E_REJECTED_BY_REMOTE; + } else if (ERR_INVALID_PARAMETER.equalsIgnoreCase(errorType)) { + return E_INVALID_PARAMETER; + } else if (ERR_CANCELLED.equalsIgnoreCase(errorType)) { + return E_CANCELLED; + } else if (ERR_UNUSED.equalsIgnoreCase(errorType)) { + return E_UNUSED; + } else if (ERR_RADIO_NOT_AVAILABLE.equalsIgnoreCase(errorType)) { + return E_RADIO_NOT_AVAILABLE; + } else if (ERR_REQUEST_NOT_SUPPORTED.equalsIgnoreCase(errorType)) { + return E_REQUEST_NOT_SUPPORTED; + } else if (ERR_IMS_DEREGISTERED.equalsIgnoreCase(errorType)) { + return E_IMS_DEREGISTERED; + } else { + return E_GENERIC_FAILURE; + } + } } diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java index 6c78d8bb5..0816ef05e 100644 --- a/src/java/com/android/internal/telephony/Phone.java +++ b/src/java/com/android/internal/telephony/Phone.java @@ -1928,6 +1928,21 @@ public interface Phone { public void unregisterForModifyCallRequest(Handler h) throws CallStateException; /** + * When both the party in an IMS Call wants to upgrade or downgrade a + * call, a CallModifyRequest success or failure message is received. + * This function registers for that indication and sends a message + * to the handler when such an indication occurs. + * @param h The handler that will receive the message + * @param what The message to send + * @param obj User object to send with the message + * @throws CallStateException + */ + public void registerForModifyCallResponse(Handler h, int what, Object obj) + throws CallStateException; + + public void unregisterForModifyCallResponse(Handler h) throws CallStateException; + + /** * When upgrade to video call and remote party does not support AVPF, IMS * Phone retries upgrade request and this function registers for the failure * indication diff --git a/src/java/com/android/internal/telephony/PhoneBase.java b/src/java/com/android/internal/telephony/PhoneBase.java index b361aae89..d9aadd43c 100644 --- a/src/java/com/android/internal/telephony/PhoneBase.java +++ b/src/java/com/android/internal/telephony/PhoneBase.java @@ -244,6 +244,9 @@ public abstract class PhoneBase extends Handler implements Phone { protected final RegistrantList mSimRecordsLoadedRegistrants = new RegistrantList(); + protected final RegistrantList mModifyCallResponseRegistrants + = new RegistrantList(); + protected Looper mLooper; /* to insure registrants are in correct thread*/ protected final Context mContext; @@ -1601,6 +1604,12 @@ public abstract class PhoneBase extends Handler implements Phone { + this); } + public void registerForModifyCallResponse(Handler h, int what, Object obj) + throws CallStateException { + throw new CallStateException( + "registerForModifyCallResponse is not supported in this phone " + this); + } + /* * To check VT call capability */ @@ -1613,6 +1622,11 @@ public abstract class PhoneBase extends Handler implements Phone { "unregisterForModifyCallRequest is not supported in this phone " + this); } + public void unregisterForModifyCallResponse(Handler h) throws CallStateException { + throw new CallStateException( + "unregisterForModifyCallResponse is not supported in this phone " + this); + } + public void registerForAvpUpgradeFailure(Handler h, int what, Object obj) throws CallStateException { throw new CallStateException("registerForAvpUpgradeFailure is not supported in this phone " diff --git a/src/java/com/android/internal/telephony/PhoneProxy.java b/src/java/com/android/internal/telephony/PhoneProxy.java index 717e4522b..ee865d0ce 100644 --- a/src/java/com/android/internal/telephony/PhoneProxy.java +++ b/src/java/com/android/internal/telephony/PhoneProxy.java @@ -1296,6 +1296,11 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.registerForModifyCallRequest(h, what, obj); } + public void registerForModifyCallResponse(Handler h, int what, Object obj) + throws CallStateException { + mActivePhone.registerForModifyCallResponse(h, what, obj); + } + /* * To check VT call capability */ @@ -1307,6 +1312,10 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.unregisterForModifyCallRequest(h); } + public void unregisterForModifyCallResponse(Handler h) throws CallStateException { + mActivePhone.unregisterForModifyCallResponse(h); + } + public void registerForAvpUpgradeFailure(Handler h, int what, Object obj) throws CallStateException { mActivePhone.registerForAvpUpgradeFailure(h, what, obj); |