OSDN Git Service

Return useful path when not visible.
authorJeff Sharkey <jsharkey@android.com>
Thu, 30 Jul 2015 23:54:23 +0000 (16:54 -0700)
committerJeff Sharkey <jsharkey@android.com>
Thu, 30 Jul 2015 23:54:23 +0000 (16:54 -0700)
This allows apps like ExternalStorageProvider to still read/write
files on transient storage devices which aren't mounted as visible.

Bug: 22545248
Change-Id: Idacb15f2233245a8e1861d9be977535a82b218ec

PublicVolume.cpp

index 762eb04..2a93213 100644 (file)
@@ -117,7 +117,11 @@ status_t PublicVolume::doMount() {
     mFuseWrite = StringPrintf("/mnt/runtime_write/%s", stableName.c_str());
 
     setInternalPath(mRawPath);
-    setPath(StringPrintf("/storage/%s", stableName.c_str()));
+    if (getMountFlags() & MountFlags::kVisible) {
+        setPath(StringPrintf("/storage/%s", stableName.c_str()));
+    } else {
+        setPath(mRawPath);
+    }
 
     if (fs_prepare_dir(mRawPath.c_str(), 0700, AID_ROOT, AID_ROOT) ||
             fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||