Why learn Android Framework
To be an excellent Android developer, you need a complete knowledge system . Here, let us grow together to be what we think~.
How important is the knowledge of Android Framework and it is widely used in various fields. Like frame drop monitoring, function instrumentation, slow function detection, ANR monitoring, and startup monitoring, you need to have a deeper understanding of the framework to know how to monitor, what mechanism to use to monitor, where to insert the function instrumentation, and reflection Which class, method, and attribute should be reflected...
In addition, Framework, as the Android framework layer, provides many APIs for App to call, but many mechanisms are packaged by Framework for use by App. If you don't know the principles of these mechanisms, it is difficult to optimize on this basis.
For example, if you understand the startup mechanism of Android App, you will be more comfortable when optimizing the startup speed: what kind of StartingWindow to customize; when can you get the width and height of the picture; how to do DelayLoad is more appropriate; when does the service start It does not affect the startup speed; is it really visible when Activity onResume is called back? Why does Redex speed up application startup?
Another example is the Handler, MessageQueue, Looper we often say. Looking at the source code, you can better understand those concepts: What does ThreadLocal do; the relationship between Thread and Handler; why can't you update the UI in the child thread?
There are still many chestnuts, so I won’t discuss the importance of learning Android Framework one by one.
How to learn Android Framework
Since Framework is so important, how should we learn?
Regarding how to learn the knowledge of Android Framework development, I recently had the honor to pick up this Android framework advanced development note in the hands of the director of Bytedance. Some of the knowledge chapters were published on Zhihu and even 1000+ likes. I will share it with you today everyone.
This note mainly explains the main modules of Framework:
Chapter 1: In-depth analysis of Binder
Binder mechanism as a means of inter-process communication, basically runs through all the andorid framework layers. So we must first understand the basic communication mechanism of Android Binder.
Knowledge points in this chapter
- Binder series-opening
- Initial exploration of Binder Driver
- Binder Driver Revisited
- Binder starts ServiceManager
- Get ServiceManager
- Registration Service (addService)
- Get Service (getService)
- Framework layer analysis
- How to use Binder
- How to use AIDL
- Binder summary
- Binder interview questions full analysis
Chapter 2: In-depth analysis of Handler. I
believe everyone has this feeling: There are so many articles analyzing the principle of Handler mechanism on the Internet, so why do you have to superfluously organize this note? It's not that the articles written by the former people are not good, I just think that their writing is not detailed, some points are not clear, and the logic is difficult to smooth. Every time I learn something, it is uncomfortable to encounter this situation.
This chapter starts with macro-theoretical analysis and Message source code analysis, then to MessageQueue source code analysis, Looper source code analysis, handler source code analysis, and Handler mechanism implementation principle summary. Finally, I also sorted out all the Handler interview questions.
The Handler chapter is very long, but the idea is gradual. If you can persist in reading it, I am sure you will not be disappointed.
Chapter 3: Dalvik VM Process System
Andorid system startup, init process, Zygote, SystemServer startup process, application creation and use, Activity creation, destruction Handler and Looper.
Chapter 4 In-depth analysis of WMS
The working principle of the window management frame system animation frame View.
The fifth piece PackagerManagerService
Package management services. Resource management related classes
Due to space reasons, this pure handwritten note has been sorted into a PDF document. If you need a complete document of AndroidFramework development notes, please like + comment [1] to get the information for free!
This article has been included in the open source project: https://github.com/Android-Alvin/Android-LearningNotes , which contains self-learning programming routes in different directions, a collection of interview questions/faces, and a series of technical articles, etc. The resources are continuously being updated …