Skip to content

ActivityRecord ​

一个虚拟 Activity 实例的记录,对应 AOSP 的 ActivityRecord。当目标 App 的 Activity 启动时,server 创建此记录追踪它的状态。

关键字段 ​

从源码提取的真实字段:

字段类型含义
taskTaskRecord所属任务
componentComponentNameActivity 组件名
callerComponentName调用方组件
tokenIBinderActivity 唯一标识(与客户端一致)
userIdint虚拟用户 ID
processProcessRecord所在进程
launchModeint启动模式
flagsint标志位
markedboolean标记位(清理用)
affinityString任务亲和性

构造参数顺序:(task, component, caller, token, userId, process, launchMode, flags, affinity)。注意没有 Intent 字段——Activity 的目标信息由 component 承载。

用途 ​

ActivityStack.onActivityCreated 收到客户端上报后构造 ActivityRecord,后续 startActivity 查它判断"目标 Activity 所在进程是否已起"、finishActivity 据它清理栈。

Activity 记录生命周期 ​

基于 VirtualApp 与 epic,仅供学习研究。VirtualApp 禁止商用。