Skip to content
 
 

Repository files navigation

For a better reading experience, this article has been migrated to ahaoframework.tech

1. Why learn Android Framework?

As an app-layer App development engineer, why should we learn Android Framework? The answer is simple: so we don't get left behind! In 2023, it seems you can't even find a job without knowing Binder WMS AMS PMS, and to make things worse, companies even expect you to know cross-platform technologies like RN Flutter, and it would be even better if you also picked up some front-end skills — a textbook case of over-engineering the interview process! For 99% of App development on the market, mastering Framework isn't actually required; companies ask about these topics purely to filter candidates, because they receive far too many resumes, and conventional questions can no longer effectively screen applicants.

For Android application development engineers who want to stay in this industry long-term, there are broadly two relatively reliable advancement paths to choose from:

  • The generalist front-end path: mastering native development for both Android and iOS, cross-platform development, and front-end development
  • The systems development path: mastering Linux systems development technology, becoming familiar with the principles of core Framework-layer components, and understanding the Linux kernel

The generalist front-end path largely emerged because companies aren't making as much money anymore, can't afford to hire as many people, and want one person to do the work of several — this type of position is all about cost-effectiveness.

It has to be admitted that the golden age of mobile internet has passed, and opportunities to develop large-scale Apps have almost disappeared, replaced mostly by quick, small projects. For these quick small projects, developers with 5+ years of experience have very little advantage, and from a company's perspective this can even be a drawback. Why? Senior developers command higher salaries, are less willing to work overtime, and won't buy into the "big picture" pitches bosses like to sell... By comparison, newcomers with 2-3 years of experience are more welcome — they're cheaper, more driven, and willing to work overtime. The most fatal issue is that App development — whether native, front-end, or cross-platform — changes extremely fast. Senior developers usually have families to take care of and limited energy, and their learning pace often can't keep up with newcomers. All of this together has given rise to the "age 35 problem"!

The core reason the age-35 problem exists is that the experience you've accumulated doesn't form a barrier to entry for newcomers. Simply put, your job doesn't reward experience!

Android systems development covers a very broad range of knowledge, involves a huge amount of code, has high complexity, and relevant learning materials are also quite scarce. Newcomers face a fairly high barrier to entry, which invisibly forms a moat around these positions.

From the release of Android 1.0 in 2008 to today, Android has gone through many version iterations, but the core foundational components have never changed dramatically (for example Binder, the four major app-layer components, Handler, etc.), which means the experience accumulated in systems development can build up and form a real barrier.

After all this talk, it boils down to one sentence — Framework is worth the time and effort for app developers to learn

Below is a learning roadmap for the core fundamentals of Android Framework:

A clear version of the learning roadmap can be downloaded from Link: https://pan.baidu.com/s/1F0Ibi8pHcYT39HASy3zvNw Extraction code: 1234.

The learning roadmap is divided into 11 topics in total. Let's take a look at what each of these 11 topics covers next.

2. Basics

Reading and learning system source code is a bit like an elementary school student reading books and newspapers. By around third grade, a student knows roughly one to two thousand characters, and with the help of a pinyin dictionary, can already read a lot of extracurricular books.

The fundamentals cover a very broad range of topics, so we should be prepared for long-term learning, take good notes along the way, and review and reinforce our memory regularly. In addition, we should learn the system source code and the fundamentals side by side — when we encounter something we don't understand, we should go back and review the fundamentals, forming a closed loop from knowledge to application. Never finish learning all the fundamentals first and only then move on to the system source code — that approach is inefficient and produces poor results.

