diff options
author | Jim Kaye <jameskaye@google.com> | 2017-12-07 14:06:22 -0800 |
---|---|---|
committer | Jim Kaye <jameskaye@google.com> | 2017-12-07 14:35:07 -0800 |
commit | b6f3f7e0bdb439a55ea036866de2ed1feb0b6001 (patch) | |
tree | a54bc191fd1d656ffbfd89774406b0a435b39341 /reference-ril | |
parent | 6e9db34e73c455d26be6a6d3e37f963770b248fa (diff) | |
download | android_hardware_ril-b6f3f7e0bdb439a55ea036866de2ed1feb0b6001.tar.gz android_hardware_ril-b6f3f7e0bdb439a55ea036866de2ed1feb0b6001.tar.bz2 android_hardware_ril-b6f3f7e0bdb439a55ea036866de2ed1feb0b6001.zip |
Fix more VTS HAL Radio tests
With VTS 8.0 r4, 16 new VTS failures appeared in the
Emulator. These failures were all due to unexpected
responses (some error, some no-error) from the Radio
Interface Layer.
This CL has reference-ril give the expected responses.
With this CL, 122 of 129 of these tests pass (again).
(The remaining 7 tests still fail. These 7 are
related to SAP.)
The 16 previously-failing tests were in
HidlHalGTest#RadioHidlTest:
setNetworkSelectionModeAutomatic_32bit
startLceService_32bit
pullLceData_32bit
sendSms_32bit
sendSMSExpectMore_32bit
acknowledgeLastIncomingGsmSms_32bit
sendCdmaSms_32bit
writeSmsToSim_32bit
hangup_32bit
hangupWaitingOrBackground_32bit
hangupForegroundResumeBackground_32bit
switchWaitingOrHoldingAndActive_32bit
conference_32bit
rejectCall_32bit
cancelPendingUssd_32bit
separateConnection_32bit
Bug: 62137708
Test: VTS tests: VtsHalRadioV1_0Target
Change-Id: Ic1d89e1d09d8ef1976cb6b78c863a84d7b1505e1
Diffstat (limited to 'reference-ril')
-rw-r--r-- | reference-ril/reference-ril.c | 208 |
1 files changed, 136 insertions, 72 deletions
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index 87b7bcb..7b93bf1 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -400,7 +400,7 @@ static void requestRadioPower(void *data, size_t datalen __unused, RIL_Token t) if (onOff == 0 && sState != RADIO_STATE_OFF) { err = at_send_command("AT+CFUN=0", &p_response); - if (err < 0 || p_response->success == 0) goto error; + if (err < 0 || p_response->success == 0) goto error; setRadioState(RADIO_STATE_OFF); } else if (onOff > 0 && sState == RADIO_STATE_OFF) { err = at_send_command("AT+CFUN=1", &p_response); @@ -454,6 +454,60 @@ static void requestDataCallList(void *data __unused, size_t datalen __unused, RI requestOrSendDataCallList(&t); } +// Hang up, reject, conference, call waiting +static void requestCallSelection( + void *data __unused, size_t datalen __unused, RIL_Token t, int request) +{ + // 3GPP 22.030 6.5.5 + static char hangupWaiting[] = "AT+CHLD=0"; + static char hangupForeground[] = "AT+CHLD=1"; + static char switchWaiting[] = "AT+CHLD=2"; + static char conference[] = "AT+CHLD=3"; + static char reject[] = "ATH"; + + char* atCommand; + + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + return; + } + + switch(request) { + case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: + // "Releases all held calls or sets User Determined User Busy + // (UDUB) for a waiting call." + atCommand = hangupWaiting; + break; + case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: + // "Releases all active calls (if any exist) and accepts + // the other (held or waiting) call." + atCommand = hangupForeground; + break; + case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: + // "Places all active calls (if any exist) on hold and accepts + // the other (held or waiting) call." + atCommand = switchWaiting; +#ifdef WORKAROUND_ERRONEOUS_ANSWER + s_expectAnswer = 1; +#endif /* WORKAROUND_ERRONEOUS_ANSWER */ + break; + case RIL_REQUEST_CONFERENCE: + // "Adds a held call to the conversation" + atCommand = conference; + break; + case RIL_REQUEST_UDUB: + // User determined user busy (reject) + atCommand = reject; + break; + default: + assert(0); + } + at_send_command(atCommand, NULL); + // Success or failure is ignored by the upper layer here. + // It will call GET_CURRENT_CALLS and determine success that way. + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); +} + static void requestOrSendDataCallList(RIL_Token *t) { ATResponse *p_response; @@ -850,6 +904,11 @@ static void requestWriteSmsToSim(void *data, size_t datalen __unused, RIL_Token int err; ATResponse *p_response = NULL; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_SIM_ABSENT, NULL, 0); + return; + } + p_args = (RIL_SMS_WriteArgs *)data; length = strlen(p_args->pdu)/2; @@ -875,6 +934,10 @@ static void requestHangup(void *data, size_t datalen __unused, RIL_Token t) int ret; char *cmd; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_MODEM_ERR, NULL, 0); + return; + } p_line = (int *)data; // 3GPP 22.030 6.5.5 @@ -1196,7 +1259,7 @@ static void requestCdmaGetRoamingPreference(int request __unused, void *data __u res = at_tok_nextint(&line, &roaming_pref); if (res < 0) goto error; - RIL_onRequestComplete(t, RIL_E_SUCCESS, &roaming_pref, sizeof(roaming_pref)); + RIL_onRequestComplete(t, RIL_E_SUCCESS, &roaming_pref, sizeof(roaming_pref)); return; error: RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); @@ -1536,6 +1599,11 @@ static void requestCdmaSendSMS(void *data, size_t datalen, RIL_Token t) RIL_SMS_Response response; RIL_CDMA_SMS_Message* rcsm; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_SIM_ABSENT, NULL, 0); + return; + } + RLOGD("requestCdmaSendSMS datalen=%zu, sizeof(RIL_CDMA_SMS_Message)=%zu", datalen, sizeof(RIL_CDMA_SMS_Message)); @@ -1574,6 +1642,11 @@ static void requestSendSMS(void *data, size_t datalen, RIL_Token t) RIL_SMS_Response response; ATResponse *p_response = NULL; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_SIM_ABSENT, NULL, 0); + return; + } + memset(&response, 0, sizeof(response)); RLOGD("requestSendSMS datalen =%zu", datalen); @@ -1617,7 +1690,7 @@ error2: RIL_onRequestComplete(t, RIL_E_SMS_SEND_FAIL_RETRY, &response, sizeof(response)); at_response_free(p_response); return; - } +} static void requestImsSendSMS(void *data, size_t datalen, RIL_Token t) { @@ -1905,6 +1978,11 @@ static void requestSMSAcknowledge(void *data, size_t datalen __unused, RIL_Token int ackSuccess; int err; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + return; + } + ackSuccess = ((int *)data)[0]; if (ackSuccess == 1) { @@ -2254,39 +2332,12 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) requestHangup(data, datalen, t); break; case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: - // 3GPP 22.030 6.5.5 - // "Releases all held calls or sets User Determined User Busy - // (UDUB) for a waiting call." - at_send_command("AT+CHLD=0", NULL); - - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); - break; case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: - // 3GPP 22.030 6.5.5 - // "Releases all active calls (if any exist) and accepts - // the other (held or waiting) call." - at_send_command("AT+CHLD=1", NULL); - - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); - break; case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: - // 3GPP 22.030 6.5.5 - // "Places all active calls (if any exist) on hold and accepts - // the other (held or waiting) call." - at_send_command("AT+CHLD=2", NULL); - -#ifdef WORKAROUND_ERRONEOUS_ANSWER - s_expectAnswer = 1; -#endif /* WORKAROUND_ERRONEOUS_ANSWER */ - - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); - break; + case RIL_REQUEST_CONFERENCE: + case RIL_REQUEST_UDUB: + requestCallSelection(data, datalen, t, request); + break; case RIL_REQUEST_ANSWER: at_send_command("ATA", NULL); @@ -2294,27 +2345,13 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) s_expectAnswer = 1; #endif /* WORKAROUND_ERRONEOUS_ANSWER */ - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); - break; - case RIL_REQUEST_CONFERENCE: - // 3GPP 22.030 6.5.5 - // "Adds a held call to the conversation" - at_send_command("AT+CHLD=3", NULL); - - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); - break; - case RIL_REQUEST_UDUB: - /* user determined user busy */ - /* sometimes used: ATH */ - at_send_command("ATH", NULL); - - /* success or failure is ignored by the upper layer here. - it will call GET_CURRENT_CALLS and determine success that way */ - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + if (getSIMStatus() != SIM_READY) { + RIL_onRequestComplete(t, RIL_E_MODEM_ERR, NULL, 0); + } else { + // Success or failure is ignored by the upper layer here. + // It will call GET_CURRENT_CALLS and determine success that way. + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } break; case RIL_REQUEST_SEPARATE_CONNECTION: @@ -2322,6 +2359,10 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) char cmd[12]; int party = ((int*)data)[0]; + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + return; + } // Make sure that party is in a valid range. // (Note: The Telephony middle layer imposes a range of 1 to 7. // It's sufficient for us to just make sure it's single digit.) @@ -2418,6 +2459,10 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) break; case RIL_REQUEST_CANCEL_USSD: + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + return; + } p_response = NULL; err = at_send_command_numeric("AT+CUSD=2", &p_response); @@ -2431,7 +2476,11 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) break; case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: - at_send_command("AT+COPS=0", NULL); + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); + } else { + at_send_command("AT+COPS=0", NULL); + } break; case RIL_REQUEST_DATA_CALL_LIST: @@ -2589,34 +2638,49 @@ onRequest (int request, void *data, size_t datalen, RIL_Token t) requestCdmaGetSubscriptionSource(request, data, datalen, t); break; - /* CDMA Specific Requests */ - case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: - if (TECH_BIT(sMdmInfo) == MDM_CDMA) { - requestCdmaSetSubscriptionSource(request, data, datalen, t); - break; - } // Fall-through if tech is not cdma + case RIL_REQUEST_START_LCE: + case RIL_REQUEST_STOP_LCE: + case RIL_REQUEST_PULL_LCEDATA: + if (getSIMStatus() == SIM_ABSENT) { + RIL_onRequestComplete(t, RIL_E_SIM_ABSENT, NULL, 0); + } else { + RIL_onRequestComplete(t, RIL_E_LCE_NOT_SUPPORTED, NULL, 0); + } + break; case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: if (TECH_BIT(sMdmInfo) == MDM_CDMA) { requestCdmaGetRoamingPreference(request, data, datalen, t); - break; - } // Fall-through if tech is not cdma + } else { + RIL_onRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); + } + break; + + case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: + if (TECH_BIT(sMdmInfo) == MDM_CDMA) { + requestCdmaSetSubscriptionSource(request, data, datalen, t); + } else { + // VTS tests expect us to silently do nothing + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } + break; case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: if (TECH_BIT(sMdmInfo) == MDM_CDMA) { requestCdmaSetRoamingPreference(request, data, datalen, t); - break; - } // Fall-through if tech is not cdma + } else { + // VTS tests expect us to silently do nothing + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } + break; case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: if (TECH_BIT(sMdmInfo) == MDM_CDMA) { requestExitEmergencyMode(data, datalen, t); - break; - } // Fall-through if tech is not cdma - - // Fall-through to here when the request is specific to CDMA, but - // our tech is not CDMA. VTS tests expect us to silently do nothing. - RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } else { + // VTS tests expect us to silently do nothing + RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0); + } break; default: |