Android mountService分析
1存储设备管理框架简介
Vold、MountService、Kernel关系图:
MountService:主要监听Vold和应用发送来的请求,并进行一些业务逻辑处理
Vold:守护进程,主要监听Kernel和MountService发送的请求,一方面负责接受内核发送的关于外部存储设备加载和删除的消息,然后将信息发送给framework层的MountService;另一方面负责执行MountService发送的命令
涉及到的文件主要文件路径如下:
frameworks/base/service/java/com/android/server/SystemServer.java
frameworks/base/service/java/com/android/server/MountService.java
frameworks/base/core/java/android/os/storage/IMountService.java
frameworks/base/core/java/android/os/storage/StorageManager.java
2MountService
2.1SystemServer
MountService作为Android的服务之一,在SystemServer进程启动的第二阶段创建并注册到ServiceManager,同时常驻于SystemServer进程中,MountService的创建和注册过程如下:
if (!disableStorage &&
!“0”.equals(SystemProperties.get(“system_init.startmountservice”))) {
try {
mountService = new MountService(context);
//注册mountService到ServiceManager
ServiceManager.addService(“mount”, mountService);
} catch (Throwable e) {
reportWtf(“starting Mount Servi
本文地址:https://blog.csdn.net/qq_42894864/article/details/104802741