Skip to content
Snippets Groups Projects
Commit ba5ca3dc authored by bryan2894's avatar bryan2894 Committed by TheScarastic
Browse files

mido: Fix support for DC-HSPAP

 * DC-HSPAP is unsupported, so map it to HSPAP

Change-Id: I3b170668cb187b97f7b55445f7b91596f2a442c5
parent c1223341
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,10 @@
package com.android.internal.telephony;
import android.content.Context;
import android.os.AsyncResult;
import android.os.Parcel;
import static com.android.internal.telephony.RILConstants.*;
/**
* Custom Qualcomm RIL for Xiaomi Redmi Note 4
......@@ -33,4 +37,84 @@ public class MidoRIL extends RIL implements CommandsInterface {
int cdmaSubscription, Integer instanceId) {
super(context, preferredNetworkType, cdmaSubscription, instanceId);
}
@Override
protected RILRequest
processSolicited (Parcel p, int type) {
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're not overriding to the super class
return super.processSolicited(p, type);
}
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); // All data from parcel get popped
/* Our RIL reports a value of 20 for DC-HSPAP.
However, this isn't supported in AOSP. So, map it to HSPAP instead */
if (response.length > 4 && response[0].equals("1") && response[3].equals("20")) {
response[3] = "15";
}
return response;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment