Update vold to prepare package sandboxes for primary volume.
Vold is updated to create package specific sandboxes for primary
volume and mount them at
"/mnt/user/<user-id>/package/<package-name>/<primary-label>".
This will later be mounted at /storage when a new process starts.
Bug: 111890351
Test: Manually verified that a package has access to "/sdcard" and
"/storage/emulated/0", both of which are just the package specific
sandboxes and the package doesn't have access to other sandboxes
and can't see other package names.
Change-Id: I72dc8ae9eb2260a298159c5de18387dad2f9de48
diff --git a/VolumeManager.h b/VolumeManager.h
index 5583c8c..dd7bf71 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -136,7 +136,20 @@
VolumeManager();
void readInitialState();
- int linkPrimary(userid_t userId);
+ int linkPrimary(userid_t userId, const std::vector<std::string>& packageNames);
+
+ std::string prepareSandboxSource(uid_t uid, const std::string& sandboxId,
+ const std::string& sandboxRootDir);
+ std::string prepareSandboxTarget(const std::string& packageName, uid_t uid,
+ const std::string& volumeLabel, const std::string& mntTargetRootDir, bool isUserDependent);
+ std::string preparePkgDataSource(const std::string& packageName, uid_t uid,
+ const std::string& dataRootDir);
+ std::string preparePkgDataTarget(const std::string& packageName, uid_t uid,
+ const std::string& pkgSandboxDir);
+ int mountSandboxesForPrimaryVol(const std::string& primaryRoot, userid_t userId,
+ const std::vector<std::string>& packageNames, bool isPrimaryEmulated);
+ std::string prepareSubDirs(const std::string& pathPrefix, const std::string& subDirs,
+ mode_t mode, uid_t uid, gid_t gid);
void handleDiskAdded(const std::shared_ptr<android::vold::Disk>& disk);
void handleDiskChanged(dev_t device);