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盘
发布评论