diff options
author | Paul Keith <javelinanddart@gmail.com> | 2017-10-22 05:25:25 +0200 |
---|---|---|
committer | Christopher H. <raymanfx@gmail.com> | 2018-06-23 11:55:58 +0200 |
commit | 63d0da85d79324cf9f7244474e5d2b7fb2fcd707 (patch) | |
tree | 2c10a828663ee167c69c0ab49056013b6bd08da4 /ril | |
parent | 8cc0417cf2578fabf1380b18cfb2a77303506670 (diff) | |
download | android_hardware_samsung-63d0da85d79324cf9f7244474e5d2b7fb2fcd707.tar.gz android_hardware_samsung-63d0da85d79324cf9f7244474e5d2b7fb2fcd707.tar.bz2 android_hardware_samsung-63d0da85d79324cf9f7244474e5d2b7fb2fcd707.zip |
ril: service: Fix RIL_UNSOL_NITZ_TIME_RECEIVED Parcel
* Sometimes, the modem is sending 1-2 extra fields with
the country mcc, which confuses ServiceStateTracker
* Drop the extra data here, instead of in our RIL class
[haggertk]: Forward port to ril-caf on lineage-15.
Change-Id: Ifbec67bb0dac271226bd8b5471deaf6a2ef33f2b
Diffstat (limited to 'ril')
-rw-r--r-- | ril/libril/ril_service.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/ril/libril/ril_service.cpp b/ril/libril/ril_service.cpp index 016a215..37bd2a6 100644 --- a/ril/libril/ril_service.cpp +++ b/ril/libril/ril_service.cpp @@ -6692,8 +6692,25 @@ int radio::nitzTimeReceivedInd(int slotId, RLOGE("nitzTimeReceivedInd: invalid response"); return 0; } - hidl_string nitzTime = convertCharPtrToHidlString((char *) response); + hidl_string nitzTime; int64_t timeReceived = android::elapsedRealtime(); + char *resp = strndup((char *) response, responseLen); + char *tmp = resp; + + /* Find the 3rd comma */ + for (int i = 0; i < 3; i++) { + if (tmp != NULL) { + tmp = strchr(tmp + 1, ','); + } + } + + /* Make the 3rd comma the end of the string */ + if (tmp != NULL) { + *tmp = '\0'; + } + + nitzTime = convertCharPtrToHidlString(resp); + free(resp); #if VDBG RLOGD("nitzTimeReceivedInd: nitzTime %s receivedTime %" PRId64, nitzTime.c_str(), timeReceived); |