Android Package Management Service Packagemanagerservice Source analysis

Source: Internet
Author: User

The APK program under the Android system is managed by the package management Service called Packagemanagerservice. Packetmanagerservice is an important service of Android system, launched by Systemserver, mainly implements APK package parsing, installation, updating, mobile, uninstall and other services. Whether it's a system apk (/system/app), or we install it manually, all of the system's APK is managed by it.

Take the Android 4.0.4 source code as an example, Android4.0.4/frameworks/base/services/java/com/android/server/systemserver.java in the Run () The function is the implementation process for all system services that the Systemserver component initiates, including Packagemanagerservice. An object of the Packagemanagerservice class is defined in line 112 of the file.

Ipackagemanager pm = null; Defines an object of a Packagemanagerservice class

and then from 163 Line start to 170 line implementation of the Packagemanagerservice object construction process, in fact, here is the most complex? Packagemanagerservice the process of constructing an object, the startup process is relatively straightforward.

PM = Packagemanagerservice.main (context,                    factorytest! = Systemserver.factory_test_off,                    onlycore);        Starting Packagemanagerservice, the implementation of this main function is shown in the current directory Pm/packagemanagerservice.java 831 lines           Boolean firstboot = false;            Determines whether the Packagemanagerservice is the first start of the                        try {                firstboot = Pm.isfirstboot ();            } catch (RemoteException e) {            } Packagemanagerservice.main () This function implements the Packagemanagerservice startup and registration process, the code is as follows: public    static Final Ipackagemanager Main (Context context, Boolean factorytest,            boolean onlycore) {        Packagemanagerservice m = new Packagemanagerservice (context, factorytest, onlycore); A Packagemanagerservice object is constructed here and the        servicemanager.addservice ("package", m) is started;  Register Packagemanagerservice to ServiceManager        return m;    }


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.