android tf卡及u盘

编程入门 行业动态 更新时间:2024-10-24 23:21:39

<a href=https://www.elefans.com/category/jswz/34/1771384.html style=android tf卡及u盘"/>

android tf卡及u盘

问题:rk3288 8.1系统上,第三方app即使动态申请了读写存储的权限依然不能读写U盘或者TF卡,这是因为第三方app对U盘或者TF卡路径是没有读写权限的,如果要能够读写一种方法是修改app为系统app,并且申请"android.permission.WRITE_MEDIA_STORAGE"权限。另外一种方法就是修改系统,让U盘或者TF卡路径有读写权限。

修改U盘或者TF卡路径有读写权限权限如下:

+++ b/frameworks/base/data/etc/platform.xml

@@ -123,8 +123,15 @@

is negligible (one tag with the permission) compared to

the fragility as one can remove a built-in permission which

no longer needs to be mapped to gids and break grant propagation. -->
diff --git a/system/core/sdcard/sdcard.cpp b/system/core/sdcard/sdcard.cpp

old mode 100644

new mode 100755

index 2bbb906…f6fa9e4

— a/system/core/sdcard/sdcard.cpp

+++ b/system/core/sdcard/sdcard.cpp

@@ -391,9 +391,9 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe

if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,

AID_SDCARD_RW, 0006, derive_gid) ||

!sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY,

  • full_write ? 0027 : 0022) ||
  • full_write ? 0027 : 0027) ||

!sdcardfs_setup_bind_remount(dest_path_default, dest_path_write, AID_EVERYBODY,

  • full_write ? 0007 : 0022)) {
  • full_write ? 0007 : 0007)) {

LOG(FATAL) << “failed to sdcardfs_setup”;

}

}

diff --git a/system/vold/PublicVolume.cpp b/system/vold/PublicVolume.cpp

index a0f4ee8…810272c 100755

— a/system/vold/PublicVolume.cpp

+++ b/system/vold/PublicVolume.cpp

@@ -128,7 +128,7 @@ status_t PublicVolume::doMount() {

setPath(mRawPath);

}

  • if (fs_prepare_dir(mRawPath.c_str(), 0700, AID_ROOT, AID_ROOT)) {
  • if (fs_prepare_dir(mRawPath.c_str(), 0777, AID_ROOT, AID_ROOT)) {

PLOG(ERROR) << getId() << " failed to create mount points";

return -errno;

}

@@ -143,7 +143,7 @@ status_t PublicVolume::doMount() {

}

if (vfat::Mount(mDevPath, mRawPath, false, false, false,

  • AID_MEDIA_RW, AID_MEDIA_RW, 0007, true)) {
  • AID_MEDIA_RW, AID_MEDIA_RW, 0001, true)) {

PLOG(ERROR) << getId() << " vfat failed to mount " << mDevPath;

return -EIO;

}

@@ -219,9 +219,9 @@ status_t PublicVolume::doMount() {

return OK;

}

}

  • if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||

  • fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||

  • fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) {

  • if (fs_prepare_dir(mFuseDefault.c_str(), 0777, AID_ROOT, AID_ROOT) ||

  • fs_prepare_dir(mFuseRead.c_str(), 0777, AID_ROOT, AID_ROOT) ||

  • fs_prepare_dir(mFuseWrite.c_str(), 0777, AID_ROOT, AID_ROOT)) {

PLOG(ERROR) << getId() << " failed to create FUSE mount points";

return -errno;

}

更多推荐

android tf卡及u盘

本文发布于:2023-06-27 08:09:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/908571.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:android   tf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!