From d1ee944f0839d60b014722c7facbb4a66bd4f2c3 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Wed, 2 Mar 2016 18:36:50 +0000 Subject: [PATCH] Prepare profile directories only for the internal storage Bug: 27444691 Change-Id: I0d30e8883fe655c90cda47ab167a878764ea0802 --- Ext4Crypt.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp index 6612eaf..a9c5ba5 100644 --- a/Ext4Crypt.cpp +++ b/Ext4Crypt.cpp @@ -600,16 +600,22 @@ bool e4crypt_prepare_user_storage(const char* volume_uuid, userid_t user_id, auto system_de_path = android::vold::BuildDataSystemDePath(user_id); auto misc_de_path = android::vold::BuildDataMiscDePath(user_id); auto user_de_path = android::vold::BuildDataUserDePath(volume_uuid, user_id); - auto profiles_de_path = android::vold::BuildDataProfilesDePath(user_id); - auto foreign_dex_profiles_de_path = - android::vold::BuildDataProfilesForeignDexDePath(user_id); - if (!prepare_dir(system_de_path, 0770, AID_SYSTEM, AID_SYSTEM)) return false; if (!prepare_dir(misc_de_path, 01771, AID_SYSTEM, AID_MISC)) return false; if (!prepare_dir(user_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false; - if (!prepare_dir(profiles_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false; - if (!prepare_dir(foreign_dex_profiles_de_path, 0773, AID_SYSTEM, AID_SYSTEM)) return false; + + if (volume_uuid == nullptr) { + // Prepare profile directories only for the internal storage. + // For now, we do not store profiles on the adopted storage. + auto profiles_de_path = android::vold::BuildDataProfilesDePath(user_id); + auto foreign_dex_profiles_de_path = + android::vold::BuildDataProfilesForeignDexDePath(user_id); + if (!prepare_dir(profiles_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false; + if (!prepare_dir(foreign_dex_profiles_de_path, 0773, AID_SYSTEM, AID_SYSTEM)) { + return false; + } + } if (e4crypt_is_native()) { std::string de_raw_ref;