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
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 @@
 #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 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 @@
 
 /** 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 @@
         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]);
         }