嵌入式爱好者

嵌入式爱好者 门户 知识库 查看内容

修改安卓源码实现挂载fat32的u盘可以拥有777权限

2024-9-27 10:44| 发布者: L_S_H| 查看: 6| 评论: 0

类目:  >  知识库     文档编号: 1532

可以参考一下几个文件的修改,其中涉及到uamsk码的替换
diff --git a/system/core/sdcard/sdcard.cpp b/system/core/sdcard/sdcard.cpp
index 622de5b..ebc3961 100644
--- a/system/core/sdcard/sdcard.cpp
+++ b/system/core/sdcard/sdcard.cpp
@@ -197,10 +197,10 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
                             AID_SDCARD_RW, 0006, derive_gid, default_normal, unshared_obb,
                             use_esdfs) ||
             !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_read, uid, gid,
-                                      multi_user, userid, AID_EVERYBODY, full_write ? 0027 : 0022,
+                                      multi_user, userid, AID_EVERYBODY, full_write ? 0027 : 0027,
                                       derive_gid, default_normal, unshared_obb, use_esdfs) ||
             !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_write, uid, gid,
-                                      multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0022,
+                                      multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0007,
                                       derive_gid, default_normal, unshared_obb, use_esdfs) ||
             !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_full, uid, gid,
                                       multi_user, userid, AID_EVERYBODY, 0007, derive_gid,
diff --git a/system/vold/model/PublicVolume.cpp b/system/vold/model/PublicVolume.cpp
index a707e08..0394740 100644
--- a/system/vold/model/PublicVolume.cpp
+++ b/system/vold/model/PublicVolume.cpp
@@ -135,20 +135,20 @@ 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;
     }

     if (mFsType == "vfat") {
         if (vfat::Mount(mDevPath, mRawPath, false, false, false, AID_ROOT,
-                        (isVisible ? AID_MEDIA_RW : AID_EXTERNAL_STORAGE),0007, true)) {
+                        (isVisible ? AID_MEDIA_RW : AID_EXTERNAL_STORAGE),0000, true)) {
             PLOG(ERROR) << getId() << " failed to mount " << mDevPath;
             return -EIO;
         }
     } else if (mFsType == "exfat") {
         if (exfat::Mount(mDevPath, mRawPath, AID_ROOT,
-                         (isVisible ? AID_MEDIA_RW : AID_EXTERNAL_STORAGE), 0007)) {
+                         (isVisible ? AID_MEDIA_RW : AID_EXTERNAL_STORAGE), 0000)) {
             PLOG(ERROR) << getId() << " failed to mount " << mDevPath;
             return -EIO;
         }
@@ -164,10 +164,10 @@ status_t PublicVolume::doMount() {
     }

     if (mUseSdcardFs) {
-        if (fs_prepare_dir(mSdcardFsDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
-            fs_prepare_dir(mSdcardFsRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
-            fs_prepare_dir(mSdcardFsWrite.c_str(), 0700, AID_ROOT, AID_ROOT) ||
-            fs_prepare_dir(mSdcardFsFull.c_str(), 0700, AID_ROOT, AID_ROOT)) {
+        if (fs_prepare_dir(mSdcardFsDefault.c_str(), 0777, AID_ROOT, AID_ROOT) ||
+            fs_prepare_dir(mSdcardFsRead.c_str(), 0777, AID_ROOT, AID_ROOT) ||
+            fs_prepare_dir(mSdcardFsWrite.c_str(), 0777, AID_ROOT, AID_ROOT) ||
+            fs_prepare_dir(mSdcardFsFull.c_str(), 0777, AID_ROOT, AID_ROOT)) {
             PLOG(ERROR) << getId() << " failed to create sdcardfs mount points";
                                                                                     

已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-12-24 21:12

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部