Android Packagemanager Basics

Source: Internet
Author: User

First, Packagemanagerservice START process

Systemserver starts first, creates a serverthread thread to start all Android Core Services, where the Packagemanagerservice.main method initiates Packagemanagerservice.

The main method is to instantiate the Packagemanagerservice object and register it in ServiceManager.

the construction process of Packagemanagerservice is designed to several important operations:
1. Create a Settings object, add Shareduser to it, Shareduserid defined in the Android manifest file, for example Android.uid.system is defined here. The settings constructor also creates a series of directories and files, such as the/data/system directory.
UID Range in Android:
system_uid = +;
non-system application 10000~19999;
isolation sandbox process 99000~99999;
2. Create the App Installer installer.
3. Start the message processing thread--a handlerthread named Packagemanager.
4, create user management object Usermanager.
5. The XML file under/etc/permissions is read and parsed through the Readpermissions () method, including the permissions assigned to the UID, the hardware information under the feature tag, and the configuration information of the system library.
6, read the installation package information, including the following important files:
/data/system/packages.xml The package information installed in the system.
/data/system/packages-stopped.xml records The package information that is forced to stop in the system.
/data/system/packages.list Save all non-system-brought APK information from the system.
7. Monitoring and scanning System Package installation directory:
/system/framework System Library
/system/app default System Application
/vendor/app Manufacturer-specific applications
8. Scan non-system APK information:
/data/app/
/system/preloadapp/
/data/app-private/


II, Packagemanager framework
    Android's Packagemanager framework is a typical aidl framework. Code path Dir=framework/base/core/java/android/.
    ipackagemanager.aidl files in dir/content/pm/ Ipackagemanager.aidl, in accordance with the Android standard aidl processing mode, generates a stub ipackagemanager.stub and a proxy IPackageManager.Stub.Proxy.
    stub implementations are Packagemanagerservice, and the actual implementation of the agent is actually Applicationpackagemanager,packagemanager is its parent class.
    Applicationpackagemanager path is dir/app/ Applicationpackagemanager.java.
    Packagemanager path is Dir/content/pm/packagemanager.java.
    The method in Context.getpackagemanager is actually called when the Contextimpl () method is called. This method takes a Ipackagemanager proxy object from the Activitythread and instantiates the Applicationpackagemanager with this proxy.

Android Packagemanager Basics

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.