Commit 81aa60f4 authored by Martin Bouchet's avatar Martin Bouchet Committed by Bernhard Thoben
Browse files

kitakami-common: libril: Fix network operator search

* For search, the number of strings returned for
  RIL_REQUEST_QUERY_AVAILABLE_NETWORKS should be defined in the system
  prop ro.ril.telephony.mqanelements

Change-Id: Ie5bb8ba80c5ac93b7502da3b1bb3d2b4404ecd5e
parent 1a946220
......@@ -31,6 +31,7 @@
#include <hidl/HidlTransportSupport.h>
#include <utils/SystemClock.h>
#include <inttypes.h>
#include <cutils/properties.h>
#define INVALID_HEX_CHAR 16
......@@ -4621,20 +4622,21 @@ int radio::getAvailableNetworksResponse(int slotId,
#if VDBG
RLOGD("getAvailableNetworksResponse: serial %d", serial);
#endif
int mqanelements = property_get_int32("ro.ril.telephony.mqanelements", 4);
if (radioService[slotId]->mRadioResponse != NULL) {
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<OperatorInfo> networks;
if ((response == NULL && responseLen != 0)
|| responseLen % (4 * sizeof(char *))!= 0) {
|| responseLen % (mqanelements * sizeof(char *))!= 0) {
RLOGE("getAvailableNetworksResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
char **resp = (char **) response;
int numStrings = responseLen / sizeof(char *);
networks.resize(numStrings/4);
for (int i = 0, j = 0; i < numStrings; i = i + 4, j++) {
networks.resize(numStrings/mqanelements);
for (int i = 0, j = 0; i < numStrings; i = i + mqanelements, j++) {
networks[j].alphaLong = convertCharPtrToHidlString(resp[i]);
networks[j].alphaShort = convertCharPtrToHidlString(resp[i + 1]);
#ifndef OLD_MNC_FORMAT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment