Android mediascanner: (1) Overall mediascanner Architecture

Source: Internet
Author: User

Http://blog.csdn.net/thl789/article/details/7583352

2012-05-19

This article is an analysis and induction by the author, and is presented with a UML diagram (class digoal/sequence digoal. Although it comes from the analysis of the android source code, the text will not take a lot of space to list the source code, so when reading this article, it is best to have the android source code at hand, combined with the source code for interpretation. This article describes the architecture of mediascanner.

Mediascanner is the basis of Android media. When the system is started, it scans media files for later use. When new media files are added or deleted, the corresponding media library needs to be updated. Android music and gallery play or present media filesProgramIt also scans media files based on stable mediascanner. Otherwise, it will be found that the URI of the media files operated by the program is not actually the corresponding media file, or you may even have problems with incoming call ringtones and alarms.

Mediascanner is located in packages/providers/mediaprovider, including mediascannerreceiver, mediascannerservice, and mediaprovider.

Is the androidmanifest content under packages/providers/mediaprovider:

    • Mediascannerreceiver is a broadcastreceiver that receives broadcasts and performs media scanning. It is also one of the interfaces provided by mediascanner to the outside world. After receiving the broadcast, start mediascannerservice to perform the scan.
    • Mediascannerservice is a service responsible for media scanning. It also uses mediascanner in the framework to perform specific scanning. The scanning results are in the database provided by mediaprovider.
    • Mediaprovider is a data provider of contentprovider and media library (images/Audio/Video/playlist. Operates databases and provides insert, query, delete, update, and other operations to other programs.

In addition, the imediascannerservice and imediascannerlistenter interfaces provide other programs with the ability to scan a single file through aidlipc calls. The interface is defined in the framework and implemented in the service.

 

The following describes each part of mediascanner:

Android mediascanner: (1) Overall mediascanner Architecture

Describes the architecture of mediascanner.

Android mediascanner: (2) mediascannerreceiver

Describes how mediascannerpolicer processes different requests from broadcast.

Android mediascanner: (3) mediascannerservice

Perform static analysis on the class structure of the mediascannerservice and dynamically analyze the work at creation and startup. The analysis process shows how the mediascannerservice handles various scanning requests received by the mediascannerizer.

Android mediascanner: (4) scansinglefile of mediascanner

This article starts from the scanfile entry of mediascannerservice and analyzes in detail how mediascanner and mediascannerclient scan and process a single media file.

Android mediascanner: (5) scandirectories of mediascanner

Android mediascanner: (6) Native Implementation of mediascanner

Android mediascanner: (7) Summary of mediascanner's complete process

Android mediascanner: (8) imediascannerservice interface implementation

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.