Android MMS topic: MMS source code structure

Source: Internet
Author: User

From the perspective of software functions, MMS can be divided into conversation list, message list, SMS edit, MMS edit, SMS display, MMS display, and configuration.
From the implementation point of view, it is divided into GUI display layer, sending/receiving, MMS resolution, MMS attachments, information data, and so on, these categories correspond to various packages in the source code.

Source code navigation

The source code of MMS is Android/packages/apps/MMS.
MMS/src/COM/Android/MMS contains MMS-related code, while MMS/src/org/W3C/DOM contains a class library, it is mainly used for parsing and displaying MMS format. Here we will focus on the main usage of some packages and classes under MMS/src/COM/Android/MMS.
UI--- GUI display layer: displays the dialog list, message list, message editing page, MMS attachment editing, MMS display, and playback slides. Directly Interacts with users.

  • Conversationlistadapter. Java --- the adapter of the conversation list is used to bind data to the display layer conversationlist.
  • Conversationlistitemdata. Java --- indicates the data structure of each item in the dialog list, which contains the information to be displayed in the dialog list.
  • Conversationlist. Java ------ this is the display window activity of the dialog list. It is a listactivity. These classes are related to the dialog list and are used to display, edit, and manage all the dialogs.
  • Composemessageactivity. Java ---- This is the core window activity. Edit the information and display all the exchange information in a thread. Messagelistview is added to it, and attachmenteditor is added to it. This activity is also responsible for responding to external applications and sending intent requests such as sendto or send. For example, if an external application wants to send information, the activity will respond.
  • Messageitem. Java --- represents the abstract data of an information. It contains all information-related content, such as the topic, message content, mail address, and attachment content. All its data is public internal members and can be accessed directly.
  • Messagelistadapter. Java --- used to bind data to the message list display layer (created by composemessageactivity and bound to messagelistview.
  • Messagelistview. Java --- used to display the message list, inherited from listview. its lifecycle is controlled by composemessageactivity, and its display or not is also controlled by it.
  • Messagelistitem. Java --- is a layout used to display and control the display of each message in the message list.
  • Attachmenttypeselectoradapter. Java --- a list of supported attachments when adding attachments. It is a menu.
  • Attachmenteditor. java --- used to display added attachments when editing MMS information. Its life cycle is controlled by composemessageactivity, and whether the display is controlled by composemessageactivity. When there is a MMS attachment, it will be displayed, otherwise it will be hide. It is a layout manager that manages the following four la S and dynamically displays one of the following four views based on the attachment type.
  • Audioattachmentview. Java --- used to display audio attachments in the editor. It inherits the self-linear layout. It is not used directly in the code, but in the layout file as the layout manager.
  • Imageattachmentview. Java --- used to display image attachments in the editor. It inherits the self-linear layout. It is not used directly in the code, but in the layout file as the layout manager.
  • Slideshowattachmentview. Java --- used to display slide attachments in the editor. It inherits from the linear layout. It is not used directly in the code, but in the layout file as the layout manager.
  • Videoattachmentview. Java --- used to display video attachments in the editor. It inherits the self-linear layout. It is not used directly in the code, but in the layout file as the layout manager.
  • Slideshowactivity. java-used to play a slide in full screen, that is, to display a slide, because the creation and playback of MMS are both in the form of a slide, that is, one by one, each with texts, images, video and audio, each with a browsing duration.
  • Slideshoweditactivity. java --- manage slides in a list, that is, display all slides in a list. You can add a slide or click to edit a slide, used to create and edit slides.
  • Slideshoweditor. Java --- used to edit a slide page, such as adding, deleting, and replacing elements. The elements here can be images, videos, audios, and text. It can also be used to edit the entire slide, such as deleting a slide page and adjusting the position of this slide in all slides. It is an encapsulation of a specific operation slide. slideeditemeditivity creates it and uses it to edit the Ji Deng.
  • Slideshowpresenter. Java --- used to show all slides, that is, to play all slides. Created and used by slideshowactivity.
  • Slideviewinterface. Java --- defines some interfaces used to display the content of a page of slides, such as setting images, setting videos, setting audios, Playing videos, playing audios, pausing, and randomly locating. View displayed in the attachment: audioattachmentview, imageattachmentview, slideshowattachmentview, and videoattachmentview all implement this interface, so that attachmenteditor can use a unified interface to control content playback, you don't have to worry about the specific content.
  • Slideeditstmti.pdf. Java --- used to edit a slide page, such as adding audio, video, image, and text. It only provides a user interface that allows users to operate various buttons to add, replace, or delete elements. Slideshoweditor is used to operate a specific slide, which is mainly responsible for interaction with users.
  • Slidelistitemview. Java --- layout management of each item in the slideshoweditactivity list, inherited from linearlayout.
  • Mmsthumbnailpresenter. java --- used to display thumbnails of MMS in the message list. The contents of MMS are not fixed, which may be images, audios, videos, or slides, therefore, this class is used to process and display thumbnails of MMS.
  • Messagingpreferenceactivity. Java --- the configuration information editor of MMS, used to edit and change the configuration information and inherit preferenceactivity. It is responsible for interacting with users, displaying and changing configurations. When MMS is started, mmsconfig reads the configuration information from sharedpreference, And the configuration information of other classes is obtained from mmsconfig at runtime, mmsconfig provides many get methods to obtain configuration information.
  • Presenter. Java --- shows an abstract class of the attachment.
  • Presenterfactory. Java --- factory method.
  • Recipientsadapter. Java
  • Recipientseditor. Java --- used to display the recipient's edit box on the information editing page. It can be automatically supplemented. The complete data is provided by the recipientsadapter.
  • Viewinterface. Java --- represents the base class of a view. It is used for slideshow to display content or take thumbnails. View length, width, and height.
  • Basicslideeditorview. Java --- the layout used to edit a slide of a page, that is, it is used in slideeditoracti.pdf. java.
  • Editslidedurationactivity. Java --- as the name suggests, used to edit the viewing duration of a slide on a page.
  • Managesimmessages. Java --- this is used in settings to manage messages in Sim. One of the settings is to manage messages on the SIM card. In the settings of MMS, you can set whether to store the information on the SIM card or on the mobile phone. When receiving a mail, smsreceiverservice will view this setting and write the received information to the corresponding address. Managesimmessages also displays information in the SIM in a list. It provides two menus: storing and deleting information on the mobile phone.
  • Numberpickerbutton. Java --- used to display the button of the selected number, which is used in the configuration.
  • Numberpickerdialog. Java --- displays the dialog box for selecting numbers, which is used in the configuration.
  • Numberpicker. Java --- used to select a number during configuration. The numerpicker is mainly used in settings.
  • Deliveryreportactivity. Java --- information sending situation report. Display in list
  • Deliveryreportadapter. Java --- corresponding Adapter
  • Deliveryreportitem. Java --- data of each item
  • Deliveryreportlistitem. Java --- layout of each item.

Data--- It is used to operate on the relevant data of the information being edited, such as the contact list, such as the current conversation, such as the current message. Manages the information being edited, the current conversation, and the contacts used in the current information. These classes are used when editing information. Most of these classes are used to manage data and cannot be passed directly as an object to the editor. So many of their methods are static, that is, these classes are similar to single keys.

  • Workingmessage. java --- used to manage the currently edited message. It exists from creation, draft to sending. A workingmessage is created when the Edit information page is opened until the editing page is exited.
  • Conversation. Java --- used to manage the threads of a dialog. It is usually used to manage the current dialog, that is, the incoming dialog and the ongoing dialog. It is also used to manage the dialog list, such as querying the dialog list.
  • Contact. Java --- used to indicate the information of a contact, manage the contact, load the contact information, and cache the corresponding information. Because the data of a contact is mostly including names, names, surnames, various phone numbers, various addresses, and so on. Because contact is directly used as a contact in MMS, all information is obtained directly from it. In addition, because contacts are also involved in information interaction, because you can directly use a series of phone numbers when sending and receiving emails, you need to add Contacts. There are many asynchronous operations in the contact. For example, asynchronous operations are required when the contact information is loaded or when the cache is updated to avoid blocking the caller.
  • Contactlist. Java --- is a list of contacts inherited from arraylist <contact>. Used to manage a contact list or multiple contacts. Because each message can be sent to multiple contacts, you need to use contactlist to manage these recipients. It also provides some methods to facilitate the storage and transmission of contact information, such as converting multiple contact information into a string or a string array.
  • Recipientidcache. Java --- used to save the ID and address (phone number) of the contact used ). Each workingmessage updates the cache, and contactlist first queries contacts from the cache.

