From e0074f142b4c9b6bfc750abbcb4ee0786676d0df Mon Sep 17 00:00:00 2001 From: Qin Chao Date: Tue, 15 Dec 2015 15:20:41 +0800 Subject: [PATCH] Hide external storage from apps if it's not set as adoptable If storage is not visible to apps and no need to spin up FUSE, it also should not make FUSE mount point directory. Change-Id: I6ecd2e5bf56b5dcf0e11834880256b156a62a9a0 Signed-off-by: Qin Chao --- PublicVolume.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PublicVolume.cpp b/PublicVolume.cpp index 2ec6736..8580da9 100644 --- a/PublicVolume.cpp +++ b/PublicVolume.cpp @@ -123,10 +123,7 @@ status_t PublicVolume::doMount() { 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) || - fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) || - fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) { + if (fs_prepare_dir(mRawPath.c_str(), 0700, AID_ROOT, AID_ROOT)) { PLOG(ERROR) << getId() << " failed to create mount points"; return -errno; } @@ -146,6 +143,13 @@ status_t PublicVolume::doMount() { return OK; } + if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) || + fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) || + fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) { + PLOG(ERROR) << getId() << " failed to create FUSE mount points"; + return -errno; + } + dev_t before = GetDevice(mFuseWrite); if (!(mFusePid = fork())) {