ext4crypt: only include if TARGET_USERIMAGES_USE_EXT4 is set
Fixes build error on legacy devices that don't have this defined
Change-Id: Iab74c5ab952bf1d142d981823ab67867a6f7d185
diff --git a/Android.mk b/Android.mk
index 5395034..add042a 100755
--- a/Android.mk
+++ b/Android.mk
@@ -185,8 +185,6 @@
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 28; echo $$?),0)
LOCAL_CFLAGS += -DUSE_EXT4
- endif
- ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 28; echo $$?),0)
LOCAL_C_INCLUDES += system/extras/ext4_utils \
system/extras/ext4_utils/include \
$(commands_TWRP_local_path)/crypto/ext4crypt
diff --git a/partitions.hpp b/partitions.hpp
index 637471b..58fcd81 100755
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -26,7 +26,10 @@
#include "exclude.hpp"
#include "tw_atomic.hpp"
#include "progresstracking.hpp"
+
+#ifdef USE_EXT4
#include "ext4crypt_tar.h"
+#endif
#define MAX_FSTAB_LINE_LENGTH 2048
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index bc17c88..945f61d 100755
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1396,6 +1396,7 @@
#endif
}
+#ifdef USE_EXT4
bool TWFunc::Get_Encryption_Policy(ext4_encryption_policy &policy, std::string path) {
#ifdef TW_INCLUDE_FBE
if (!TWFunc::Path_Exists(path)) {
@@ -1426,6 +1427,7 @@
#endif
return true;
}
+#endif
string TWFunc::Check_For_TwrpFolder(){
string oldFolder = "";
diff --git a/twrp-functions.hpp b/twrp-functions.hpp
index e686517..4f3c505 100755
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -24,7 +24,8 @@
#ifdef USE_FSCRYPT
#include <ext4_utils/ext4_crypt.h>
-#else
+#endif
+#ifdef USE_EXT4
#include "ext4crypt_tar.h"
#endif
@@ -121,8 +122,10 @@
static bool Is_TWRP_App_In_System(); // Check if the TWRP app is installed in the system partition
static void checkforapp();
static int Property_Override(string Prop_Name, string Prop_Value); // Override properties (including ro. properties)
+#ifdef USE_EXT4
static bool Get_Encryption_Policy(ext4_encryption_policy &policy, std::string path); // return encryption policy for path
static bool Set_Encryption_Policy(std::string path, const ext4_encryption_policy &policy); // set encryption policy for path
+#endif
static string Check_For_TwrpFolder();
static bool Check_Xml_Format(const std::string filename); // Return whether a xml is in plain xml or ABX format