summaryrefslogtreecommitdiffstats
path: root/ril
diff options
context:
space:
mode:
authorBjoern Johansson <bjoernj@google.com>2018-06-15 11:24:09 -0700
committerRoman Kiryanov <rkir@google.com>2018-10-04 11:06:33 -0700
commit883d2762dbc67004eeca764c7241b5f3437d40b2 (patch)
treed439df056330d7329206ba72a247ea7ce804bb6d /ril
parent952dde95191121034e6add4e11fcac6b0ffe7864 (diff)
downloaddevice_generic_goldfish-883d2762dbc67004eeca764c7241b5f3437d40b2.tar.gz
device_generic_goldfish-883d2762dbc67004eeca764c7241b5f3437d40b2.tar.bz2
device_generic_goldfish-883d2762dbc67004eeca764c7241b5f3437d40b2.zip
Fix error code returned from sim close channel
When a SIM_CLOSE_CHANNEL request fails because the channel number is invalid the emulator returns CME Error: 21 which indicates that the channel index is invalid. The reference RIL treats any error as a generic failure so this information is lost. There is a VTS test that expects the RIL error code (which is different from the CME error code) to indicate that the channel provided is an invalid argument. Inspect the return code from the modem and if it's invalid index translate it to an invalid arguments error. Otherwise return generic failure. BUG: 110212792 Test: run vts -m VtsHalRadioV1_0Target -t VtsHalRadioV1_0Target#RadioHidlTest.iccCloseLogicalChannel Merged-In: I2617458c67f7470fab12efa6068347cac01e2564 (cherry picked from commit fdde7ebf0e6f1c53f0fb13da8680281d85a6cb76)
Diffstat (limited to 'ril')
-rw-r--r--ril/atchannel.h3
-rw-r--r--ril/reference-ril.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/ril/atchannel.h b/ril/atchannel.h
index 92829153..94011417 100644
--- a/ril/atchannel.h
+++ b/ril/atchannel.h
@@ -112,7 +112,8 @@ void at_response_free(ATResponse *p_response);
typedef enum {
CME_ERROR_NON_CME = -1,
CME_SUCCESS = 0,
- CME_SIM_NOT_INSERTED = 10
+ CME_SIM_NOT_INSERTED = 10,
+ CME_INVALID_INDEX = 21,
} AT_CME_Error;
AT_CME_Error at_get_cme_error(const ATResponse *p_response);
diff --git a/ril/reference-ril.c b/ril/reference-ril.c
index 084c4add..3bca5810 100644
--- a/ril/reference-ril.c
+++ b/ril/reference-ril.c
@@ -1878,9 +1878,14 @@ static void requestSimCloseChannel(void *data, size_t datalen, RIL_Token t)
err = at_send_command_singleline(cmd, "+CCHC", &p_response);
if (err < 0 || p_response == NULL || p_response->success == 0) {
+ AT_CME_Error cme = p_response ? at_get_cme_error(p_response) :
+ CME_ERROR_NON_CME;
+ RIL_Errno ril_e = (cme == CME_INVALID_INDEX) ? RIL_E_INVALID_ARGUMENTS :
+ RIL_E_GENERIC_FAILURE;
+
ALOGE("Error %d closing logical channel %d: %d",
err, session_id, p_response ? p_response->success : 0);
- RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
+ RIL_onRequestComplete(t, ril_e, NULL, 0);
at_response_free(p_response);
return;
}