From d0e9a59885bcae5f64e3cdd5eb0c59b733094fc0 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 27 Feb 2024 02:57:55 +0000 Subject: [PATCH] Delete unused code conditional on MANAGE_MISC_DIRS Since MANAGE_MISC_DIRS is hardcoded to 0, and it always has been, there is no need to have it in the code. Test: build Change-Id: I30a73e67999841271e07dbc3eeb1b8568529a7c3 --- FsCrypt.cpp | 12 ------------ Utils.cpp | 4 ---- Utils.h | 1 - 3 files changed, 17 deletions(-) diff --git a/FsCrypt.cpp b/FsCrypt.cpp index 7fe8be4..51b35c5 100644 --- a/FsCrypt.cpp +++ b/FsCrypt.cpp @@ -44,8 +44,6 @@ #include "android/os/IVold.h" -#define MANAGE_MISC_DIRS 0 - #include #include @@ -907,7 +905,6 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_ if (flags & android::os::IVold::STORAGE_FLAG_DE) { // DE_sys key auto system_legacy_path = android::vold::BuildDataSystemLegacyPath(user_id); - auto misc_legacy_path = android::vold::BuildDataMiscLegacyPath(user_id); auto profiles_de_path = android::vold::BuildDataProfilesDePath(user_id); // DE_n key @@ -937,11 +934,6 @@ bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_ if (volume_uuid.empty()) { if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false; -#if MANAGE_MISC_DIRS - if (!prepare_dir(misc_legacy_path, 0750, multiuser_get_uid(user_id, AID_SYSTEM), - multiuser_get_uid(user_id, AID_EVERYBODY))) - return false; -#endif if (!prepare_dir(profiles_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false; if (!prepare_dir_with_policy(system_de_path, 0770, AID_SYSTEM, AID_SYSTEM, de_policy)) @@ -1050,7 +1042,6 @@ bool fscrypt_destroy_user_storage(const std::string& volume_uuid, userid_t user_ if (flags & android::os::IVold::STORAGE_FLAG_DE) { // DE_sys key auto system_legacy_path = android::vold::BuildDataSystemLegacyPath(user_id); - auto misc_legacy_path = android::vold::BuildDataMiscLegacyPath(user_id); auto profiles_de_path = android::vold::BuildDataProfilesDePath(user_id); // DE_n key @@ -1063,9 +1054,6 @@ bool fscrypt_destroy_user_storage(const std::string& volume_uuid, userid_t user_ res &= destroy_dir(misc_de_path); if (volume_uuid.empty()) { res &= destroy_dir(system_legacy_path); -#if MANAGE_MISC_DIRS - res &= destroy_dir(misc_legacy_path); -#endif res &= destroy_dir(profiles_de_path); res &= destroy_dir(system_de_path); res &= destroy_dir(vendor_de_path); diff --git a/Utils.cpp b/Utils.cpp index 40a182b..696b0b4 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -1116,10 +1116,6 @@ std::string BuildDataSystemDePath(userid_t userId) { return StringPrintf("%s/system_de/%u", BuildDataPath("").c_str(), userId); } -std::string BuildDataMiscLegacyPath(userid_t userId) { - return StringPrintf("%s/misc/user/%u", BuildDataPath("").c_str(), userId); -} - // Keep in sync with installd (frameworks/native/cmds/installd/utils.h) std::string BuildDataProfilesDePath(userid_t userId) { return StringPrintf("%s/misc/profiles/cur/%u", BuildDataPath("").c_str(), userId); diff --git a/Utils.h b/Utils.h index fbd0f30..690f79e 100644 --- a/Utils.h +++ b/Utils.h @@ -148,7 +148,6 @@ std::string BuildKeyPath(const std::string& partGuid); std::string BuildDataSystemLegacyPath(userid_t userid); std::string BuildDataSystemCePath(userid_t userid); std::string BuildDataSystemDePath(userid_t userid); -std::string BuildDataMiscLegacyPath(userid_t userid); std::string BuildDataProfilesDePath(userid_t userid); std::string BuildDataVendorCePath(userid_t userid); std::string BuildDataVendorDePath(userid_t userid);