Only kill apps with storage app data isolation enabled Originally it kills all the apps with obb and data mounted. Due to recent changes, all apps will have obb and data dirs mounted in default root namespace. Hence all apps will be killed by by KillProcessesWithMounts(). To fix this, we also check if the dir is mounted as tmpfs, as the default namespace one is bind mounted to lowerfs, which app data isolation is mounted as tmpfs, so we only kill the process that have obb dir mounted as tmpfs. Bug: 148049767 Test: Able to boot without warnings Change-Id: I5f862ad6f64f5df739b68ea7c9815352bae3be5c Merged-In: I45d9a63ed47cbc27aebb63357a43f51ad62275db
diff --git a/Process.cpp b/Process.cpp index 62d51a2..79fe15d 100644 --- a/Process.cpp +++ b/Process.cpp
@@ -84,7 +84,7 @@ } // TODO: Refactor the code with KillProcessesWithOpenFiles(). -int KillProcessesWithMounts(const std::string& prefix, int signal) { +int KillProcessesWithTmpfsMounts(const std::string& prefix, int signal) { std::unordered_set<pid_t> pids; auto proc_d = std::unique_ptr<DIR, int (*)(DIR*)>(opendir("/proc"), closedir); @@ -112,7 +112,8 @@ // Check if obb directory is mounted, and get all packages of mounted app data directory. mntent* mentry; while ((mentry = getmntent(fp.get())) != nullptr) { - if (android::base::StartsWith(mentry->mnt_dir, prefix)) { + if (mentry->mnt_fsname != nullptr && strncmp(mentry->mnt_fsname, "tmpfs", 5) == 0 + && android::base::StartsWith(mentry->mnt_dir, prefix)) { pids.insert(pid); break; }