Dom--- Toolkit for parsing MMS content smil
DRM--- Toolkit for processing media files of DRM
Layout--- Layout elements modified to meet special needs
Model--- The data structure of attachments supported by MMS and the attachment organization mode are defined. MMS can contain images, videos, audios, and texts. These contents can exist independently or together. If they are combined, the slides are displayed. You can use slides to create attachments containing multiple media and display images and texts. Videos, audios, images, and texts can be added to each slide. However, only one image or video can be added to each slide, audio can be added only when no video is available. You can set the playback duration of each slide and the scrolling speed of the text.

  • Carriercontentrestriction. java --- is a specific MMS attachment check site. If the size of an unsupported attachment is exceeded, the image resolution is incorrect, or the image size is exceeded, an exception is thrown: unsupportedcontenttypeexception, resolutionexception, exceedmessagesizeexception, contentrestrictionexception.
  • Contentrestriction. Java is the interface used to check attachments. This interface is directly used by the outside, and the specific implementation is carriercontentrestriction.
  • Contentrestrictionfactory. Java is the factory method for creating an attachment check. Create a contentrestriction object externally through this factory, and then use the check method defined in it to perform the internal check of the attachment.
  • Smilhelper. Java tool class used to parse and process the SMIL in the attachment.
  • Imodelchangedobserver. Java interface, used to listen for changes in the attachment content.
  • Model. java --- the data organization and management mode of MMS attachments is that each attachment is a subclass of a model. It is used not only to manage the specific data of attachments, such as Uri, size, file name, and location, it can also be used to display attachments and view attachments in the GUI.
  • Layoutmodel. Java --- inherits from the class that model uses to manage the layout of visual attachments. It is used to manage basic elements such as regionmodel. It is like viewgroup, linearlayout, relativelayout, and other layout managers, used to organize and manage the basic layout elements, that is, the imagemodel, textmodel, and videomodel subclasses of regionmodel.
  • Regionmodel. Java --- inherits from model to manage visual attachments and la s, such as videos and texts. It is used to control the position of a visual attachment on the screen, especially when the visual attachment is displayed. A regionmodel represents an area on a slide. It is a basic element of the layout on the slide. It is like a view in the UI element, but it is used mostly as a subclass, that is, imagemodel, textmodel and videomodel.
  • Regionmediamodel. Java --- inherits from mediamodel and is used for layout control of the visible part of multimedia attachments. It is mainly used for displaying attachments and controlling slides. Its subclass is imagemodel, textmodel, and videomodel.
  • Mediamodel. java --- inherits from the model, which represents the data structure of the media and manages the specific attachment data. It is also used to manage the display control of the attachment, the display of the image, and the playback control of the audio and video.
  • Mediamodelfactory. Java --- it is used to parse mediamodel from a PDU attachment, that is, to convert the PDU to the attachment data in the MMS.
  • Imagemodel. Java-inherited from regionmediamodel is used to manage image attachments and control the display of image attachments.
  • Videomodel. Java --- inherits from regionmediamodel to manage video attachments and control the playback of video attachments.
  • Audiomodel. Java ---- inherits from mediamodel to manage audio attachments and control the playback of audio attachments
  • Slidemodel. Java ---- inherits from the model to manage a group of attachments. These attachments are displayed to the user at the same time. Just like a slide, each slidemodel contains a list of models that can be stored, including text, audio, images, and videos. The attachments above are displayed at the same time.
  • Slideshowmodel. Java --- inherits from the model and is used to manage all attachments in a MMS. It contains a list of slidemodel storage, which is used to save and control all the attachments in a MMS Message. In addition, it is also responsible for displaying these attachments, organizing slidemodel one by one, and playing. It is also responsible for converting these MMS forms of attachments (various models) into accessories PDU for Android, and proposing their respective models from PDU, because slideshow is the MMS processing method at the application layer, the MMS data that can be sent and received is PDU.
  • Textmodel. Java --- inherits from regionmediamodel to manage text attachments and control the display of text attachments, such as scrolling by Time

