Android system various types of service root planing interpretation

Source: Internet
Author: User

Android has 3 categories of service, in different frame layers of the Android system, specifically interpreted as follows:


1) service in Init.rc

Service Servicemanager/system/bin/servicemanager

Class Core

User System

Group system

Critical

Onrestart Restart HEALTHD

Onrestart Restart Zygote

Onrestart Restart Media

Onrestart Restartsurfaceflinger

Onrestart Restart DRM

In fact, this kind of service is to define the start-up program, the object of the class service is a binary program that can be executed. It is defined as a service to better describe the properties of the binary run, such as running the user, the group, starting once (oneshot) or starting again (the program will start again when it dies). What's more, it can also describe the relationship between the various programs. For example, Onrestart restart DRM, which means that when the DRM program restarts, the program is also actively restarted.


2) System-level service

The service is close to what we usually understand, that is, services in the system, which defines the service interface that the other modules can use through that interface. The execution of such a service can be either binary or Java code. Like what:

C + + type of service:

Surfaceflinger,cameramanagerservice, Mediaplayerservice

Java type of service:

Activitymanagerservice,windowmanagerservice, Networkmanagerservice

The implementation mechanism is that the service registers its services with the ServiceManager mentioned above, and other modules get the interface of the service from ServiceManager by name. In the shell, the command "service list" can list all of the service types in the system.


3) service at the SDK layer

Unlike the previous two types of service, they are a generic term for a class of objects, and the service is a very specific Java class Android.app.Service.java that developers often contact. It is used by Android SDK exposed to third-party apps. It is equivalent to Activity and is one of the four main components of Android (Activity,service, Provider, Broadcastreceiver).


Summary:

First class service: System Integration Engineer is responsible for

The second type of Service:framework system engineer is responsible for

Third-class service: Daily intimate contact for Android app developers in mortal beings

Android system various types of service root planing interpretation

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.