ActivityManagerService boot up sequence analysis

ActivityManagerService (AMS) 是android系统中最核心的服务,主要负责四大组件的启动,切换,调度及应用程序的管理和调度等工作,其职责与操作系统中的进程管理和调度模块类似。

以system server中ActivityManagerService的调用轨迹分为以下四个部分:

Part 1: AMS.main

Part 2: AMS.setSystemProcess

Part 3: AMS.installSystemProviders

Part 4: AMS.self().systemReady

启动流程介绍 1

次图片转载自网络,特别说明

启动流程介绍2

Part 1: AMS Main Function

1. 创建了 AMS对象

2. 创建一个ActivityThread 对象,它代表一个应用进程的

主线程

3. 获得一个context对象,它对应的application环境与

framework-res.apk有关;

通过此函数,为system_server 进程搭建了一个和应用进程一样的android运行环境

Part 1-1:Create AMS object

Part 1-2:Create ActivityThread & context

Part 1-2:Create ActivityThread & Context

Part 1-2:Create ActivityThread & Context

Part 1-3:Create ActivityStack

Part 2:setSystemProcess

1. 将ActivityManagerService, meminfo,gfxinfo等以下服务注册到ServiceManager

ServiceManager.addService("activity", m, true);

ServiceManager.addService("meminfo", new MemBinder(m));

ServiceManager.addService("gfxinfo", new GraphicsBinder(m));

ServiceManager.addService("dbinfo", new DbBinder(m));

ServiceManager.addService("cpuinfo", new CpuBinder(m));

ServiceManager.addService("permission", new PermissionController(m));

2.   通过PKMS 查询关于 framework-res.apk的ApplicationInfo,并用此初始化anroid运行环境

//向PKMS查询package名字为“android”的ApplicationInfo。PKMS 与AMS同一个进程,

但通过android运行环境context(AMS->binder->PKMS)来实现,

保证接口统一性及可扩展性

ApplicationInfo info = mSelf.mContext.getPackageManager().getApplicationInfo(

"android", STOCK_PM_FLAGS);

//对context进行二次初始化,与得到的applicatoninfo进行绑定。

mSystemThread.installSystemApplicationInfo(info);

3.  创建代表 system_server进程的管理结构ProcessRecord,并将systemserver进程并入

AMS管理

ProcessRecord app = mSelf.newProcessRecordLocked(

mSystemThread.getApplicationThread(), info,

info.processName, false); 创建processrecord,包含电量统计,应用信息,

进程名(system),oom_adj,IApplicationThread和应用进程通信等信息。

app.persistent = true;(常驻进程)

app.pid = MY_PID;  system_server的进程号

app.maxAdj = ProcessList.SYSTEM_ADJ;(-16)最高优先级

AMS中用于保存管理 processRecord的两个成员变量结构。

mSelf.mProcessNames.put(app.processName, app.uid, app);

mSelf.mPidsSelfLocked.put(app.pid, app);

根据系统当前状态,调整进程调度优先级和OOM_ADJ.

mSelf.updateLruProcessLocked(app, true);

Part 3:installSystemProviders

SettingsProvider.apk 包含SettingsProvider,放在system_serever中运行方便为各个service提供配置信息查询

1 android程序中,一般创建的数据库存放在 /data/data/[应用程序包名]/databases

的目录下

2. 通过URI 进行操作,例如content://contacts/people/1  指定ID为1 联系人的数据

3. 相关操作涉及 query, insert,update ,delete 等操作

时间: 2024-10-25 01:22:29

ActivityManagerService boot up sequence analysis的相关文章

SGU 455 Sequence analysis(Cycle detection,floyd判圈算法)

题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=455 Due to the slow 'mod' and 'div' operations with int64 type, all Delphi solutions for the problem 455 (Sequence analysis) run much slower than the same code written in C++ or Java. We do not gua

sgu 455. Sequence analysis (floyd 判圈算法,O(1)空间复杂度求循环节)

455. Sequence analysis Time limit per test: 1 second(s)Memory limit: 4096 kilobytes input: standardoutput: standard Due to the slow 'mod' and 'div' operations with int64 type, all Delphi solutions for the problem 455 (Sequence analysis) run much slow

MEME(Motif-based sequence analysis tools)使用说明

MEME(Motif-based sequence analysis tools)使用说明 2011-05-27 ~ ADMIN MEME是用于从一堆序列中搜索功能结构域的工具.比如说当你拿到了许多CHIP-chip或者CHIP-seq的数据,当分析出峰所处的位置之后可以得到一些这些峰所代表的序列,这就是蛋白质与DNA相到作用所保护下来的片段.所以使用MEME搜索其中非常相似的序列片段就可能是有一定功能的结构域. 所以,MEME的输入必须至少有一个Pearson/FASTA格式的序列文件. 命令

数据挖掘算法Analysis Services-基于SQL Server的数据挖掘

数据挖掘算法(Analysis Services – 数据挖掘) data mining algorithm is a set of heuristics and calculations that creates a data mining model from data.” xml:space=”preserve”>“数据挖掘算法”是根据数据创建数据挖掘模型的一组试探法和计算. 为了创建模型,算法将首先分析您提供的数据,并查找特定类型的模式和趋势. 算法使用此分析的结果来定义用于创建挖掘模型

Sequence Models

Sequence Models This is the fifth and final course of the deep learning specialization at Coursera which is moderated by deeplearning.ai Here are the course summary as its given on the course link: This course will teach you how to build models for n

[C7] Andrew Ng - Sequence Models

About this Course This course will teach you how to build models for natural language, audio, and other sequence data. Thanks to deep learning, sequence algorithms are working far better than just two years ago, and this is enabling numerous exciting

Linux -- crontab

*manpages*File: *manpages*,  Node: crontab,  Up: (dir) CRONTAB(1)                  General Commands Manual                 CRONTAB(1) NAME       crontab - maintain crontab files for individual users (Vixie Cron) SYNOPSIS       crontab [ -u user ] fil

[14.05.12]今后讨论班的走向

今后讨论班的一些走向 谨记之...... 上周末决定,今后讨论班将针对CVPR 2014和SIAM Conference on IMAGING SCIENCE(2014) 进行进一步的挖掘.上级给我们刚刚布置了SIAM会议的日程.内容安排,看完之后,顿觉亚历山大啊......会是好会,会址更是博主心仪之地.虽不能至,心向往之...... http://www.math.hkbu.edu.hk/SIAM-IS14/ 会议介绍里面有个词用的很好:from nano-scale to the astr

Machine and Deep Learning with Python

Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstitions cheat sheet Introduction to Deep Learning with Python How to implement a neural network How to build and run your first deep learning network Neur