源码分析之——AMS之应用启动流程

1.源码分析之——AMS之应用启动流程
2.源码分析之——WMS启动流程
3.源码分析之——SharedPreferences
4.源码分析之——Retrofit
5.源码分析之——OKHttp
6.源码分析之——Android事件分发机制

前言

熟悉Activity的启动流程和运行原理是一个合格的Android应用开发人员所应该具备的基本素质,下面在Android10.0 aosp基础上进行梳理。
谨以此记录下学习流程,欢迎广大博友交流指正。是时候提高一波了。。。

code

AOSP版本&时间

代码下载

基于Ubantu16.04,国内使用清华mirror下载,如下:
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar # 解压
cd AOSP # 解压得到的 AOSP 工程目录
repo sync # 正常同步一遍即可得到完整目录

代码阅读器

推荐 IntelliJ IDEA

相关类简介

1.Launcher

Default launcher application.

2.BaseDraggingActivity

Extension of BaseActivity allowing support for drag-n-drop.

3.Instrumentation

Base class for implementing application instrumentation code. When running with instrumentation turned on, this class will be instantiated for you before any of the application code, allowing you to monitor all of the interaction the system has with the application. An Instrumentation implementation is described to the system through an AndroidManifest.xml’s <instrumentation> tag.

4.ActivityTaskManagerService

System service for managing activities and their containers (task, stacks, displays,… ).

5.ActivityStarter

Controller for interpreting how and then launching an activity.

6.RootActivityContainer

This class is mostly temporary to separate things out of ActivityStackSupervisor.java. The intention is to have this merged with RootWindowContainer.java as part of unifying the hierarchy.

7.ActivityStack

State and management of a single stack of activities.

8.ActivityStackSupervisor

This class has become a dumping ground. Let’s
Move things relating to the hierarchy to RootWindowContainer
Move things relating to activity life cycles to maybe a new class called ActivityLifeCycler
Move interface things to ActivityTaskManagerService.
All other little things to other files.

9.ProcessList

Activity manager code dealing with processes.

10.ZygoteProcess

Maintains communication state with the zygote processes. This class is responsible for the sockets opened to the zygotes and for starting processes on behalf of the {@link android.os.Process} class.

11.LocalSocket

Creates a (non-server) socket in the UNIX-domain namespace. The interface here is not entirely unlike that of java.net.Socket. This class and the streams returned from it may be used from multiple threads.

12.ActivityThread

This manages the execution of the main thread in an application process, scheduling and executing activities, broadcasts, and other operations on it as the activity manager requests.

13.LaunchActivityItem

Request to launch an activity.

启动流程

1.从桌面点击应用图标到Activity所在进程启动

在这里插入图片描述

2.Activity启动

在这里插入图片描述
至此我们看到了熟悉的Activity的onCreate(),下面将执行Activity的生命周期方法。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值