Allow disabling legacy properties
Introduce TW_NO_LEGACY_PROPS flag for users that build TWRP in non-kitkat trees and don't need the legacy prop environment. Change-Id: Iacb2d9af7d7069acb3d0a96bb34f32ded6317a20
This commit is contained in:
@@ -272,6 +272,9 @@ ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),)
|
||||
else ifeq ($(TARGET_RECOVERY_QCOM_RTC_FIX),true)
|
||||
LOCAL_CFLAGS += -DQCOM_RTC_FIX
|
||||
endif
|
||||
ifneq ($(TW_NO_LEGACY_PROPS),)
|
||||
LOCAL_CFLAGS += -DTW_NO_LEGACY_PROPS
|
||||
endif
|
||||
ifneq ($(wildcard bionic/libc/include/sys/capability.h),)
|
||||
LOCAL_CFLAGS += -DHAVE_CAPABILITIES
|
||||
endif
|
||||
|
||||
@@ -162,12 +162,14 @@ static int Run_Update_Binary(const char *path, ZipArchive *Zip, int* wipe_cache)
|
||||
}
|
||||
mzCloseZipArchive(Zip);
|
||||
|
||||
#ifndef TW_NO_LEGACY_PROPS
|
||||
/* Set legacy properties */
|
||||
if (switch_to_legacy_properties() != 0) {
|
||||
LOGERR("Legacy property environment did not initialize successfully. Properties may not be detected.\n");
|
||||
} else {
|
||||
LOGINFO("Legacy property environment initialized.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
pipe(pipe_fd);
|
||||
|
||||
@@ -230,6 +232,7 @@ static int Run_Update_Binary(const char *path, ZipArchive *Zip, int* wipe_cache)
|
||||
|
||||
waitpid(pid, &status, 0);
|
||||
|
||||
#ifndef TW_NO_LEGACY_PROPS
|
||||
/* Unset legacy properties */
|
||||
if (legacy_props_path_modified) {
|
||||
if (switch_to_new_properties() != 0) {
|
||||
@@ -238,6 +241,7 @@ static int Run_Update_Binary(const char *path, ZipArchive *Zip, int* wipe_cache)
|
||||
LOGINFO("Legacy property environment disabled.\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
||||
LOGERR("Error executing updater binary in zip '%s'\n", path);
|
||||
|
||||
Reference in New Issue
Block a user