diff options
author | Naveen Kalla <nkalla@codeaurora.org> | 2011-11-15 12:52:06 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2014-11-27 00:39:32 -0800 |
commit | 646b2f08897b67d48093b738932e1ca77f4c30bd (patch) | |
tree | 174012dfbb8ae32e3927c69261be17fb9f487a90 | |
parent | 0ef2b6c68080422bd4c55990f71d1907736658d6 (diff) | |
download | android_hardware_ril-646b2f08897b67d48093b738932e1ca77f4c30bd.tar.gz android_hardware_ril-646b2f08897b67d48093b738932e1ca77f4c30bd.tar.bz2 android_hardware_ril-646b2f08897b67d48093b738932e1ca77f4c30bd.zip |
STK Call Control feature implementation.
Change-Id: I1164df9ddbf70fb42e760c1f3ab7f3df4b3b5339
Conflicts:
libril/ril.cpp
libril/ril_unsol_commands.h
-rw-r--r-- | include/telephony/ril.h | 160 | ||||
-rwxr-xr-x | libril/ril.cpp | 80 | ||||
-rwxr-xr-x[-rw-r--r--] | libril/ril_unsol_commands.h | 2 |
3 files changed, 235 insertions, 7 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index c703cd7..421fa8d 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -98,8 +98,21 @@ typedef enum { RIL_E_FDN_CHECK_FAILURE = 14, /* command failed because recipient is not on FDN list */ RIL_E_ILLEGAL_SIM_OR_ME = 15, /* network selection failed due to illegal SIM or ME */ - RIL_E_MISSING_RESOURCE = 16, /* no logical channel available */ - RIL_E_NO_SUCH_ELEMENT = 17, /* application not found on SIM */ + RIL_E_UNUSED = 16, + RIL_E_DIAL_MODIFIED_TO_USSD = 17, /* DIAL request modified to USSD */ + RIL_E_DIAL_MODIFIED_TO_SS = 18, /* DIAL request modified to SS */ + RIL_E_DIAL_MODIFIED_TO_DIAL = 19, /* DIAL request modified to DIAL with different + data */ + RIL_E_USSD_MODIFIED_TO_DIAL = 20, /* USSD request modified to DIAL */ + RIL_E_USSD_MODIFIED_TO_SS = 21, /* USSD request modified to SS */ + RIL_E_USSD_MODIFIED_TO_USSD = 22, /* USSD request modified to different USSD + request */ + RIL_E_SS_MODIFIED_TO_DIAL = 23, /* SS request modified to DIAL */ + RIL_E_SS_MODIFIED_TO_USSD = 24, /* SS request modified to USSD */ + RIL_E_SS_MODIFIED_TO_SS = 25, /* SS request modified to different SS request */ + RIL_E_SUBSCRIPTION_NOT_SUPPORTED = 26, /* Subscription not supported by RIL */ + RIL_E_MISSING_RESOURCE = 27, /* no logical channel available */ + RIL_E_NO_SUCH_ELEMENT = 28 /* application not found on SIM */ } RIL_Errno; typedef enum { @@ -469,6 +482,9 @@ typedef enum { CALL_FAIL_FDN_BLOCKED = 241, CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242, CALL_FAIL_IMEI_NOT_ACCEPTED = 243, + CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK Call Control */ + CALL_FAIL_DIAL_MODIFIED_TO_SS = 245, + CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246, CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000, CALL_FAIL_CDMA_DROP = 1001, CALL_FAIL_CDMA_INTERCEPT = 1002, @@ -1149,6 +1165,80 @@ typedef struct { } cfg; } RIL_HardwareConfig; +typedef enum { + SS_CFU, + SS_CF_BUSY, + SS_CF_NO_REPLY, + SS_CF_NOT_REACHABLE, + SS_CF_ALL, + SS_CF_ALL_CONDITIONAL, + SS_CLIP, + SS_CLIR, + SS_COLP, + SS_COLR, + SS_WAIT, + SS_BAOC, + SS_BAOIC, + SS_BAOIC_EXC_HOME, + SS_BAIC, + SS_BAIC_ROAMING, + SS_ALL_BARRING, + SS_OUTGOING_BARRING, + SS_INCOMING_BARRING +} RIL_SsServiceType; + +typedef enum { + SS_ACTIVATION, + SS_DEACTIVATION, + SS_INTERROGATION, + SS_REGISTRATION, + SS_ERASURE +} RIL_SsRequestType; + +typedef enum { + SS_ALL_TELE_AND_BEARER_SERVICES, + SS_ALL_TELESEVICES, + SS_TELEPHONY, + SS_ALL_DATA_TELESERVICES, + SS_SMS_SERVICES, + SS_ALL_TELESERVICES_EXCEPT_SMS +} RIL_SsTeleserviceType; + +#define SS_INFO_MAX 4 +#define NUM_SERVICE_CLASSES 7 + +typedef struct { + int numValidIndexes; /* This gives the number of valid values in cfInfo. + For example if voice is forwarded to one number and data + is forwarded to a different one then numValidIndexes will be + 2 indicating total number of valid values in cfInfo. + Similarly if all the services are forwarded to the same + number then the value of numValidIndexes will be 1. */ + + RIL_CallForwardInfo cfInfo[NUM_SERVICE_CLASSES]; /* This is the response data + for SS request to query call + forward status. see + RIL_REQUEST_QUERY_CALL_FORWARD_STATUS */ +} RIL_CfData; + +typedef struct { + RIL_SsServiceType serviceType; + RIL_SsRequestType requestType; + RIL_SsTeleserviceType teleserviceType; + int serviceClass; + RIL_Errno result; + + union { + int ssInfo[SS_INFO_MAX]; /* This is the response data for most of the SS GET/SET + RIL requests. E.g. RIL_REQUSET_GET_CLIR returns + two ints, so first two values of ssInfo[] will be + used for response if serviceType is SS_CLIR and + requestType is SS_INTERROGATION */ + + RIL_CfData cfData; + }; +} RIL_StkCcUnsolSsResponse; + /** * Data connection power state */ @@ -1238,7 +1328,6 @@ typedef struct { #define RIL_REQUEST_ENTER_SIM_PIN 2 - /** * RIL_REQUEST_ENTER_SIM_PUK * @@ -1417,6 +1506,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * DIAL_MODIFIED_TO_USSD + * DIAL_MODIFIED_TO_SS + * DIAL_MODIFIED_TO_DIAL * GENERIC_FAILURE */ #define RIL_REQUEST_DIAL 10 @@ -2020,6 +2112,9 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * FDN_CHECK_FAILURE + * USSD_MODIFIED_TO_DIAL + * USSD_MODIFIED_TO_SS + * USSD_MODIFIED_TO_USSD * GENERIC_FAILURE * * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD @@ -2055,6 +2150,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_GET_CLIR 31 @@ -2070,6 +2168,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CLIR 32 @@ -2093,6 +2194,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33 @@ -2109,6 +2213,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_FORWARD 34 @@ -2135,6 +2242,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_QUERY_CALL_WAITING 35 @@ -2154,6 +2264,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ #define RIL_REQUEST_SET_CALL_WAITING 36 @@ -2296,6 +2409,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2325,6 +2441,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2347,6 +2466,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE * */ @@ -2567,6 +2689,9 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * SS_MODIFIED_TO_DIAL + * SS_MODIFIED_TO_USSD + * SS_MODIFIED_TO_SS * GENERIC_FAILURE */ @@ -4228,7 +4353,6 @@ typedef struct { */ #define RIL_UNSOL_ON_USSD_REQUEST 1007 - /** * RIL_UNSOL_NITZ_TIME_RECEIVED * @@ -4597,6 +4721,27 @@ typedef struct { */ #define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037 +/* + * RIL_UNSOL_ON_SS + * + * Called when SS response is received when DIAL/USSD/SS is changed to SS by + * call control. + * + * "data" is const RIL_StkCcUnsolSsResponse * + * + */ +#define RIL_UNSOL_ON_SS 1038 + +/** + * RIL_UNSOL_STK_CC_ALPHA_NOTIFY + * + * Called when there is an ALPHA from UICC during Call Control. + * + * "data" is const char * containing ALPHA string from UICC in UTF-8 format. + * + */ +#define RIL_UNSOL_STK_CC_ALPHA_NOTIFY 1039 + /** * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED * @@ -4611,7 +4756,7 @@ typedef struct { * ((const int *)data)[0] == 1 for Subscription Activated * */ -#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038 +#define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1040 /** * RIL_UNSOL_SRVCC_STATE_NOTIFY @@ -4624,7 +4769,7 @@ typedef struct { * */ -#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039 +#define RIL_UNSOL_SRVCC_STATE_NOTIFY 1041 /** * RIL_UNSOL_HARDWARE_CONFIG_CHANGED @@ -4634,7 +4779,7 @@ typedef struct { * "data" is an array of RIL_HardwareConfig * */ -#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040 +#define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1042 /** * RIL_UNSOL_DC_RT_INFO_CHANGED @@ -4650,6 +4795,7 @@ typedef struct { /***********************************************************************/ + #if defined(ANDROID_MULTI_SIM) /** * RIL_Request Function pointer diff --git a/libril/ril.cpp b/libril/ril.cpp index 7c0cb89..81702f5 100755 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -302,12 +302,15 @@ static int responseCdmaCallWaiting(Parcel &p,void *response, size_t responselen) static int responseSimRefresh(Parcel &p, void *response, size_t responselen); static int responseCellInfoList(Parcel &p, void *response, size_t responselen); static int responseHardwareConfig(Parcel &p, void *response, size_t responselen); +static int responseSSData(Parcel &p, void *response, size_t responselen); static int responseDcRtInfo(Parcel &p, void *response, size_t responselen); static int decodeVoiceRadioTechnology (RIL_RadioState radioState); static int decodeCdmaSubscriptionSource (RIL_RadioState radioState); static RIL_RadioState processRadioState(RIL_RadioState newRadioState); +static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType); + #ifdef RIL_SHLIB #if defined(ANDROID_MULTI_SIM) extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, void *data, @@ -3135,6 +3138,83 @@ static int responseHardwareConfig(Parcel &p, void *response, size_t responselen) return 0; } +static int responseSSData(Parcel &p, void *response, size_t responselen) { + RLOGD("In responseSSData"); + int num; + + if (response == NULL && responselen != 0) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen != sizeof(RIL_StkCcUnsolSsResponse)) { + RLOGE("invalid response length %d, expected %d", + (int)responselen, (int)sizeof(RIL_StkCcUnsolSsResponse)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + startResponse; + RIL_StkCcUnsolSsResponse *p_cur = (RIL_StkCcUnsolSsResponse *) response; + p.writeInt32(p_cur->serviceType); + p.writeInt32(p_cur->requestType); + p.writeInt32(p_cur->teleserviceType); + p.writeInt32(p_cur->serviceClass); + p.writeInt32(p_cur->result); + + if (isServiceTypeCfQuery(p_cur->serviceType, p_cur->requestType)) { + RLOGD("responseSSData CF type, num of Cf elements %d", p_cur->cfData.numValidIndexes); + if (p_cur->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { + RLOGE("numValidIndexes is greater than max value %d, " + "truncating it to max value", NUM_SERVICE_CLASSES); + p_cur->cfData.numValidIndexes = NUM_SERVICE_CLASSES; + } + /* number of call info's */ + p.writeInt32(p_cur->cfData.numValidIndexes); + + for (int i = 0; i < p_cur->cfData.numValidIndexes; i++) { + RIL_CallForwardInfo cf = p_cur->cfData.cfInfo[i]; + + p.writeInt32(cf.status); + p.writeInt32(cf.reason); + p.writeInt32(cf.serviceClass); + p.writeInt32(cf.toa); + writeStringToParcel(p, cf.number); + p.writeInt32(cf.timeSeconds); + appendPrintBuf("%s[%s,reason=%d,cls=%d,toa=%d,%s,tout=%d],", printBuf, + (cf.status==1)?"enable":"disable", cf.reason, cf.serviceClass, cf.toa, + (char*)cf.number, cf.timeSeconds); + RLOGD("Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, + cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); + } + } else { + p.writeInt32 (SS_INFO_MAX); + + /* each int*/ + for (int i = 0; i < SS_INFO_MAX; i++) { + appendPrintBuf("%s%d,", printBuf, p_cur->ssInfo[i]); + RLOGD("Data: %d",p_cur->ssInfo[i]); + p.writeInt32(p_cur->ssInfo[i]); + } + } + removeLastChar; + closeResponse; + + return 0; +} + +static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { + if ((reqType == SS_INTERROGATION) && + (serType == SS_CFU || + serType == SS_CF_BUSY || + serType == SS_CF_NO_REPLY || + serType == SS_CF_NOT_REACHABLE || + serType == SS_CF_ALL || + serType == SS_CF_ALL_CONDITIONAL)) { + return true; + } + return false; +} + static void triggerEvLoop() { int ret; if (!pthread_equal(pthread_self(), s_tid_dispatch)) { diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h index 2232015..d1f6a8f 100644..100755 --- a/libril/ril_unsol_commands.h +++ b/libril/ril_unsol_commands.h @@ -56,3 +56,5 @@ {RIL_UNSOL_SRVCC_STATE_NOTIFY, responseInts, WAKE_PARTIAL}, {RIL_UNSOL_HARDWARE_CONFIG_CHANGED, responseHardwareConfig, WAKE_PARTIAL}, {RIL_UNSOL_DC_RT_INFO_CHANGED, responseDcRtInfo, WAKE_PARTIAL}, + {RIL_UNSOL_ON_SS, responseSSData, WAKE_PARTIAL}, + {RIL_UNSOL_STK_CC_ALPHA_NOTIFY, responseString, WAKE_PARTIAL}, |