Android plug-in technology has been out for a long time, from the package to build a powerful "Android plug-in: From the beginning to give up," the plug-in technology scenario is also clear.
The app plugin involves a lot of basics
1.app Start-up process
Process analysis, first click on the app icon from launcher, then to the activity of the onresume.
In AMS call startprocesslocked, first open a new process, synchronization of a main thread.
Is the process of starting the default activity.
1.1launcher->ams (system_server) Launcher first send request to initiate activity
1.2AMS determines that the request is a new app creation request, which is very complex and eventually goes to startprocesslocked, creating the process:
Process.processstartresult Startresult = Process.Start (entrypoint, app.processname, uid, uid, Gids, DebugFlags, Mountexternal, app.info.targetSdkVersion, App.info.seinfo, Requiredabi, Instructionset , App.info.dataDir, Refreshtheme, Entrypointargs);
1.3 Calling Zygote to start a new process is actually a standard process of fork.
1.4 Start the Activitythread.main method, get parameters such as name, and bind to the new process started by zygote.
1.5 Bind the new process to AMs.
1.6 AMS initiates activity within the new process.
2.APK Packaging Process & automatic packaging technology.
The first step: Package the resource file and generate the R.java.
First look at AAPT Source: Resource.cpp inside the key function buildresources
Buildresource inside, check the legitimacy of Androidmanifest.xml, and then start Makefilereource, put res under the resource file
Added to the resourcetable. Call Compileresourcefiles, parse the Value-xml file, and then add the RESOURCE.ARSC file.
Compileresourcefiles will eventually call Parseandaddentry and write the resources to R.java.
It then calls Compilexmlfiles, processing other XML files such as Drawable,anim,layout.
RESOURCE.ARSC is resoucetable. Parsing of this file: http://www.cnblogs.com/feng9exe/p/5676802.html
Eventually AAPT will assect inside the Files,resource.arsc,androidmanifest.xml and other unified packaging as "*.AP_" file.
Step two: Aidl compile to generate the corresponding. java file. The AIDL compilation process is actually the Aidl file automatically generated Java files, generated and placed in the bin\classes
Below.
Step three: Compile the project source code to generate the class file.
Compile all SRC code below to generate the corresponding class file. Assume that in general, just use the Android SDK development.
Fourth Step: Program the class file as a dex file. The main function of the DX tool is to convert Claass to the Dex file used by Dalvik. Eliminate redundant information, compress constant pools, and so on.
Fifth Step: Package build apk file, packaging tool for Apkbuilder.
The main is to pack, Resource.ap_,dex files into an apk file, but no signature.
There is also a process Proguard in the class file to Dex. Class+progroud->dex
Sixth step: Signature, currently there are 2 ways, jarsinger tools, or signapk tools.
Seventh step: After the signature, the byte needs to be zipalign, and the tool is the one doing it.
At this point, the entire packaging process is over.
Android hot fix, plug-in development---basics