For the fundamentals section, we mainly need to master the following content:

  • Basic use of Linux: recommended reading, "The Way of Linux Operations, 2nd Edition"

  • Programming languages

    • C language: "One-Stop Learning C Programming", "The Tao of C Language", "Self-Cultivation in Embedded C Language"

    • C++: "Learn C++ in 21 Days"

    • Java: "Core Java"

    • JNI: there's no particularly suitable book to recommend for this — follow my blog and public account, where I'll share some of my study notes later on.

  • Scripting languages and software build tools — the main purpose of learning this material is to understand Android's build system and to be able to write automation scripts in daily work to improve efficiency

    • Makefile: there's no particularly recommended material for this — follow my blog and public account, where I'll share some of my study notes later on.

    • Soong: for this, mainly refer to the source code implementation as well as the official documentation

    • Shell scripting, recommended reading: "Core Guide to Linux Shell Programming"

    • Python, recommended reading: "Python Programming: From Beginner to Practitioner"

    • Go, recommended reading: Go: From Beginner to Practitioner

  • Linux systems programming is a fairly important part

    • Linux Programming Techniques — a MOOC course provided by Xi'an University of Posts and Telecommunications, suitable for beginners

    • "Linux Systems Programming" by Jack-Benny Persson

    • "Advanced Programming in the UNIX Environment" and "The Linux/UNIX System Programming Handbook": these two books can be used as reference dictionaries while programming

  • Getting started with the Linux kernel and operating system fundamentals

    • Operating Systems and the Linux Kernel — a MOOC course provided by Xi'an University of Posts and Telecommunications, suitable for beginners

    • "Understanding the Linux Kernel, 3rd Edition"

    • The "Run, Linux Kernel" book series

    • Getting started with Linux driver development: the video series shared by teacher Wei Dongshan on Bilibili is recommended

Content already shared in the Basics section:

3. AOSP Quick Start Path

This section comes with a free companion video course

The main purpose of this section is to get you hands-on with the Android system source code and build an intuitive understanding of systems development. It mainly covers the following content:

This section has been organized at https://github.com/yuandaimaahao/AOSPTutorial

4. Binder

Binder is a Remote Procedure Call (RPC) programming framework on Linux, and it's the core foundational component of the entire Android system. After experiencing the "joy" of systems development, we need to master the ins and outs of Binder as soon as possible. Planned content includes:

This section has been organized at https://github.com/yuandaimaahao/AndroidBinderTutorial

5. Basic Components

So-called "basic components" refers to the modules that are used extensively throughout the system source code. The content we need to learn mainly includes:

  • Smart pointers in the Android source code

  • Usage and analysis of the Android property system

  • Usage and analysis of the Android logging system

  • Permission management in Android

  • Android anonymous shared memory

  • Basic components interview questions explained

6. HAL and Hardware Services

HAL mainly wraps driver functionality — it sits below the drivers and above the Framework. It mainly covers the following content:

7. Build System

Sometimes we may need to modify the behavior of the build system, which requires a basic understanding of the AOSP build system. Here is the suggested learning order for the build system:

  • Evolution of the AOSP Build System

  • Build System Initialization

  • Compilation Process Explained

  • Packaging Process Explained

  • Build System Interview Questions Explained

8. App Framework

The App Framework is the component that app developers interact with most frequently. It mainly covers the following aspects:

  • AMS/ATMS and the four major components

    • Activity startup process and process startup

    • Service startup

    • ContentProvider implementation principles

    • Broadcast mechanism

  • Handler and Looper message handling mechanism

  • PackageManagerService workflow and principles

  • App Framework interview questions explained

9. System Boot Process

System boot is a part we deal with often. Its process is shown in the diagram below:

Image from here

Main topics to become familiar with:

  • Overall system boot process

  • init process analysis

  • Zygote process analysis

  • SystemServer process analysis

  • System boot process interview questions explained

10. Android Graphics System

The Android graphics system is a very important subsystem within the system framework. We'll learn and understand the overall graphics system framework from the following aspects:

  • Overall graphics system framework

  • HAL layer principles analysis

  • SurfaceFlinger implementation and analysis

  • WMS implementation and analysis

  • Android View system analysis

  • VSync principles explained

  • Android graphics system interview questions explained

11. Android Input System

The input system is mainly divided into the input subsystem and IMS. We'll learn Android's input system from the following angles:

  • Overall input system framework

  • Reading events

  • Dispatching events

  • Handling events

  • Android input system interview questions explained

12. System Apps

Most of systems development work involves developing system apps. Commonly modified system apps include:

  • Settings

  • Launcher

  • SystemUI

  • System app development interview questions explained

Summary

Once you've mastered these 11 topics, whether you go on to study other Framework modules, take part in App development, or dive into the kernel and drivers, I'm confident you'll already be well equipped to handle it with ease!

About

If you're interested in Framework or are currently learning it, feel free to follow my WeChat public account, where I'll continue sharing my experience to help you avoid some detours while learning. If you have questions during your studies, or experience of your own you'd like to share with everyone, feel free to add me on WeChat and I'll add you to our technical discussion group.

About

写给应用开发的 Android Framework 教程

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages