Stop using a regex for setupAppDir.

This was hard to read and understand. Instead, fall back to explicit
string operations with more comments on what we're doing and what we're
allowing.

This also fixes an issue where apps were asking us to create dirs on
their behalf that our more than 2 levels deep, eg
com.foo/files/downloads ; I thought such paths weren't allowed, but
apparently they are (and there's no good reason for us to not set them
up correctly).

Bug: 149407572
Test: launch opera
Change-Id: I7c64831032b66e90960b96e41ee42c7d616a759c
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index c141d2a..67add37 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -867,18 +867,10 @@
     const std::string lowerPath =
             volume->getInternalPath() + path.substr(volume->getPath().length());
 
-    // Do some sanity checking on the app dir (relative from root)
     const std::string volumeRoot = volume->getRootPath();  // eg /data/media/0
 
-    // Make sure the Android/ directories exist and are setup correctly
-    int ret = PrepareAndroidDirs(volumeRoot);
-    if (ret != 0) {
-        LOG(ERROR) << "Failed to prepare Android/ directories.";
-        return ret;
-    }
-
-    // Finally, create the app paths we need
-    return PrepareAppDirFromRoot(lowerPath, appUid);
+    // Create the app paths we need from the root
+    return PrepareAppDirFromRoot(lowerPath, volumeRoot, appUid);
 }
 
 int VolumeManager::createObb(const std::string& sourcePath, const std::string& sourceKey,