【笔记】Launcher启动关键类

2020-11-29  本文已影响0人  小瓜子壳

ActivityManagerService
四大组件管理的主要类

ActivityTaskManagerService
Android10引入,对于Activity的管理转移到该类处理,其他组件的管理不变,仍有ActivityManagerService负责

BootActivityContainer
查找符合条件的launcher应用,获得Intent

ActivityStarter

/**
 * Controller for interpreting how and then launching an activity.
 *
 * This class collects all the logic for determining how an intent and flags should be turned into
 * an activity and associated task and stack.
 */

ActivityRecord
Activity服务端(ActivityTaskManagerService)的映射,代表一个Activity

TaskRecord
任务栈,含一个或者多个ActivityRecord

ActivityStack
任务栈的管理类,一个应用可能有多个任务栈,都交由ActivityStack来管理

ActivityStackSupervisor
管理多个ActivityStack

ProcessList
android 10引入,负责创建应用进程,并指定入口类为android.app.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.
 */
public final class ActivityThread extends ClientTransactionHandler {}
// Start the process.  It will either succeed and return a result containing
// the PID of the new process, or else throw a RuntimeException.
 final String entryPoint = "android.app.ActivityThread";

  return startProcessLocked(hostingRecord, entryPoint, app, uid, gids,
                    runtimeFlags, mountExternal, seInfo, requiredAbi, instructionSet, invokeWith,
                    startTime);

ActivityStater
activity启动过程中的各种关键逻辑在这里
比如,判断如何处理任务栈

private int startActivityUnchecked(){

    computeLaunchingTaskFlags();

    computeSourceStack();

}
image.png
上一篇下一篇

猜你喜欢

热点阅读