android6.0动态申请权限_Android6.0 storage目录sd卡存储的路径创建详解

更新时间:2021-05-31    来源:窗口特效    手机版     字体:

【www.bbyears.com--窗口特效】

之前一直很疑惑,android6.0上sd卡挂载storage下的sd卡路径是什么时候创建的。

因为挂载sd卡的PublicVolume,负责创建mount路径,然后挂载。

接着会创建几个fuse路径,如下:

1./mnt/runtime/default/
2./mnt/runtime/read/
3./mnt/runtime/write/

然后会把这个mount的路径fuse到上面这几个路径。

但是一直没有storage/下sd卡路径的创建,而在PublicVolume下doMount函数也只有设置mPath为storage/....确没有创建这个路径。

后来终于在init.rc中发现下面这句

 代码如下

on post-fs

  start logd

  

  #addforamt

  chmod0755/amt

  # once everything is setup, no need to modify /

  mount rootfs rootfs / ro remount

  # Mount shared so changes propagate into child namespaces

  mount rootfs rootfs / shared rec

  # Mountdefaultstorage into root namespace

  mount none /mnt/runtime/default/storage slave bind rec

它把/mnt/runtime/default mount到storage下了,这样问题就迎刃而解了。

只是为什么要这么做比较奇怪,一般总是会创建目录,或者创建软链接。像这种方式比较少,所以也没往这地方想。导致找了很长时间才发现。

本文来源:http://www.bbyears.com/wangyetexiao/120924.html

热门标签

更多>>

本类排行