Merge "Check the data directory before mount tmpfs" am: 767c2ba770 am: fc0e10b210 am: ca74c56e3a

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1771085

Change-Id: I952a9842c064bc7faf2245ba5fa95bfce8881e3b
This commit is contained in:
rickywai
2022-02-06 23:53:34 +00:00
committed by Automerger Merge Worker

View File

@@ -202,6 +202,8 @@ static constexpr unsigned int STORAGE_DIR_CHECK_MAX_INTERVAL_US = 1000;
*/ */
static constexpr int STORAGE_DIR_CHECK_TIMEOUT_US = 1000 * 1000 * 60 * 5; static constexpr int STORAGE_DIR_CHECK_TIMEOUT_US = 1000 * 1000 * 60 * 5;
static void WaitUntilDirReady(const std::string& target, fail_fn_t fail_fn);
/** /**
* A helper class containing accounting information for USAPs. * A helper class containing accounting information for USAPs.
*/ */
@@ -1249,7 +1251,11 @@ static void isolateAppData(JNIEnv* env, const std::vector<std::string>& merged_d
auto volPath = StringPrintf("%s/%s", externalPrivateMountPath, ent->d_name); auto volPath = StringPrintf("%s/%s", externalPrivateMountPath, ent->d_name);
auto cePath = StringPrintf("%s/user", volPath.c_str()); auto cePath = StringPrintf("%s/user", volPath.c_str());
auto dePath = StringPrintf("%s/user_de", volPath.c_str()); auto dePath = StringPrintf("%s/user_de", volPath.c_str());
// Wait until dir user is created.
WaitUntilDirReady(cePath.c_str(), fail_fn);
MountAppDataTmpFs(cePath.c_str(), fail_fn); MountAppDataTmpFs(cePath.c_str(), fail_fn);
// Wait until dir user_de is created.
WaitUntilDirReady(dePath.c_str(), fail_fn);
MountAppDataTmpFs(dePath.c_str(), fail_fn); MountAppDataTmpFs(dePath.c_str(), fail_fn);
} }
closedir(dir); closedir(dir);