diff --git a/Android.mk b/Android.mk index 4971ec7..9dba651 100644 --- a/Android.mk +++ b/Android.mk @@ -88,6 +88,8 @@ ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) vold_cflags += -DTARGET_USES_MKE2FS required_modules += mke2fs else + # Adoptable storage has fully moved to mke2fs, so we need both tools + required_modules += mke2fs required_modules += make_ext4fs endif endif diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp index c3e0cc3..13cff0d 100644 --- a/Ext4Crypt.cpp +++ b/Ext4Crypt.cpp @@ -599,8 +599,7 @@ bool e4crypt_prepare_user_storage(const char* volume_uuid, userid_t user_id, int 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; - // For now, FBE is only supported on internal storage - if (e4crypt_is_native() && volume_uuid == nullptr) { + if (e4crypt_is_native()) { std::string de_raw_ref; if (!lookup_key_ref(s_de_key_raw_refs, user_id, &de_raw_ref)) return false; if (!ensure_policy(de_raw_ref, system_de_path)) return false; @@ -621,8 +620,7 @@ bool e4crypt_prepare_user_storage(const char* volume_uuid, userid_t user_id, int if (!prepare_dir(media_ce_path, 0770, AID_MEDIA_RW, AID_MEDIA_RW)) return false; if (!prepare_dir(user_ce_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false; - // For now, FBE is only supported on internal storage - if (e4crypt_is_native() && volume_uuid == nullptr) { + if (e4crypt_is_native()) { std::string ce_raw_ref; if (!lookup_key_ref(s_ce_key_raw_refs, user_id, &ce_raw_ref)) return false; if (!ensure_policy(ce_raw_ref, system_ce_path)) return false; diff --git a/fs/Ext4.cpp b/fs/Ext4.cpp index 041ce90..adb8f2e 100644 --- a/fs/Ext4.cpp +++ b/fs/Ext4.cpp @@ -56,11 +56,7 @@ namespace vold { namespace ext4 { static const char* kResizefsPath = "/system/bin/resize2fs"; -#ifdef TARGET_USES_MKE2FS static const char* kMkfsPath = "/system/bin/mke2fs"; -#else -static const char* kMkfsPath = "/system/bin/make_ext4fs"; -#endif static const char* kFsckPath = "/system/bin/e2fsck"; bool IsSupported() { @@ -171,7 +167,6 @@ status_t Format(const std::string& source, unsigned long numSectors, std::vector cmd; cmd.push_back(kMkfsPath); -#ifdef TARGET_USES_MKE2FS cmd.push_back("-b"); cmd.push_back("4096"); @@ -191,24 +186,10 @@ status_t Format(const std::string& source, unsigned long numSectors, cmd.push_back(source); - if (numSectors) - cmd.push_back(StringPrintf("%lu", numSectors * (4096 / 512))); -#else - cmd.push_back("-J"); - - cmd.push_back("-a"); - cmd.push_back(target); - if (numSectors) { - cmd.push_back("-l"); - cmd.push_back(StringPrintf("%lu", numSectors * 512)); + cmd.push_back(StringPrintf("%lu", numSectors * (4096 / 512))); } - // Always generate a real UUID - cmd.push_back("-u"); - cmd.push_back(source); -#endif - return ForkExecvp(cmd); }