3
0

galaxys2: fix getting preferred network type

NETWORK_MODE_GLOBAL => NETWORK_MODE_WCDMA_PREF

Change-Id: Icb2d1ee40c75b7c30188e6e0036a2084cda3e071
This commit is contained in:
Daniel Hillenbrand 2013-05-29 18:38:09 +02:00
parent 19ced56c2b
commit 0dcb63a22f
2 changed files with 37 additions and 1 deletions

View File

@ -208,6 +208,7 @@ static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI);
static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI); static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI);
static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI); static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI);
static int responseInts(Parcel &p, void *response, size_t responselen); 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 responseStrings(Parcel &p, void *response, size_t responselen);
static int responseStringsNetworks(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 responseStrings(Parcel &p, void *response, size_t responselen, bool network_search);
@ -1263,6 +1264,41 @@ responseInts(Parcel &p, void *response, size_t responselen) {
return 0; return 0;
} }
static int
responseIntsGetPreferredNetworkType(Parcel &p, void *response, size_t responselen) {
int numInts;
if (response == NULL && responselen != 0) {
ALOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(int) != 0) {
ALOGE("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) {
ALOGE("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 /** response is a char **, pointing to an array of char *'s
The parcel will begin with the version */ The parcel will begin with the version */
static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) { static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) {

View File

@ -88,7 +88,7 @@
{RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid}, {RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, dispatchInts, responseVoid},
{RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid}, {RIL_REQUEST_EXPLICIT_CALL_TRANSFER, dispatchVoid, responseVoid},
{RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, dispatchInts, 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_GET_NEIGHBORING_CELL_IDS, dispatchVoid, responseCellList},
{RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid}, {RIL_REQUEST_SET_LOCATION_UPDATES, dispatchInts, responseVoid},
{RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid}, {RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, dispatchInts, responseVoid},