短信frameworks发送流程,大致流程是这样的,注释不是很清楚,后续慢慢更新注释
frameworks/base/telephony/java/android/telephony/SmsManager.java--->sendTextMessage
@param destinationAddress 发送方电话号码
@param scAddress 短信中心号码
@param text 消息内容
@param sentIntent 发送报告
@param deliveryIntent消息递送报告
frameworks/base/telephony/java/android/telephony/SmsManager.java--->sendTextMessageInternal
判断电话号码以及消息内容是否为空
GetISmsServiceOrThrow{
ISms.Stub.asInterface(ServiceManager.getService("isms"))
}在Binder注册isms服务,通过issms调用底层接口发送
frameworks/opt/telephony/src/java/com/android/internal/telephony/UiccSmsController.java--->sendTextForSubscriber
获取IccSmsInterfaceManager对象调用sendText函数,其中这里与应用层多传递了callingPackage 发送消息应用名,以及defaultsmsapp默认短信应用
frameworks/opt/telephony/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java-->sendText
CheckCallingSendTextPermissions检查是否有发送短信权限
frameworks/opt/telephony/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java-->sendTextInternal
csllingPackge:应用名称
Destaddr:发送号码
scAddr:服务中心号码
PersistMessageForNonDefaultSmsApp:默认短信应用
Priority:优先级
ExpectMore:是否串联短信
validityPeriod:优先级
SmsDispatchersController.java是P上面google管理新增的frameworks/opt/telephony/src/java/com/android/internal/telephony/SmsDispatchersController.java-->sendText
判断是否注册上IMS网络服务等,我发发生gsm消息看mGsmsDispather.sendtext
frameworks/opt/telephony/src/java/com/android/internal/telephony/SMSDispatcher.java-->sendText
Getsubmitpdu获取pdu组合,最后把pdu发送出去
frameworks/opt/telephony/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java-->sendsms
如果消息不是IMS消息,且不是长短信就调用sendsms
frameworks/opt/telephony/src/java/com/android/internal/telephony/RIL.java-->sendSMS
RIL extends BaseCommands implements CommandsInterface