Util--- This is the entire MMS shared tool class, all of which are single keys or directly used classes. You cannot create objects or use them as objects.

  • Addressutils. Java --- there is currently only one getfrom () method for obtaining the sender's address.
  • Draftcache. Java --- used to identify which threads have draft and which have no, that is, to manage and query the draft status of a conversation. It maintains a hashset, which contains all thread IDs containing drafts. There is also a hashset used to store ondraftchangedlistener, that is, when the draft status of the thread changes, draftcache will call the corresponding listener to inform the corresponding module that the draft status of this conversation has changed. You can use draftcache. setdraftstate (threadid,
    State) to set the draft status of a dialog. You can use draftcache. hasdraft (threadid) to check whether a dialog contains a draft.
  • Recycler. Java --- is an abstract tool class that defines smsrecycler and mmsrecycler to delete obsolete messages or information that exceeds the information limit. The methods used are recycler. getsmsresponer. deleteoldmessages (context) or recycler. getmmsrecycler. deleteoldmessages (context)
  • Smileyparser. Java --- converts a punctuation expression into a graphic expression, for example, an icon smiling face.
  • Downloadmanager. Java --- Do not be fooled by the name. It is not a real download manager because it is not responsible for any file download process or file download management. It is used to manage configuration information related to download, such as whether the download is automatic or not, and various notifications during the download process, such as notification bar and toast prompts.
  • Ratecontroller. Java
  • Sendingprogresstokenmanager. Java

