5,短信接收
如果有信息,RIL层会主动上报消息,RIL.java 的processUnsolicited方法会进行分发,根据网络制式,信息分为GSM和CDMA,
在此就以GSM信息为例论述, processUnsolicited方法对RIL_UNSOL_RESPONSE_NEW_SMS消息处理逻辑如下,
1,调用responseString方法从ril层读取消息内容,
case RIL_UNSOL_RESPONSE_NEW_SMS: ret = responseString(p); break;
responseString方法如下,
private Object
responseString(Parcel p) {
String response;
response = p.readString();
return response;
}
2,将消息转为SmsMessage对象,然后发送出去,
case RIL_UNSOL_RESPONSE_NEW_SMS: {
if (RILJ_LOGD) unsljLog(response);
// FIXME this should move up a layer
String a[] = new String[2];
a[1] = (String)ret;
SmsMessage sms;
sms = SmsMessage.newFromCMT(a);
if (mGsmSmsRegistrant != null) {
mGsmSmsRegistrant.notifyRegistrant(new AsyncResult(n