Today, Mingo wants to talk to you about how to make the transition from application development to Framework development.
System application development, now speaking, has begun to separate from the system, out of development, system custom interface, has been provided to the application call, used to enhance the function.
Native desktop, dial, setting, has been unable to make differentiation advantages, so are struggling to carry out in-depth application development.
For the previous maintenance system application module people, tinkering, really no growth. Everyday work, there is no deep technical barriers, it is easy to be attacked by others.
For example, Settings, such as contacts, in small changes, modify the fault, there is no very high requirements, done application development, can come to join a foot, change the problem. And let an application developer to modify the system interface, estimated change heart tired, and hesitant.
Technical barrier, also is own competitive advantage. Only indomitable technical ability, and persistent learning, expand their depth, breadth, then your position is unbreakable, will not be easily replaced.
In this section, Mingo will talk about system application development from its own perspective, how to enter the Framework, learn, and master more core technologies.
Here some people will say, I do application wind fresh water, but also proficiently, not worse than you do system Framework, why the system application development of worthless. Here’s the thing. I don’t think it’s meant to be. Your app is doing well and making a lot of money. For example, its performance, its interface is gorgeous, the theme is changing. Or it has intelligent recognition, and so on. These are called differentiation product, have its bright spot, characteristic, ability Deus out of encircling.
As for the system application development, I prefer the OEM manufacturers in the development of the whole mobile phone, mainly making the system, which can ensure the normal function without spending a lot of manpower and energy to do the application in-depth development and system reconstruction. Here, we mainly pursue speed and simultaneously meet the hardware requirements of customers, such as multiple Hall devices, multiple temperature sensors, multiple holster functions, etc., but rarely change the application architecture in large quantities, so as not to affect the final mass production.
Above, is specifically refers to this application developer. Then, what does the Framework need to know?
① Operating system.
Those who are familiar with me know that I particularly like to put this in the first place, for the simple reason that it does support all my subsequent knowledge base, allowing me to take my time and dismantle systems one by one.
Let’s take Android for example, the startup process
Android startup process framework
It’s very similar to Linux, so it’s easy to migrate, and at the same time, a differentiated init process, to do the initial task, to create an incubator in the Android world, and since this is going into the Android world, and the basic language of the Android world is Java, you need a Java virtual machine, so the incubator is going to build a virtual machine, Used to parse the byte stream that executes Java compilation. The incubator itself is implemented by C CPP language, so the Java virtual machine is written by C CPP language, Linux operating system is written by C (and some assembly), so the Java language running the Java virtual machine needs to deal with C CPP, so there is JNI.
Incubators do several things:
1 Create the Java VM
2 Connect JNI to Java and C
3 Load the common shared library
4 Wait for someone to send a message to it and create a new process
In the meantime, one thing the incubator does is create system_server. What does this process do? When we create a Virtual machine that can run Java, we need to provide a bunch of system interfaces to assist application development, such as network request, such as interface creation, such as location, memory card acquisition, and so on, so as to facilitate user development functions. A platform is often judged by how powerful it is, how well it has technical documentation, and how well it develops debugging tools.
So there’s a bunch of threads like AMS, WMS, PMS, BT, WIFI, all of which can be found in /proc/{system_server_pid}/ tast.
With these threads, we can easily implement many functions. At this time we need the supporting development tools, such AS AS editor, can edit, compile APK, installed to the mobile phone to run.
About the operating system, you need to know the following:
1 process, thread concept
2 mutual exclusion, deadlock mechanism and principle, how to avoid deadlock
3 Memory management mechanism, virtual memory
The difference between static library and dynamic library
5 Memory barriers between processes, how to communicate (IPC)
Communication advantages of Binder
I want to keep that in mind, but it’s not about understanding all the mechanics, it’s about understanding the whole thing. Please think about the following questions and see if you can answer them.
1 If I write an application called com.codegg. Home and load a layout, layout_main. XML, inside the main activity that writes a TextView, then I want to debug that TextView, Do YOU want to break in com.codegg. Home or system_server? If you want to debug ActivityThread.java? Which process should I break on?
Com.codegg. Home breakpoints com.codegg. Home breakpoints com.codegg. Home breakpoints com.codegg. Home breakpoints com.codegg.
So let’s think about it a little bit more, now I’m going to go after the start of the application, the start Activity, where do I want to break?
We know that the core of the process is in the Activity Manager Server, and it is in the System Server process, as a thread, so we need to debug, we need to set a breakpoint on the System Server.
If you don’t have any questions, congratulations, processes and threads, you’ve got the idea.
———— to be continued ———-