For Android development, it is important to understand how important Android's Framework layer is, and the Android Framework fine-tuned kernel analysis.

foreword

How can understanding Android's Framework layer help work? How important is Framework knowledge to Android development?

If you have seen the source code of Tencent Matrix on Github, you will know how important the knowledge of Framework is.

Like dropped frame monitoring, function instrumentation, slow function detection, ANR monitoring, and startup monitoring, you need to have a deep understanding of the Framework in order to know how to monitor, what mechanism to use to monitor, where to insert the function, and reflection. Which class, which method, which property to call the reflection...

In addition, Framework, as the Android framework layer, provides many APIs for App to call, but many mechanisms are packaged by Framework for App to use. If you do not know the principles of these mechanisms, it is difficult to optimize on this basis.

To give a simple example, if you don't know the source code, you probably can't even dream of it. Starting a Service in onCreate or sending a MainHandler message will all be executed after onStart and onResume.

For example, if you understand the startup mechanism of Android App, you will be more handy when optimizing the startup speed:

What kind of StartingWindow to customize;
when can I get the width and height of the picture;
how to do DelayLoad to be more appropriate;
when the Service starts without affecting the startup speed;
is it really visible when the Activity onResume callback is called?
Why does Redex speed up app startup?
Will ContentProvider affect startup speed? Why does it matter?

For example, we often say Handler, MessageQueue, Looper. You can better understand those concepts by looking at the source code:

What does ThreadLocal do;
the relationship between Thread and Handler;
why can't the UI be updated in the child thread?
When does idleHandler run?
Why does the main thread loop but not get stuck?
How do ContentProvider, Broadcast, and Service use Message to monitor ANR?

Another example is Android's process management mechanism:

AMS sets different priorities for Android processes according to certain rules. When the memory is relatively low, high-priority apps are less likely to be killed by the system than low-priority apps! So what rules does AMS follow to set priorities? Does knowing these rules improve the app's survival rate? This can be known by reading the AMS code.

Another example is the mode of Activity startup, you may be proficient in using various modes, but if you learn the management of Activity and process in Framework, you know the management of Activity stack and Task. Then you will use this boot mode more deeply.

As the saying goes, the API is only a part of Android development. The underlying implementation is huge and complex. It is difficult to understand the knowledge points without reading the source code.

Here I would like to share with you a copy of the "Android Framework Development Reveal" compiled by the director of Tencent, which has a total of nearly 200,000 words. Through the analysis of classic Binder, Handler, AMS and other interview questions, you can deepen your understanding of the Android Framework framework layer , and share it here today. for everyone. Scan the QR code below to add Assistant Miss Sister WeChat to get it for free ↓↓↓

"Android Framework Development Revealed"

Chapter 1 Analysis of System Startup Process
Section 1 Overview of Android Startup
Section 2 Analysis of init.rc
Section 3 Zygote
Section 4 Interview Questionspicture

Chapter 2 Binder Analysis
Section 1 Macro Understanding of Binder
Section 2 Binder JNI Method Registration
Section 3 Binder Driver
Section 4 Data Structure
Section 5 Start Service_manager
Section 6 Obtain Service_manager
Section 7 AddService Process
Section 8 Binder Interview Questions Full analysis
picture

Chapter 3 Handler Analysis
Section 1 Source Code Analysis
Section 2 Difficult Problems
Section 3 Handler Frequently Asked Interview Questions
Chapter 4 AMS Analysis
Section 1 Introduction
Section 2 Android Architecture
Section 3 Communication Methods
Section 4 System Startup Series
5 Section AMS
Section 6 AMS Interview Question Analysis
picture

Chapter 5 WMS Analysis
Section 1 Concepts related to Activity and Window
Section 2 Analysis of the process of calculating the size of the Activity window by the
Android window management service WindowManagerService Section 3 Analysis of the organization of the window by the
Android window management service WindowManagerService Section 4 Android window management service WindowManagerService Management Analysis of Input Method Window
Section 5 Management Analysis of Wallpaper Window by Android Window Management Service WindowManagerService...
Chapter 6 PKMS Android10.0 Source Code Interpretation
Section 1 Preface What is PKMS?
Section 2 PKMS Overview Information
Section 3 PKMS Role Location
Section 4 PKMS Startup Process Analysis
Section 5 APK Scanning
Section 7 PMS Permission Scanning
Section 8 PackageManagerService Comprehensive Notespicture

"Android Framework Refinement Kernel Analysis"

This "Android Framework Refinement Kernel Analysis" covers five chapters: in-depth analysis of Binde, in-depth analysis of Handler message mechanism, Dalvik VM process system, in-depth analysis of WMS, and PackageMS startup, with a total of 455 pages.

The information of "Android Framework Development Reveal" and "Android Framework Refinement Kernel Analysis" can be obtained for free, scan the QR code below and add the assistant's WeChat to get it for free↓↓↓

Chapter 1 In-depth analysis of Binder

  • Binder series - opening
  • A Preliminary Study of Binder Driver
  • Binder Driver Revisited
  • Binder starts ServiceManager
  • getServiceManager
  • 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 the Handler message mechanism

  • Macro theoretical analysis and Message source code analysis
  • Source code analysis of MessageQueue
  • Looper source code analysis
  • Source code analysis of handler
  • Handler mechanism implementation principle summary
  • Full analysis of Handler interview questions

Chapter 3 Dalvik VM Process System

  • Android System Boot-Overview
  • Init articles
  • zygote
  • SystemServer Part 1
  • SystemServer Part II

Chapter 4 In-depth analysis of WMS

  • Overview of WMS
  • Birth of WMS

Chapter 5 PackageMS Startup

  • PackageMS related framework classes
  • PackageMS startup process

I believe that these two materials will definitely provide strong help and support for everyone in the framework of learning, and become a real senior Android developer one step faster. All the above contents have been packaged and arranged for free sharing. Scan the QR code below to add the WeChat assistant of Miss Assistant to get it for free ↓↓↓
Please add image description

Guess you like

Origin blog.csdn.net/datian1234/article/details/123204989