klteril: Override non-standard data network types.

Change-Id: I39793f3c6e72def2023cdc1e146b0506fab229ce
This commit is contained in:
Ricardo Cerqueira 2015-01-06 04:52:46 -06:00 committed by Shareef Ali
parent db9e6be8d4
commit 2a17edc74f

View file

@ -20,6 +20,7 @@ import static com.android.internal.telephony.RILConstants.*;
import android.content.Context;
import android.telephony.Rlog;
import android.os.AsyncResult;
import android.os.Message;
import android.os.Parcel;
import android.os.SystemProperties;
@ -380,4 +381,77 @@ public class KlteRIL extends RIL {
send(rr);
}
@Override
protected RILRequest
processSolicited (Parcel p) {
int serial, error;
boolean found = false;
int dataPosition = p.dataPosition(); // save off position within the Parcel
serial = p.readInt();
error = p.readInt();
RILRequest rr = null;
/* Pre-process the reply before popping it */
synchronized (mRequestList) {
RILRequest tr = mRequestList.get(serial);
if (tr != null && tr.mSerial == serial) {
if (error == 0 || p.dataAvail() > 0) {
try {switch (tr.mRequest) {
/* Get those we're interested in */
case RIL_REQUEST_DATA_REGISTRATION_STATE:
rr = tr;
break;
}} catch (Throwable thr) {
// Exceptions here usually mean invalid RIL responses
if (tr.mResult != null) {
AsyncResult.forMessage(tr.mResult, null, thr);
tr.mResult.sendToTarget();
}
return tr;
}
}
}
}
if (rr == null) {
/* Nothing we care about, go up */
p.setDataPosition(dataPosition);
// Forward responses that we are not overriding to the super class
return super.processSolicited(p);
}
rr = findAndRemoveRequestFromList(serial);
if (rr == null) {
return rr;
}
Object ret = null;
if (error == 0 || p.dataAvail() > 0) {
switch (rr.mRequest) {
case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseDataRegistrationState(p); break;
default:
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
}
//break;
}
if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest)
+ " " + retToString(rr.mRequest, ret));
if (rr.mResult != null) {
AsyncResult.forMessage(rr.mResult, ret, null);
rr.mResult.sendToTarget();
}
return rr;
}
private Object
responseDataRegistrationState(Parcel p) {
String response[] = (String[])responseStrings(p);
/* DANGER WILL ROBINSON
* In some cases from Vodaphone we are receiving a RAT of 102
* while in tunnels of the metro. Lets Assume that if we
* receive 102 we actually want a RAT of 2 for EDGE service */
if (response.length > 4 &&
response[0].equals("1") &&
response[3].equals("102")) {
response[3] = "2";
}
return response;
}
}