Don't do private app-dir permissions/quota on public volumes.

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
This commit is contained in:
Martijn Coenen 2020-04-20 15:14:48 +02:00
parent 0fbd0c1542
commit bf205ab7d4

View 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);
}