diff --git a/Android.mk b/Android.mk index 5aa6a2b8..f81bcadc 100755 --- a/Android.mk +++ b/Android.mk @@ -166,6 +166,10 @@ ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) endif endif +ifneq ($(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS),) + LOCAL_CFLAGS += -DTW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS='"$(TW_SYSTEM_BUILD_PROP_ADDITIONAL_PATHS)"' +endif + ifeq ($(TW_USES_VENDOR_LIBS),true) LOCAL_CFLAGS += -DUSE_VENDOR_LIBS=1 endif diff --git a/crypto/fscrypt/fscrypt_policy.cpp b/crypto/fscrypt/fscrypt_policy.cpp index 9ca3ed4f..c4986e57 100755 --- a/crypto/fscrypt/fscrypt_policy.cpp +++ b/crypto/fscrypt/fscrypt_policy.cpp @@ -33,6 +33,7 @@ #include #include #include +#include "KeyUtil.h" #include "fscrypt_policy.h" @@ -144,14 +145,22 @@ extern "C" bool fscrypt_policy_set_struct(const char *directory, const struct fs #endif int fd = open(directory, O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); if (fd == -1) { - printf("failed to open %s\n", directory); + printf("failed to open %s\n", directory); PLOG(ERROR) << "Failed to open directory " << directory; return false; } - if (ioctl(fd, FS_IOC_SET_ENCRYPTION_POLICY, fep)) { - PLOG(ERROR) << "Failed to set encryption policy for " << directory; - close(fd); - return false; + if (isFsKeyringSupported()) { + if (ioctl(fd, FS_IOC_SET_ENCRYPTION_POLICY, fep)) { + PLOG(ERROR) << "Failed to set encryption policy for " << directory; + close(fd); + return false; + } + } else { + if (ioctl(fd, FS_IOC_SET_ENCRYPTION_POLICY, fep)) { + PLOG(ERROR) << "Failed to set encryption policy for " << directory; + close(fd); + return false; + } } close(fd); return true; @@ -172,19 +181,28 @@ extern "C" bool fscrypt_policy_get_struct(const char *directory, struct fscrypt_ #else memset(fep, 0, sizeof(fscrypt_policy_v2)); #endif - struct fscrypt_get_policy_ex_arg ex_policy = {0}; - ex_policy.policy_size = sizeof(ex_policy.policy); - if (ioctl(fd, FS_IOC_GET_ENCRYPTION_POLICY_EX, &ex_policy) != 0) { - PLOG(ERROR) << "Failed to get encryption policy for " << directory; - close(fd); - return false; - } + + if (isFsKeyringSupported()) { + ex_policy.policy_size = sizeof(ex_policy.policy); + if (ioctl(fd, FS_IOC_GET_ENCRYPTION_POLICY_EX, &ex_policy) != 0) { + PLOG(ERROR) << "Failed to get encryption policy for " << directory; + close(fd); + return false; + } #ifdef USE_FSCRYPT_POLICY_V1 - memcpy(fep, &ex_policy.policy.v1, sizeof(ex_policy.policy.v1)); + memcpy(fep, &ex_policy.policy.v1, sizeof(ex_policy.policy.v1)); #else - memcpy(fep, &ex_policy.policy.v2, sizeof(ex_policy.policy.v2)); + memcpy(fep, &ex_policy.policy.v2, sizeof(ex_policy.policy.v2)); #endif + } else { + if (ioctl(fd, FS_IOC_GET_ENCRYPTION_POLICY, &ex_policy.policy.v1) != 0) { + PLOG(ERROR) << "Failed to get encryption policy for " << directory; + close(fd); + return false; + } + memcpy(fep, &ex_policy.policy.v1, sizeof(ex_policy.policy.v1)); + } close(fd); return true; } diff --git a/crypto/vold_decrypt/vold_decrypt.cpp b/crypto/vold_decrypt/vold_decrypt.cpp index 4a76405d..2a0e1fbd 100755 --- a/crypto/vold_decrypt/vold_decrypt.cpp +++ b/crypto/vold_decrypt/vold_decrypt.cpp @@ -780,6 +780,7 @@ void Set_Needed_Properties(void) { property_set("vendor.sys.listeners.registered", "false"); } +#ifdef TW_INCLUDE_LIBRESETPROP // Patch_Level_Overrides void Update_Patch_Level(void) { // On Oreo and above, keymaster requires Android version & patch level to match installed system string sdkverstr = TWFunc::System_Property_Get("ro.build.version.sdk"); @@ -901,6 +902,7 @@ void Revert_Patch_Level(void) { return; } } +#endif // Patch_Level_Overrides static unsigned int get_blkdev_size(int fd) { unsigned long nr_sec; diff --git a/data.cpp b/data.cpp index e0d10f81..011adf61 100755 --- a/data.cpp +++ b/data.cpp @@ -779,6 +779,7 @@ void DataManager::SetDefaultValues() mData.SetValue(TW_IS_ENCRYPTED, "0"); mData.SetValue(TW_IS_DECRYPTED, "0"); mData.SetValue(TW_CRYPTO_PASSWORD, "0"); + mData.SetValue(TW_CRYPTO_PWTYPE, "0"); // Set initial value so that recovery will not be confused when using unencrypted data or failed to decrypt data mData.SetValue("tw_terminal_state", "0"); mData.SetValue("tw_background_thread_running", "0"); mData.SetValue(TW_RESTORE_FILE_DATE, "0"); diff --git a/etc/init/nano.rc b/etc/init/nano.rc index f57f6564..daf82156 100644 --- a/etc/init/nano.rc +++ b/etc/init/nano.rc @@ -1,3 +1,3 @@ on fs export TERMINFO /system/etc/terminfo - export TERM pcansi + export TERM bg1.25 diff --git a/fuse_sideload/fuse_sideload.cpp b/fuse_sideload/fuse_sideload.cpp index 3d948030..07cbe96f 100644 --- a/fuse_sideload/fuse_sideload.cpp +++ b/fuse_sideload/fuse_sideload.cpp @@ -225,7 +225,7 @@ static int handle_release(void* /* data */, fuse_data* /* fd */, const fuse_in_h // Fetch a block from the host into fd->curr_block and fd->block_data. // Returns 0 on successful fetch, negative otherwise. -static int fetch_block(fuse_data* fd, uint32_t block) { +static int fetch_block(fuse_data* fd, uint64_t block) { if (block == fd->curr_block) { return 0; } diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 157b4612..3da15527 100755 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -2199,7 +2199,7 @@ - restore_pin + restore_keymaster @@ -2233,7 +2233,7 @@ - tw_multiuser_warning_destination=restore + tw_multiuser_warning_destination=restore_force multiuser_warning @@ -2267,12 +2267,6 @@ select_storage - - - - restore_pin - - @@ -3746,7 +3740,7 @@ - + changeTwrpFolder @@ -6109,24 +6103,24 @@ edi - +