diff options
author | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2015-04-12 11:53:23 +0200 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2015-04-12 11:58:35 +0200 |
commit | d0b84165204885e86d9690abe6f543f33491e1c5 (patch) | |
tree | b6b494815e240026332722dad4c8e5f4f0d6168d | |
parent | bd82ef1fa71307d30d97ea5e4e10aa2006247b7a (diff) | |
download | android_hardware_samsung-d0b84165204885e86d9690abe6f543f33491e1c5.tar.gz android_hardware_samsung-d0b84165204885e86d9690abe6f543f33491e1c5.tar.bz2 android_hardware_samsung-d0b84165204885e86d9690abe6f543f33491e1c5.zip |
libril: rewrite preferred network type
NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF
Change-Id: I3087e4be3a6ff700b39544279fa0e265b9182180
-rw-r--r-- | ril/libril/ril.cpp | 41 | ||||
-rw-r--r-- | ril/libril/ril_commands.h | 4 |
2 files changed, 38 insertions, 7 deletions
diff --git a/ril/libril/ril.cpp b/ril/libril/ril.cpp index f08e367..97e40b1 100644 --- a/ril/libril/ril.cpp +++ b/ril/libril/ril.cpp @@ -282,8 +282,8 @@ static void dispatchSimAuthentication(Parcel &p, RequestInfo *pRI); static void dispatchDataProfile(Parcel &p, RequestInfo *pRI); 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); @@ -2224,6 +2224,41 @@ responseInts(Parcel &p, void *response, size_t responselen) { return 0; } +static int +responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responselen) { + int numInts; + + if (response == NULL && responselen != 0) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + if (responselen % sizeof(int) != 0) { + RLOGE("responseInts: invalid response length %d expected multiple of %d\n", + (int)responselen, (int)sizeof(int)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + int *p_int = (int *) response; + + numInts = responselen / sizeof(int); + p.writeInt32 (numInts); + + /* each int*/ + startResponse; + for (int i = 0 ; i < numInts ; i++) { + if (i == 0 && p_int[0] == 7) { + RLOGD("REQUEST_GET_PREFERRED_NETWORK_TYPE: NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF"); + p_int[0] = 0; + } + appendPrintBuf("%s%d,", printBuf, p_int[i]); + p.writeInt32(p_int[i]); + } + removeLastChar; + closeResponse; + + return 0; +} + /** response is a char **, pointing to an array of char *'s The parcel will begin with the version */ static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) { @@ -2236,10 +2271,6 @@ 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; diff --git a/ril/libril/ril_commands.h b/ril/libril/ril_commands.h index fc4cf25..59b529e 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}, @@ -88,7 +88,7 @@ {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid}, {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid}, {RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, responseVoid}, - {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseInts}, + {RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, dispatchVoid, responseIntsGetPreferredNetworkType}, {RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList}, {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid}, |