[First written by Steve Guo, please keep the mark if forwarding.] The original URL from :http://letsgoustc.spaces.live.com/blog/cns!89AD27DFB5E249BA!470.entry

Here is the overall picture.

There are two processes in the scenario. Mountd is a native application which does the real mount work. While MountService in system_server application is a JAVA layer service, it communicates with mountd through “/dev/socket/mountd” local UNIX domain socket.

Mountd first creates mount point list parsed from “/system/etc/mountd.conf” configuration file. Then it tries to mount devices defined in the configuration file. It opens another thread for automatically monitor inotify event for “/dev/block/” directory and uevent for USB mass storage. This thread is for monitor SD card and USB is plugged in or not. Finally in the main thread, mountd will listen on the ANDROID_SOCKET_mountd local UNIX domain socket to receive commands from MountService and send events to MountService.

The uevent for USB is observed if it contains these two strings: “POWER_SUPPLY_TYPE=USB”, “POWER_SUPPLY_ONLINE=”+[“1” | “0”].

The commands and events between MountService and mountd are all plain texts. It’s easy to understand.

MountService will broadcast the following intents for any interested clients if it receives any event from mountd:

ACTION_UMS_CONNECTED,

ACTION_UMS_DISCONNECTED,

ACTION_MEDIA_REMOVED,

ACTION_MEDIA_UNMOUNTED,

ACTION_MEDIA_MOUNTED,

ACTION_MEDIA_SHARED,

ACTION_MEDIA_BAD_REMOVAL,

ACTION_MEDIA_UNMOUNTABLE,

ACTION_MEDIA_EJECT.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 【30篇突击 android】源码统计二
  2. Android资料
  3. mono for android 读取网络远程图片
  4. Android异步消息框架
  5. ubuntu eclipse android搭建
  6. Frame Animation帧播放动画
  7. Android学习网站
  8. Android访问WCF服务
  9. Android布局属性
  10. Android(安卓)HttpClient网络通信