一、现象
复制时提示只读文件。
二、原因
1.错误
- shell@coconut:/mnt/usb $ ls -l
- drwxrwxr-x media_rw media_rw 1970-01-01 08:00 1214-9D53
- drwxrwxr-x media_rw media_rw 1970-01-01 08:00 4256-0C90
shell@coconut:/mnt/usb $ ls -l
drwxrwxr-x media_rw media_rw 1970-01-01 08:00 1214-9D53
drwxrwxr-x media_rw media_rw 1970-01-01 08:00 4256-0C90
2.正确
- 130|shell@coconut:/mnt/usb $ ls -l
- drwxrwxr-x system sdcard_rw 2015-03-26 19:51 1214-9D53
- drwxrwxr-x system sdcard_rw 2015-03-26 19:50 4256-0C90
130|shell@coconut:/mnt/usb $ ls -l
drwxrwxr-x system sdcard_rw 2015-03-26 19:51 1214-9D53
drwxrwxr-x system sdcard_rw 2015-03-26 19:50 4256-0C90
三、问题解决
在挂载参数上做改动
system/vold/Volume.cpp
- int Volume::mountVol() {
- if (isFatFs) {
- if (Fat::doMount(devicePath, getMountpoint(), false, false, false,
- /*AID_MEDIA_RW*/AID_SYSTEM, /*AID_MEDIA_RW*/AID_SDCARD_RW, /*permMask*/0002, true)) { //modify by tank
- SLOGE("%s failed to mount via VFAT (%s)\n", devicePath, strerror(errno));
- isFatFs = false;
- } else {
- isExtFs = false;
- isExfatFs = false;
- }
- }
- }
int Volume::mountVol() {
if (isFatFs) {
if (Fat::doMount(devicePath, getMountpoint(), false, false, false,
/*AID_MEDIA_RW*/AID_SYSTEM, /*AID_MEDIA_RW*/AID_SDCARD_RW, /*permMask*/0002, true)) { //modify by tank
SLOGE("%s failed to mount via VFAT (%s)\n", devicePath, strerror(errno));
isFatFs = false;
} else {
isExtFs = false;
isExfatFs = false;
}
}
}
过滤log方法:logcat -s Vold MountService DirectVolume