OSDN Git Service

Remove appDirRoot argument from setupAppDir.
authorMartijn Coenen <maco@google.com>
Wed, 12 Feb 2020 14:29:02 +0000 (15:29 +0100)
committerMartijn Coenen <maco@google.com>
Wed, 12 Feb 2020 14:38:45 +0000 (15:38 +0100)
This is no longer needed, because vold can deduce this itself now.

Bug: 146419093
Test: builds
Change-Id: Ib4f4a4109919af683722a63b305b343ef5fe972d

VoldNativeService.cpp
VoldNativeService.h
VolumeManager.cpp
VolumeManager.h
binder/android/os/IVold.aidl

index 3643c74..dbe1d98 100644 (file)
@@ -458,14 +458,12 @@ binder::Status VoldNativeService::remountUid(int32_t uid, int32_t remountMode) {
     return translate(VolumeManager::Instance()->remountUid(uid, remountMode));
 }
 
-binder::Status VoldNativeService::setupAppDir(const std::string& path,
-                                              const std::string& appDirRoot, int32_t appUid) {
+binder::Status VoldNativeService::setupAppDir(const std::string& path, int32_t appUid) {
     ENFORCE_SYSTEM_OR_ROOT;
     CHECK_ARGUMENT_PATH(path);
-    CHECK_ARGUMENT_PATH(appDirRoot);
     ACQUIRE_LOCK;
 
-    return translate(VolumeManager::Instance()->setupAppDir(path, appDirRoot, appUid));
+    return translate(VolumeManager::Instance()->setupAppDir(path, appUid));
 }
 
 binder::Status VoldNativeService::createObb(const std::string& sourcePath,
index 7de2a67..36b2717 100644 (file)
@@ -65,8 +65,7 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
 
     binder::Status remountUid(int32_t uid, int32_t remountMode);
 
-    binder::Status setupAppDir(const std::string& path, const std::string& appDirRoot,
-                               int32_t appUid);
+    binder::Status setupAppDir(const std::string& path, int32_t appUid);
 
     binder::Status createObb(const std::string& sourcePath, const std::string& sourceKey,
                              int32_t ownerGid, std::string* _aidl_return);
index c141d2a..9eb7852 100644 (file)
@@ -823,8 +823,7 @@ int VolumeManager::unmountAll() {
     return 0;
 }
 
-int VolumeManager::setupAppDir(const std::string& path, const std::string& appDirRoot,
-                               int32_t appUid) {
+int VolumeManager::setupAppDir(const std::string& path, int32_t appUid) {
     // Only offer to create directories for paths managed by vold
     if (!StartsWith(path, "/storage/")) {
         LOG(ERROR) << "Failed to find mounted volume for " << path;
index eb48736..5a2a481 100644 (file)
@@ -133,20 +133,27 @@ class VolumeManager {
 
     /*
      * Creates a directory 'path' for an application, automatically creating
-     * directories along the given path if they don't exist yet. 'appDirRoot'
-     * is the "root" directory for app-specific directories of this kind;
-     * 'path' must always start with 'appDirRoot'.
+     * directories along the given path if they don't exist yet.
      *
      * Example:
      *   path = /storage/emulated/0/Android/data/com.foo/files/
-     *   appDirRoot = /storage/emulated/0/Android/data/
      *
-     * This function will set the UID of all app-specific directories below
-     * 'appDirRoot' to the 'appUid' argument. In the given example, the UID
+     * This function will first match the first part of the path with the volume
+     * root of any known volumes; in this case, "/storage/emulated/0" matches
+     * with the volume root of the emulated volume for user 0.
+     *
+     * The subseqent part of the path must start with one of the well-known
+     * Android/ data directories, /Android/data, /Android/obb or
+     * /Android/media.
+     *
+     * The final part of the path is application specific. This function will
+     * create all directories, including the application-specific ones, and
+     * set the UID of all app-specific directories below the well-known data
+     * directories to the 'appUid' argument. In the given example, the UID
      * of /storage/emulated/0/Android/data/com.foo and
      * /storage/emulated/0/Android/data/com.foo/files would be set to 'appUid'.
      *
-     * The UID of the parent directories will be set according to the
+     * The UID/GID of the parent directories will be set according to the
      * requirements of the underlying filesystem and are of no concern to the
      * caller.
      *
@@ -155,7 +162,7 @@ class VolumeManager {
      * and ignored, unless the path ends with "/".  Also ensures that path
      * belongs to a volume managed by vold.
      */
-    int setupAppDir(const std::string& path, const std::string& appDirRoot, int32_t appUid);
+    int setupAppDir(const std::string& path, int32_t appUid);
 
     int createObb(const std::string& path, const std::string& key, int32_t ownerGid,
                   std::string* outVolId);
index f1e463a..29a63af 100644 (file)
@@ -54,7 +54,7 @@ interface IVold {
 
     void remountUid(int uid, int remountMode);
 
-    void setupAppDir(@utf8InCpp String path, @utf8InCpp String appDirRoot, int appUid);
+    void setupAppDir(@utf8InCpp String path, int appUid);
 
     @utf8InCpp String createObb(@utf8InCpp String sourcePath, @utf8InCpp String sourceKey,
                                 int ownerGid);