OSDN Git Service

Don't do private app-dir permissions/quota on public volumes.
authorMartijn Coenen <maco@google.com>
Mon, 20 Apr 2020 13:14:48 +0000 (15:14 +0200)
committerMartijn Coenen <maco@google.com>
Mon, 20 Apr 2020 13:20:09 +0000 (15:20 +0200)
While looking at some emulator logs, I noticed that we fail to create
dirs like /Android/data/com.foo/cache on public volumes, because we try
to chmod it; public volumes go completely through FUSE, even for
Android/, and so these operations will fail, because the underlying
UID/GID is not setup correctly.

Really the only thing we really have to do on public volumes is create
the dirs, like we used to do.

Bug: 152618535
Test: manually verify cache dirs can be created successfully
Change-Id: I66e5d0873f1198123787943b17b468eadf0a853d

VolumeManager.cpp

index e4e5781..bd11be5 100644 (file)
@@ -1012,6 +1012,12 @@ int VolumeManager::setupAppDir(const std::string& path, int32_t appUid, bool fix
         return OK;
     }
 
+    if (volume->getType() == VolumeBase::Type::kPublic) {
+        // On public volumes, we don't need to setup permissions, as everything goes through
+        // FUSE; just create the dirs and be done with it.
+        return fs_mkdirs(lowerPath.c_str(), 0700);
+    }
+
     // Create the app paths we need from the root
     return PrepareAppDirFromRoot(lowerPath, volumeRoot, appUid, fixupExistingOnly);
 }