Android OTG U盘无法显示在系统文件管理的修改

Android OTG U盘无法显示在系统文件管理的修改

文件:frameworks\base\services\core\java\com\android\server\StorageManagerService.java

函数:private void onVolumeCreatedLocked(VolumeInfo vol)

如下修改:

复制代码
    private void onVolumeCreatedLocked(VolumeInfo vol) {
		......

        if (vol.type == VolumeInfo.TYPE_EMULATED) {
        
		......
		
        } else if (vol.type == VolumeInfo.TYPE_PUBLIC) {
			......

            // Adoptable public disks are visible to apps, since they meet
            // public API requirement of being in a stable location.
            /**********************************************************************/
            //if (vol.disk.isAdoptable()) {		//注释掉这个判断
                vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
            //}
            /**********************************************************************/

			......
    }

上面的修改,在U盘mount的时候会起作用:

文件:system/vold/model/PublicVolume.cpp

函数:status_t PublicVolume::doMount()

复制代码
status_t PublicVolume::doMount() {
    // TODO: expand to support mounting other filesystems
    readMetadata();
    ......

    setInternalPath(mRawPath);
    if (getMountFlags() & MountFlags::kVisible) {	//这里有判断,使用storage挂载路径
        setPath(StringPrintf("/storage/%s", stableName.c_str()));
    } else {
        setPath(mRawPath);
    }

	......

    if (!(getMountFlags() & MountFlags::kVisible)) {	//这里也有判断,会继续执行后面的创建用户空间文件系统
        // Not visible to apps, so no need to spin up FUSE
        return OK;
    }

	......
    return OK;
}
相关推荐
网安Ruler1 小时前
代码审计-PHP专题&原生开发&SQL注入&1day分析构造&正则搜索&语句执行监控&功能定位
android
paid槮3 小时前
MySql基础:数据类型
android·mysql·adb
用户2018792831674 小时前
AMS和app通信的小秘密
android
用户2018792831674 小时前
ThreadPoolExecutor之市场雇工的故事
android
诺诺Okami4 小时前
Android Framework-Launcher-InvariantDeviceProfile
android
Antonio9155 小时前
【音视频】Android NDK 与.so库适配
android·音视频
sun00770014 小时前
android ndk编译valgrind
android
AI视觉网奇15 小时前
android studio 断点无效
android·ide·android studio
jiaxi的天空15 小时前
android studio gradle 访问不了
android·ide·android studio
No Silver Bullet16 小时前
android组包时会把从maven私服获取的包下载到本地吗
android