diff options
Diffstat (limited to 'libril/ril.cpp')
-rw-r--r-- | libril/ril.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libril/ril.cpp b/libril/ril.cpp index 6edb342..bb96b6a 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -209,6 +209,8 @@ static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI); static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI); static int responseInts(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); @@ -1284,8 +1286,16 @@ responseInts(Parcel &p, void *response, size_t responselen) { return 0; } -/** 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) { @@ -1304,11 +1314,29 @@ static int responseStrings(Parcel &p, void *response, size_t responselen) { char **p_cur = (char **) response; numStrings = responselen / sizeof(char *); +#ifdef NEW_LIBRIL_HTC + if (network_search == true) { + // we only want four entries for each network + p.writeInt32 (numStrings - (numStrings / 5)); + } else { + p.writeInt32 (numStrings); + } + int sCount = 0; +#else p.writeInt32 (numStrings); +#endif /* each string*/ startResponse; for (int i = 0 ; i < numStrings ; i++) { +#ifdef NEW_LIBRIL_HTC + sCount++; + // ignore the fifth string that is returned by newer HTC libhtc_ril.so. + if (network_search == true && sCount % 5 == 0) { + sCount = 0; + continue; + } +#endif appendPrintBuf("%s%s,", printBuf, (char*)p_cur[i]); writeStringToParcel (p, p_cur[i]); } @@ -2239,7 +2267,7 @@ static void listenCallback (int fd, short flags, void *param) { LOGE("Error on accept() errno:%d", errno); /* start listening for new connections again */ rilEventAddWakeup(&s_listen_event); - return; + return; } /* check the credential of the other side and only accept socket from |