[CloneProfile] Create user mount directory before creating bind mounts.

In aosp/2679182 the capability to add bind mounts for clone user
in public volumes was added.
This allows apps in clone profile to access public volume via lower
fs.
However, sometimes, the user mount directory (/user/mount/<user-id>)
is itself not present, resulting in failures of public volume
bind mounts. This CL addresses this.

Bug: 327293687
Test: Manul build and flash
Change-Id: I0680a518cb14983c6f2e636a38ab6dcd476d7eab
diff --git a/Utils.cpp b/Utils.cpp
index 696b0b4..a3db43e 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1562,15 +1562,9 @@
         return -1;
     }
 
-    // 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
-    result = PrepareDir(pre_fuse_path, 0710, user_id ? AID_ROOT : AID_SHELL,
-                             multiuser_get_uid(user_id, AID_EVERYBODY));
+    result = PrepareMountDirForUser(user_id);
     if (result != android::OK) {
-        PLOG(ERROR) << "Failed to prepare directory " << pre_fuse_path;
+        PLOG(ERROR) << "Failed to create Mount Directory for user " << user_id;
         return -1;
     }
 
@@ -1808,5 +1802,22 @@
     return enabled;
 }
 
+status_t PrepareMountDirForUser(userid_t user_id) {
+    std::string pre_fuse_path(StringPrintf("/mnt/user/%d", user_id));
+    LOG(INFO) << "Creating mount directory " << pre_fuse_path;
+    // 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;
+    }
+    return result;
+}
+
 }  // namespace vold
 }  // namespace android