Android6.0Framework source code analysis series [Contents]

It makes me feel a little powerless to see that my predecessors reached the heights that I am far from now a long time ago. It is also the pits they traversed that can guide me on the way I am about to move forward. So I am very happy. I'm glad I have someone to guide me, I'm glad I'm moving forward.

In the spirit of learning from Daniel and knowing why, prepare a purposeful and systematic Read The Fucking Source Code. Not only as my own notes, but also hope to help some latecomers.

This is an already read framework source directory in Anroid 6.0. In the early stage, there will be an orderly and purposeful reading of the source code. The next one will be more or less related to the previous one. It is recommended to read it first. The follow-up should form a series. Although it will be difficult, I hope I can persevere. Framework, here I come.

2017.09.01 update

From July last year to May this year, most of the spare time for half a year was mainly focused on reading the framework source code. Let’s talk about how you feel about the past half a year.

In practical terms, unfortunately, the improvement is small. If I spend the same energy on the application layer, I can basically make a small qualitative leap in half a year. But I didn't, and I don't regret it.

From a theoretical basis, the improvement is huge! This is the reason why I have no regrets. In the past six months, I have only published ten framework blog posts. With some unpublished ones, at most 20 articles can be summed up. But these twenty blog posts are gradually strung together into a line from dots one by one. From booting, to launching the application, and finally rendering the interface. Slowly put these fragmented dots together. If you want to merge into one face, you also need to understand the individual components in depth. This is also what I am working towards. Another important point is that after insisting on reading some obscure source code for half a year, there is basically no problem with some third-party frameworks, and it is much smoother than before. The last point, and the most important point, should be to exercise the ability to solve problems from the perspective of source code. The feeling of integration is so cool! In fact, the sense of integration is rare, but I still enjoy it.

Next, I should still look at some fw-related code from time to time, but it should be rarely published in blog posts. It's a pity that this series of blogs will have to stop for at least a while. I want to learn C/C++. It's not clear where it's used after learning it, but I know whether it's on Android LIBRARIES, JNI, or something else. It must be useful.

Android Zygote startup process source code analysis

Based on the 6.0 source code, this article mainly analyzes the startup process of the Zygote process. The Zygote process is the pioneer of the Android and Java worlds. In the Android system, all application processes and SystemServer processes are fork from the Zygote process. Its importance is evident from this.

Android SystemServer startup process source code analysis

The Zygote process is started by the init process, and the SystemServer process and the application process are started by the Zygote process. Based on the 6.0 source code, this article mainly analyzes the startup process of the SystemServer process. The role of the SystemServer process is to start various core services, such as Installer, ActivityManagerService, WindowManagerService, PowerManagerService, and so on.

Android Launcher startup application process source code analysis

  1. What does it do after clicking the Launcher icon on the desktop?
  2. When was the application created?
  3. When is the onCreate() method of Application and MainActivity called?

This article is based on the Android6.0 source code, from clicking the Launcher icon until it is resolved that MainActivity#OnCreate() is called.

Android setContentView() source code analysis

In Activity, the first sentence is to call setContentView(R.layout.XXX), but what kind of work does the system do? We know that after the ClassLoader loads the MainActivity, the Application is first created, and then the onAttach and onCreate() methods of the Application object are called in turn. Then call the onAttach and onCreate() methods of the first Activity sequentially.

Android XML layout file parsing process source code parsing

PhoneWindow#setContentView() is called in Activity#setContentView(). And in PhoneWindow#setContentView() there is such a sentence mLayoutInflater.inflate(layoutResID, mContentParent). The role of this line of code is to fill our activity_main.xml into mContentParent. See: source code analysis of setContentView. When writing adapters, mInflater.inflate(layoutResID, null) is often written. So, how does this line of code convert the xml file into a View or ViewGroup?

Android advanced custom Toast and source code analysis

Details you don't know about Toast

Android Activity startup process source code analysis

When are the various methods of the Activity called? The simplest and most detailed Activity startup process source code analysis in history

Android uses WindowManager to implement floating window and source code analysis

Extreme simplicity is often an illusion of cumbersomeness.

Android takes you to fully parse AsyncTask from the perspective of source code

Would you really use AsyncTask?

The past and present of Android's top-level view DecorView

Custom View must-see top-level view DecorView

Android Volley core source code analysis

1. It is especially suitable for network operations with small amount of data and frequent communication.
2. Strong expansibility. Most of Volley's design is based on interface, which is highly configurable.
3. Comply with the Http specification to a certain extent, including the processing of returning ResponseCode (2xx, 3xx, 4xx, 5xx), the processing of request headers, the support of caching mechanism, etc. And supports retry and priority definition.
4. The default Android 2.3 and above is based on HttpURLConnection, and below 2.3 is based on HttpClient.
5. Provide a convenient image loading tool. In short, Volley is very cool!

ThreadLocal source code analysis

ThreadLocal is not a concrete thread. It is a data storage class inside a thread, through which data can be stored in the specified thread. After the data is stored, the stored data can only be obtained in the specified thread, and the data cannot be obtained for other threads.

Handler, Message, MessageQueue, Looper calling process source code analysis

Analysis of Android asynchronous message mechanism. How is the message delivered? How is asynchrony achieved? Before reading this article, it is recommended that readers who do not know much about ThreadLocal first understand the next article "ThreadLocal Source Code Analysis", which will be covered later.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325568784&siteId=291194637