zoukankan      html  css  js  c++  java
  • Android 源码阅读之SMS,MMS

    主界面:

    com.android.mms.ui.ConversationList.java  [extends ListActivity]

    点击新建信息:onListItemClick -〉 position == 0 -〉createNewMessage()-〉 startActivity[ComposeMessageActivity]

    com.android.mms.ui.ComposeMessageActivity.java

    点击发送按钮:onClick -> mSendButton -> confirmSendMessageIfNeeded()  -> sendMessage(true) ->

    mWorkingMessage.setPhoneId(phoneId); mWorkingMessage.send(mDebugRecipients);

    com.android.mms.data.WorkingMessage.java

    send:如果是彩信 sendMmsWork 如果是短信preSendSmsWorker

    -------------------------------------------------------------------------------------------------------

    短信流程:

    preSendSmsWorker -〉 sendSmsWorker -〉SmsMessageSender.sendMessage(threadId)

    com.android.mms.transaction.SmsMessageSender.java

    sendMessage -> queueMessage ->

    mContext.sendBroadcast[SmsReceiverService.ACTION_SEND_MESSAGE, SmsReceiver.class]

    com.android.mms.transaction.SmsReceiver.java

    com.android.mms.transaction.SmsReceiverService.java

    handleMessage -> ACTION_SEND_MESSAGE -> handleSendMessage -> sendFirstQueuedMessage ->

    SmsSingleRecipientSender.sendMessage

    com.android.mms.transaction.SmsSingleRecipientSender.java

    sendMessage -> SmsManager.sendMultipartTextMessage

    进入Framework层

    frameworks/base/telephony/java/android/telephony/SmsManager.java

    sendMultipartTextMessage -> 一条短信是不是需要分多个部分(太长)?

    ISms.sendMultipartText | ISms.sendText

    frameworks/base/telephony/java/com/android/internal/telephony/IccSmsInterfaceManager.java

    sendText -> CdmaSMSDispatcher.sendText | GsmSMSDispatcher.sendText

    [cdma]

    frameworks/base/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java

    sendText -> sendSubmitPdu -> sendRawPdu ->

    sendSms | sendMessage

    sendSms -> CommandsInterface.sendCdmaSms

    frameworks/base/telephony/java/com/android/internal/telephony/RIL.java

    sendCdmaSms -> RIL_REQUEST_CDMA_SEND_SMS

    hardware/ril_c/reference-ril/reference-cpb71.c

    case RIL_REQUEST_CDMA_SEND_SMS: requestSendCdmaSMS -> at_send_command

    [gsm]

    frameworks/base/telephony/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java

    sendText -> sendRawPdu ->

    sendSms | sendMessage

    sendSms -> CommandInterface.sendSMS

    frameworks/base/telephony/java/com/android/internal/telephony/RIL.java

    sendSMS -> RIL_REQUEST_SEND_SMS



    现在读彩信,从sendMmsWork开始:

    com.android.mms.data.WorkingMessage.java

    sendMmsWorker -> MmsMessageSender.sendMessage(threadId)

    com.android.mms.transaction.MmsMessageSender.java

    sendMessage -> mContext.startService[TransactionService.class]

    [注意 pdu.getMessageType() != PduHeaders.MESSAGE_TYPE_SEND_REQ throw new MmsException]

    com.android.mms.transaction.TransactionService.java

    onStartCommand -> launchTransaction -> ServiceHandler.sendMessage[EVENT_TRANSACTION_REQUEST]

    ServiceHandler:handlemessage - EVENT_TRANSACTION_REQUEST - Transaction.SEND_TRANSACTION -

    transaction = new SendTransaction - processTransaction(transaction)

    SendTransaction.process

    [注意,标红处查看代码 getTransactionType case PduHeaders.MESSAGE_TYPE_SEND_REQ:

    return Transaction.SEND_TRANSACTION]

    com.android.mms.transaction.SendTransaction.java

    process -> run -> sendPdu -> HttpUtils.httpConnection



  • 相关阅读:
    命令行构建Unity项目
    Android AIDL实例解析
    Android aidl Binder框架浅析
    Uri详解之——Uri结构与代码提取
    Glide使用详解(一)
    ImageView的scaleType详解
    关于Android导入开源项目:Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFa
    15 个 Android 通用流行框架大全
    动画 节拍器
    Android background tint颜色渲染
  • 原文地址:https://www.cnblogs.com/bill-technology/p/4130927.html
Copyright © 2011-2022 走看看