preface

These days, I am too busy to learn new things, and I am not able to spare some time to make up for the lessons, so I reread the Framework source code.

Because the Framework source code is too important, like off frame monitoring, function insertion, slow function detection, ANR monitoring, start monitoring, etc., need to have a more in-depth understanding of the Framework, in order to know how to do monitoring, using what mechanism to monitor, where the function plug plug, Reflection calls the reflection which class which method which attribute…

Framework as the Android Framework layer, provides many apis for App to call, but many mechanisms are wrapped by Framework for App to use, if you do not know the principle of these mechanisms, it is difficult to optimize on this basis.

But the Framework source code is huge, but it’s beautifully designed. Vertical layering, horizontal modularization, every minute you want to give up. Later, I was forced to sum up and slowly found a method.

Whether you’re reading a book or a blog, your ultimate goal is “learn to read source code”, not “learn source code”. As for how to read source code, this is not an easy problem, share some experience.

Old driver experience sharing

Pick a small topic that you’re interested in, that you’ve accumulated, and then look at the Android documentation for the design of that topic, and then look at other people’s analysis online. Be sure to use non-Baidu search engines to find English materials.

Second, you need to be familiar with the language features of C++/JAVA. The code in Android is relatively close to the language standards. Android 10/11 has used C++14 features, do not understand the C++14 standard, a lot of Framework code is not easy to understand.

Third, be able to use good analytical tools. Whether it’s an IDE environment that generates cross-references, or a UML tool, be sure to use the tool to document and organize your current understanding. The Android Framework has a team working on each sub-module, which is so complex that it’s impossible for one person to remember all the details. So you have to use tools, and be good with tools.

Finally, analyzing the Android Framework requires patience and persistence to understand what you want. At the beginning of the analysis, there was no door and I was really confused. After a long time, I could feel it.

Why do you have to learn?

It used to be that all you had to know about the four components, views, and web requests was enough to get you a lucrative offer. If you are proficient in Java basics, know how to deal with OOM, component life cycle principle, familiar with Android source code, architecture system, into Alibaba and Tencent may be very easy.

Interviews are getting harder and harder these days! Let alone Ali, toutiao, Tencent and other big factories, even many small and medium-sized companies are asked about the principle of the interview.

In order to help you understand the Framework source code, share with you a highly praised note “Android Framework refined kernel analysis”.

This note explains the main modules of the Framework, from the deployment of the environment to the application of technology, and then to the actual project, so that we can not only learn the use of the Framework technology, but also learn how to use the Framework to solve the actual problem, from simple to deep, detailed analysis of the Framework, so that you can simply and efficiently learn this knowledge!

Chapter 1: In-depth analysis of Binder

Binder mechanisms as a means of interprocess communication permeate almost all of the Andorid framework layer. The basic communication mechanism of Android Binder must be understood first.

Knowledge in this chapter

  • Binder series – Introduction
  • Binder Driver a preliminary
  • Binder Driver revisited
  • Binder start ServiceManager
  • Get ServiceManager
  • Registration Service (addService)
  • GetService (getService)
  • The Framework layer analysis
  • How to use Binder
  • How do I use AIDL
  • Binder to summarize
  • Binder interview questions

Chapter 2: Parsing Handler in depth

This chapter first macro theoretical analysis and Message source code analysis, and then to MessageQueue source code analysis, Looper source code analysis, handler source code analysis, handler mechanism implementation principle summary. Finally, we also sorted out and handled all the interview questions.

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 analyzes WMS in depth

Window management frame system animation frame View working principle.

The fifth chapter PackagerManagerService

Package management services, resource management related classes

Due to space limitation, some screenshots of the content are shown. If you need these documents, you can support me by clicking “like” and then[Click here]Free reading download

The road of Android development is not simple, we have to learn things not only surface technology, but also go deep into the bottom, understand the following principle, only in this way, we can improve their competitiveness, in today’s competitive world, to break through the bottleneck to go longer and farther!