Transaction--- For MMS, It is the underlying package that is invisible to users. It is responsible for the final processing of information sending and initial processing of information receiving. It is mainly responsible for sending and receiving information. It is not really sending and receiving information. The system frameworks is responsible for receiving and sending information. This package is sent and received only at the MMS application layer.

  • Abstractretryscheme. Java
  • Defaultretryscheme. java-these two classes implement a Retry Mechanism because the sending and receiving of information is restricted by the environment. For example, the mobile phone does not have a signal or the network connection is unsuccessful, the message will be placed in the pending queue, and the message will be sent and received again after a period of time. The two classes here are used to implement the Retry Mechanism.
  • Httputils. Java-the bottom-layer implementer for sending and receiving MMS messages. It is responsible for receiving and sending MMS messages to the mmsc MMS Service Center over HTTP.
  • Messagesender. java-as its name implies, it is an interface encapsulated to send information. It contains only one method sendmessage (), the UI Layer only needs to call the class that implements this interface to send information.
  • Messagingnotification. Java-specifically responsible for notification on the status bar, such as newly received information, failed message sending, or failed message receiving. It is shared by the UI Layer and the logic layer.
  • Mmsmessagesender. Java-inherits from messagesender and is used to send MMS messages. It does not do sending, but does some error check and preparation, and then starts transactionservice for sending.
  • Icationicationtransaction. Java-inherits from transaction and is responsible for receiving MMS messages and update notifications ). When a new MMS message is sent, frameworks sends a text message, called a notification message (notifindication), which contains information related to MMS (mmsc, contentlocation (URL) of MMS ), then, the application uses the contentlocation command to retrieve the MMS. This notificationtransaction is used to process MMS notifications. It extracts the multimedia data (PDU) from mmsc, writes it to the database, and updates the notification. Note that only the MMS settings are automatically obtained ("Auto
    "Retrieve"), it will download the MMS; otherwise, it only processes the notification indication, instead of the MMS.
  • Observable. java-the object to be observed is defined in it, and transaction is a subclass of it. Other objects, transaction, are observation objects. A list in it stores the reference of the observer. When a transaction is completed, alternatively, the notifyobservers () method is called to notify the observer of the status when an exception occurs.
  • Observer. Java-Observer, transactionservice implements this interface. It is the observer of all transactions to listen to their statuses and processing results. Because all transactions are asynchronous, the observation mode is used to notify the processing result of transaction.
  • Privilegedsmsreceiver. java-inherited from the event monitor of smsreceiver SMS reception, responsible for listening to new SMS events android. provider. telephony. intents. sms_received_action ("android. provider. telephony. sms_received "); when the intent is received, it indicates that there is a new text message. It will call up smsreceiverservier to process text messages.
  • Progresscallbackentity. Java
  • Pushreceiver. java-A broadcastreceiver is specially used to receive MMS events for Android. provider. telephony. wap_push_received_action ("android. provider. telephony. wap_push_received). It starts some preprocessing and transactionservice. transactionservice creates icationicationtransaction to process the MMS notification.
  • Readrectransaction. Java
  • Retrievetransaction. Java-inherits from transaction and is used to actively obtain MMS data. When the MMS settings are not automatically obtained, the user needs to trigger the retrieval. transactionservice creates a retrievetransaction to obtain the multimedia message data (PDU), store the message to the database, and update the notification.
  • Retryscheduler. Java
  • Sendtransaction. Java-inherited from transaction, used to send MMS data.
  • Simfullreceiver. Java
  • Smsmessagesender. Java-encapsulation of SMS sending, inherited from messagesender. It starts smsreceiverservice for sending.
  • Smsreceiver. java-it is a broadcastreceiver. It is used to send messages, receive information requests, and call smsreceiverservice to process and send messages instead of being sent by its name. This may be the reason for the android naming rule. Four components in Android like to add the component name. For example, composemessageactivity is an activity and transactionservice is a service, here, smsreceiver is a broadcastreceiver
    SMS. Of course, this is a bad name.
  • Smsreceiverservice. Java-it is a service dedicated for sending and receiving text messages. It listens to events by smsreceiver and privilegedsmsreceiver, and then starts it. It does not listen to intent events on its own.
  • Smsrejectedreceiver. Java
  • Smssinglerecipientsender. java-inherited from smsmessagesender. It calls the frameworks layer interface to send messages to a receiver. For MMS applications, this is the last station for sending messages. For applications, it sends the text message.
  • A Data Structure Used by transactionbundle. Java-transaction to send data to transaction.
  • Transaction. java-base classes of various transactions, which define two methods: getpdu () and sendpdu (). The two methods are to retrieve MMS data from mmsc and send data to mmsc. It is a layer-based packaging of httputils.
  • Transactionservice. Java-is a service that receives various transaction requests and then processes transaction. Each transaction starts asynchronous processing of new threads. Therefore, when the processing is completed, the observer is used to notify transactionservice.
  • Data Structure of transactionsettings. Java-MMS configuration information, such as mmsc, proxy, and port. The requester may provide the data, which will be used if provided; otherwise, the default data will be loaded from the Telephony database, which is related to the carrier and APN settings.
  • Transactionstate. Java-the data structure that identifies the processing status of each transaction. It is very simple. It only indicates whether the processing is successful or failed and is used when transaction calls back The Observer (transactionservice.

There are also some files under the root directory of COM/Android/MMS, most of which are defined basic class exceptions and some public classes.

  • Mmsapp. Java --- the MMS application performs some necessary initialization work when the application process starts, such as configuration, download, contact, conversation, smiley parser, and notification.
  • Mmsconfig. Java --- manage common configurations of MMS, such as the maximum MMS size, the maximum MMS image size, and the maximum number of recipients. These configuration information is stored in RES/XML/mms_config.xml. Mmsapp calls mmsconfig. INIT () during initialization, where loadmmssettings is called to parse mms_config.xml to obtain the required configuration information. Other modules only access the configuration information through mmsconfig.
  • Logtag. Java --- control of log tracing information. It can easily control the log output level. However, this logtag is not used in the entire MMS code.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.