Make storage dirs remount fork() safe
Also, use the pids provided by system server to remount all existing
processes, so we don't need to do the heavy and unreliable scanning in
/proc anymore.
Bug: 149548518
Test: atest AdoptableHostTest
Change-Id: Ifb5b79a3bc5438f36e0d61ec8aec96bdbc60ca13
diff --git a/model/EmulatedVolume.cpp b/model/EmulatedVolume.cpp
index 1391685..02d5c37 100644
--- a/model/EmulatedVolume.cpp
+++ b/model/EmulatedVolume.cpp
@@ -125,19 +125,6 @@
if (status != OK) {
return status;
}
-
- if (mAppDataIsolationEnabled) {
- // Starting from now, fuse is running, and zygote will bind app obb & data directory
- if (!VolumeManager::Instance()->addFuseMountedUser(userId)) {
- return UNKNOWN_ERROR;
- }
-
- // As all new processes created by zygote will bind app obb data directory, we just need
- // to have a snapshot of all existing processes and see if any existing process needs to
- // remount obb data directory.
- VolumeManager::Instance()->remountAppStorageDirs(userId);
- }
-
return OK;
}
@@ -308,12 +295,6 @@
if (mFuseMounted) {
std::string label = getLabel();
- // Update fuse mounted record
- if (mAppDataIsolationEnabled &&
- !VolumeManager::Instance()->removeFuseMountedUser(userId)) {
- return UNKNOWN_ERROR;
- }
-
// Ignoring unmount return status because we do want to try to unmount
// the rest cleanly.
unmountFuseBindMounts();
diff --git a/model/EmulatedVolume.h b/model/EmulatedVolume.h
index 12d01ec..b25fb7c 100644
--- a/model/EmulatedVolume.h
+++ b/model/EmulatedVolume.h
@@ -41,6 +41,7 @@
EmulatedVolume(const std::string& rawPath, dev_t device, const std::string& fsUuid, int userId);
virtual ~EmulatedVolume();
std::string getRootPath() const override;
+ bool isFuseMounted() const { return mFuseMounted; }
protected:
status_t doMount() override;