Android Start up process

1.linux kernel , load linux kernel

2 init Process initializes various devices ,

implement Daemon process , Administration USB,ADB Link Manager ,Debugger system ,rild Manage wireless links

Content Manager process , Provide operation Android Various system service information

Media Server

Zygote Process for shortening Android Application load time , whenever Java Application time ,Zygote Will spawn a child process to execute the application's virtual machine

System Server process Zygote Process creation , stay Android During startup Zygote after , Running System
Server It needs to be registered in the Content Manager in

Android And JNI

take Java Layer and C/C++ Organic connection , Make them coordinate with each other , Accomplish a task together

java Call in C library

1, to write java code

2, compile java code javac

3, generate C Language header file

4, to write C code

5, generate C Shared library

6, function java program

java Virtual machine uses function prototype to java Code and C Code mapped together javah

call JNI code .C transfer java

1, establish java object

2, Accessing static member domains

3, Calling static methods of a class

4, visit Jjava Object member variable

5, visit Java Object method

Zygote

1, The virtual machine is initialized at run time , And start it

AppRuntime Inherited from AndroidRuntime Used to initialize and run virtual machines

registerZygoteSocket() When used to process requests to create apps fork process

load Framework Classes and platform resources in preloadClasses() and preloadResources()

function SystemServer

runSelectLoopMode() Enter cycle , Processing requests from the bound socket

Android service profile

Services include Android system service , Two kinds of application services

System services are provided by Framework provide

Application services are inherited and implemented by developers Service Developed after class

Application services are divided into : Local service , Remote service , The distinction is whether to run in the same process

System services are divided into : Local system services ,Java system service

Local system services (Audio Flinger Mix multiple audio data , And send to headset , speaker ,Surface Flinger
Combining the Surface Render to Frame Buffer),

Java System services are divided into : Core platform services , Hardware Services

Core platform services

Activity Manager Service: Manage all Activity Life cycle and stack of

Window Manager Service, be located Surface Flinger above , Transfer the content of the machine screen to be drawn to Surface Flinger

Package Manager Service load apk File information , Provides information on which packages are set in the system

Hardware Services ( Used to control the underlying hardware )

Alarm Manager Service timer

Connectivity Service Provides information about the current state of the network

Location Service Provide information about the current location of the terminal

Power Service Device power management

Sensor Service Sensor sensing value

Telephony Service telephony support

Wifi Service Control wireless network status

System service initialization code

System services need to register relevant information to Context Manager in , so that Android Applications are able to use the services they provide

Definition of main terms

Android Binder IPC

Android Binder Driver

Service usage from the perspective of process

IPC The process is divided into service registration , Service retrieval , Service usage

Service registration Service Server And Context Manager Between IPC

Service retrieval Service client and Context Manager Between IPC

Service usage Service client and Service Server IPC 

from Binder Service use from the perspective of

Context Manager( Service registration , Service retrieval )

use C Language writing , In order to make it Binder Driver Close connection

Android Service Framework

Native Service Manager

Service Server And Service Manager Relationship of

Java Service Framework

Service generation :Java There are two service methods ,1, inherit Binder,aidl language .2, inherit Service development

The first ,Java System services register services to Context Manager in , And then through Service Manager Using services

The second ,Java Application services are provided by Activity Manager Service Manage

Java Service Manager

Java System service operation analysis

Activity Manager Service establish Activity service Broadcast, etc , And manage their life cycle

Zygote After the process is created, the ActivityThread Load into new process Will create Application and ActivityThread and loop

ActivityThread call attachApplication() And ActivityManagerService Establish a connection   Application request service

ActivityThread adopt attach establish ActivityManagerService connect   Service request application

Technology
©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )Unity3D of UGUI Basics -- Three modes of canvas os Simple use of module computer network --- Basic concepts of computer network ( agreement , system )html Writing about cherry trees , Writing about cherry trees Some East 14 Pay change 16 salary , Sincerity or routine ?Unity-Demo Examples ✨ realization UI- Backpack equipment drag function 06【 Interpretation according to the frame 】 Data range filtering -- awesome java Four functional interfaces ( a key , simple )