当前位置:主页 > 查看内容

android文件管理器不显示u盘内容

发布时间:2021-04-30 00:00| 位朋友查看

简介:From source codes,Vold sets the device as adoptable or not based on the flag ( encryptable/forceencrypt ) as shownbelow.231 if ( fs_mgr_is_encryptable ( fstab- recs [ i ] )) { 232 flags | android::vold::Disk::Flags::kAdoptable ; 233 has_ad……
From source codes,
Vold sets the device as adoptable or not based on the flag(encryptable/forceencrypt) as shown
below.
231 if (fs_mgr_is_encryptable(&fstab->recs[i])) {
232 flags |= android::vold::Disk::Flags::kAdoptable;
233 has_adoptable = true;
234 }
Which is further passed to Mountservice, which marks only the adoptable volumes as Visible
devices.
1285 } else if (vol.type == VolumeInfo.TYPE_PUBLIC) {
1286 // TODO: only look at first public partition
1287 if (Objects.equals(StorageManager.UUID_PRIMARY_PHYSICAL, mPrimaryStorageUuid)
1288 && vol.disk.isDefaultPrimary()) {
1289 Slog.v(TAG, "Found primary storage at " + vol);
1290 vol.mountFlags |= VolumeInfo.MOUNT_FLAG_PRIMARY;
1291 vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
1292 }
1293
1294 // Adoptable public disks are visible to apps, since they meet
1295 // public API requirement of being in a stable location.
1296 if (vol.disk.isAdoptable()) {
1297 vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
1298 }
Non adoptable volumes are NOT exposed to apps.
And hence, in vold, while Mounting(), the app-exposed-mountpoint -> /storage/<ID> is not mounted
for invisible devices.
120 if (getMountFlags() & MountFlags::kVisible) {
121 setPath(StringPrintf("/storage/%s", stableName.c_str()));
122 } else {
Settings is a privileged Platform app, shared system uid, so it can call frameworks APIs directly,
which can't be done by CMFilemanager(which is just system app)


[解决方案]
If we want to see the the non-adoptable volumes (like UDisk and Pen-driver via OTG) in
FileManager app, we can modify MountService.java as below , then have a try.
1294 // Adoptable public disks are visible to apps, since they meet
1295 // public API requirement of being in a stable location
- if (vol.disk.isAdoptable()) {
+ if (vol.disk.isAdoptable() || vol.disk.isUsb()) {
1297 vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
1298 }
;原文链接:https://blog.csdn.net/sdrgtywretyeruet/article/details/115438372
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