The source code explanation of the Activity life cycle in the framework of the Android 12.0 system

1 Introduction

In the customized development of the 12.0 system rom, it is also very important to grasp and understand the life cycle of the activity in the framework, so that when starting the activity page of a certain app, you can monitor the process of starting the resume stop, or carry out related function development. Next, analyze the code of the life cycle of the
activity

2. The core class of the source code explanation about the life cycle of Activity in the framework

frameworks/base/core/java/android/app/ActivityThread.java

3. The core function analysis and implementation of the source code explanation of the Activity life cycle in the framework

The status of Activity in Android is extremely important. It is mainly responsible for the display of the software interface. It is the facade of the entire APP and the part that directly interacts with the user. The switch between states and states, the callback of the life cycle occurs between different states, so it is very important to understand the life cycle of the Activity. An important role of the life cycle is to allow the activity to execute the corresponding logic when switching between different states. Next, let’s look at the brief introduction of
ActivityThread
and
ApplicationThread

ActivityThread represents the main thread of Android in Android, but it is not a Thread class. The ActivityThread class is the initial class of the Android process, and
its main function is the entry point of the App process.
When the new process is created, the main function is loaded, and then a loop is executed to make the current thread enter the message loop.

ApplicationThread
ApplicationThread is the inner class of ActivityThread, which is a Binder object.
Here it is server as IApplicationThread object

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/131818670