From 48d3f723a50ee4cf5c5675af4ba86c0567dc4cf8 Mon Sep 17 00:00:00 2001 From: Dheeraj CVR Date: Tue, 4 Oct 2016 11:10:55 +0400 Subject: libril: revert network operator string handling * These workarounds were introduced before http://review.cyanogenmod.org/#/c/159520/ and are no longer needed because the framework now has dynamic QAN element support. Setting the ro.ril.telephony.mqanelements to a proper value should fix the operator search on all the devices and these workarounds are no longer required. * http://review.cyanogenmod.org/#/c/100398/ discards every 5th QAN element which breaks devices with libsec-ril that returns more than 5 QAN elements. zeroflte and noblelte return 6 QAN elements and the 5th element was being discarded instead of 6th. * The code assumes 5 QAN elements per operator which doesn't hold true for all devices. * In case of devices with 6 QAN elements, the size of the string array was a multiple of 6, but since we are discarding the 5th element, the contents of the string pertaining to each operator is a multiple of 5 following by trailing null strings in the array, which caused issues in the framework while trying to read the strings, since we are expecting 6 strings per operator and with a discarded string, we only receive 5. Thanks to Javi Ferrer for diagnosing the issue on zeroflte Change-Id: I2e99291f3438998a253755a19a063d15a19d63e0 --- ril/libril/ril.cpp | 27 +-------------------------- ril/libril/ril_commands.h | 2 +- 2 files changed, 2 insertions(+), 27 deletions(-) (limited to 'ril') diff --git a/ril/libril/ril.cpp b/ril/libril/ril.cpp index 0d9f128..41c3833 100644 --- a/ril/libril/ril.cpp +++ b/ril/libril/ril.cpp @@ -68,7 +68,6 @@ namespace android { #define ANDROID_WAKE_LOCK_USECS 200000 #define PROPERTY_RIL_IMPL "gsm.version.ril-impl" -#define PROPERTY_QAN_ELEMENTS "ro.ril.telephony.mqanelements" // match with constant in RIL.java #define MAX_COMMAND_BYTES (8 * 1024) @@ -278,8 +277,6 @@ static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI); static int responseInts(Parcel &p, void *response, size_t responselen); static int responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responselen); static int responseStrings(Parcel &p, void *response, size_t responselen); -static int responseStringsNetworks(Parcel &p, void *response, size_t responselen); -static int responseStrings(Parcel &p, void *response, size_t responselen, bool network_search); static int responseString(Parcel &p, void *response, size_t responselen); static int responseVoid(Parcel &p, void *response, size_t responselen); static int responseCallList(Parcel &p, void *response, size_t responselen); @@ -2280,15 +2277,6 @@ static int responseStringsWithVersion(int version, Parcel &p, void *response, si /** response is a char **, pointing to an array of char *'s */ static int responseStrings(Parcel &p, void *response, size_t responselen) { - return responseStrings(p, response, responselen, false); -} - -static int responseStringsNetworks(Parcel &p, void *response, size_t responselen) { - return responseStrings(p, response, responselen, true); -} - -/** response is a char **, pointing to an array of char *'s */ -static int responseStrings(Parcel &p, void *response, size_t responselen, bool network_search) { int numStrings; if (response == NULL && responselen != 0) { @@ -2307,24 +2295,11 @@ static int responseStrings(Parcel &p, void *response, size_t responselen, bool n char **p_cur = (char **) response; numStrings = responselen / sizeof(char *); - if (network_search) { - int32_t QANElements; - - /* - * This needs to be set to same value as mQANElements in the RIL - * Telephony class. - */ - QANElements = property_get_int32(PROPERTY_QAN_ELEMENTS, 4); - p.writeInt32 ((numStrings / 5) * QANElements); - } else { - p.writeInt32 (numStrings); - } + p.writeInt32 (numStrings); /* each string*/ startResponse; for (int i = 0 ; i < numStrings ; i++) { - if (network_search && ((i + 1) % 5 == 0)) - continue; appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]); writeStringToParcel (p, p_cur[i]); } diff --git a/ril/libril/ril_commands.h b/ril/libril/ril_commands.h index 001b470..39f8878 100644 --- a/ril/libril/ril_commands.h +++ b/ril/libril/ril_commands.h @@ -62,7 +62,7 @@ {RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, dispatchVoid, responseInts}, {RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, dispatchString, responseVoid}, - {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseStringsNetworks}, + {RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , dispatchVoid, responseStrings}, {RIL_REQUEST_DTMF_START, dispatchString, responseVoid}, {RIL_REQUEST_DTMF_STOP, dispatchVoid, responseVoid}, {RIL_REQUEST_BASEBAND_VERSION, dispatchVoid, responseString}, -- cgit v1.2.3