Remove appDirRoot argument from setupAppDir.

This is no longer needed, because vold can deduce this itself now.

Bug: 146419093
Test: builds
Change-Id: Ib4f4a4109919af683722a63b305b343ef5fe972d
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 3643c74..dbe1d98 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -458,14 +458,12 @@
     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,
diff --git a/VoldNativeService.h b/VoldNativeService.h
index 7de2a67..36b2717 100644
--- a/VoldNativeService.h
+++ b/VoldNativeService.h
@@ -65,8 +65,7 @@
 
     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);
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index c141d2a..9eb7852 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -823,8 +823,7 @@
     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;
diff --git a/VolumeManager.h b/VolumeManager.h
index eb48736..5a2a481 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -133,20 +133,27 @@
 
     /*
      * 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 @@
      * 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);
diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl
index f1e463a..29a63af 100644
--- a/binder/android/os/IVold.aidl
+++ b/binder/android/os/IVold.aidl
@@ -54,7 +54,7 @@
 
     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);