OSDN Git Service

Merge changes I2c1d4b42,I06fe4d33
authorMartijn Coenen <maco@google.com>
Tue, 7 Jan 2020 10:28:14 +0000 (10:28 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 7 Jan 2020 10:28:14 +0000 (10:28 +0000)
* changes:
  Conditionally use sdcardfs.
  Also delay creating found disks until user 0 is started.

1  2 
Utils.cpp
VolumeManager.cpp

diff --cc Utils.cpp
+++ b/Utils.cpp
@@@ -1017,17 -1017,8 +1017,14 @@@ status_t MountUserFuse(userid_t user_id
      std::string pass_through_path(
              StringPrintf("%s/%s", pre_pass_through_path.c_str(), relative_upper_path.c_str()));
  
-     std::string sdcardfs_path(
-             StringPrintf("/mnt/runtime/full/%s", relative_upper_path.c_str()));
      // Create directories.
 -    auto result = PrepareDir(pre_fuse_path, 0700, AID_ROOT, AID_ROOT);
 +    // Shell is neither AID_ROOT nor AID_EVERYBODY. Since it equally needs 'execute' access to
 +    // /mnt/user/0 to 'adb shell ls /sdcard' for instance, we set the uid bit of /mnt/user/0 to
 +    // AID_SHELL. This gives shell access along with apps running as group everybody (user 0 apps)
 +    // These bits should be consistent with what is set in zygote in
 +    // com_android_internal_os_Zygote#MountEmulatedStorage on volume bind mount during app fork
 +    auto result = PrepareDir(pre_fuse_path, 0710, user_id ? AID_ROOT : AID_SHELL,
 +                             multiuser_get_uid(user_id, AID_EVERYBODY));
      if (result != android::OK) {
          PLOG(ERROR) << "Failed to prepare directory " << pre_fuse_path;
          return -1;
Simple merge