I have been reading the MMS code for more than a month. I think it is necessary to take notes. I am reading the 1.5cupcake code. I also roughly browsed the code 2.2froyo. The difference is not big. When you look at the code, it is best to look at some WAP protocol, such as WAP-206-MMSCTR-20020115-a, WAP-209-MMSEncapsulation-20020105-a, also can look at the SMIL manual and its MMS Application Guide (Series 60 developer platform 2.0)
I. Sending and receiving MMs in four macro steps
A. Terminal A sends a MMS Message to the MMS Center (mmsc) and post it to mmsc through the WAP Gateway
B. mmsc sends push messages to SMSC through pushproxy gateway, and SMSC forwards messages to Terminal B
C. Terminal B uses the get method to obtain a MMS Message from mmsc through the WAP Gateway.
D. mmsc sends a delivery report (delivery report) to Terminal A through the pushproxy gateway and SMSC)
2. Interaction between MMS and external modules
MMS is mainly used with the Telephony framework and HTTP. The former is used to receive push messages, and the latter is used for data transmission.
Iii. MMS module division
A. Model: manages the layout of multimedia elements (text, images, audio/video), Resource Uris, and user event responses.
B. Dom, abstraction of SMIL files, describing the triggering of SMIL file nodes and events
C. UI, text message/MMS browsing and editing
D, transaction, transmission of MMS
E. Storage of provider. telephony MMS
In addition, the org. W3C. Dom package is a higher abstraction of the data model. com. Google. Android. MMS is an encapsulation of the multimedia PDU and data base.
4. Class Diagrams of each module
The log Paster function of csdn is not powerful, so it can only be described in a small amount.
A. Model dom
Txetmodel, imagemodel... all are subclasses of the model to implement eventlistener. handleevent (event EVT) interface, which is very important and used to respond to user actions. Dom classes are inherited from nodeimpl and nodeimpl has eventlistener aggregation, that is to say, the Dom will call handleevent, so that the model and the Dom are linked.
B. Transaction
Observer. Java: void Update (observable );
Observable. Java: Public void policyobservers () will call the update () method
Transaction. Java: public abstract void process (); its subclass mainly overrides this method
Readrectransaction. Java only sends a read report and does not need to return results from the MMS center. Therefore, it does not need to inherit the runnable interface.
Both the retrievetransaction and icationicationtransaction functions obtain mms. The former is used for manual acquisition, and the latter is used for automatic retrieval.
5. Dynamic Graph
I have prepared a picture on yongzhong work, but I can't upload it here. Let's just stop it.
A. Receiving of MMS
The RIL layer will actively report the ril_unsol_response_new_sms message and the smsdispatcher at the Telephony framework layer. java continues to distribute push messages to the upstream application layer. java receives intent. wap_push_received_action, and then call pduparser to parse the byte data into PDU (M-Notification.ind
), PDU is divided into headers and bodies, and the body is composed of multiple parts. Then, call the pdupersister class to store the PDU into the database, and then start transactionservice,
In transactionservice, according to the transmission type (transaction. icationication_transaction), create icationicationtransaction instance, which sends GET request, get new PDU (M-retrieve.conf), replace the PDU just saved to the database, send Transfer Report (M-NotifyResp.ind)
B. Sending of MMS
Mmsmessagesender. java first calls pdupersister. load (mmessageuri) forms a PDU, starts transactionsrvice, creates a sendtransaction instance that post the PDU (M-Send.req) out over HTTP, returns a PDU (M-Send.conf) that sends confirmation ), then let's talk about M-Send.req moving from outbox to sent, and after a while, pushreceiver will receive a PDU (M-Delivery.ind) that sends the report)