Add TWFunc::Property_Override(name, value) to override properties
using libresetprop Change-Id: Ic49e187698c714f8a629d20ceddc40e823555477
This commit is contained in:
+10
@@ -398,6 +398,16 @@ endif
|
||||
ifneq ($(TW_CLOCK_OFFSET),)
|
||||
LOCAL_CFLAGS += -DTW_CLOCK_OFFSET=$(TW_CLOCK_OFFSET)
|
||||
endif
|
||||
ifneq ($(TW_OVERRIDE_SYSTEM_PROPS),)
|
||||
TW_INCLUDE_LIBRESETPROP := true
|
||||
LOCAL_CFLAGS += -DTW_OVERRIDE_SYSTEM_PROPS=$(TW_OVERRIDE_SYSTEM_PROPS)
|
||||
endif
|
||||
ifneq ($(TW_INCLUDE_LIBRESETPROP),)
|
||||
LOCAL_SHARED_LIBRARIES += libresetprop
|
||||
LOCAL_C_INCLUDES += external/magisk-prebuilt/include
|
||||
LOCAL_CFLAGS += -DTW_INCLUDE_LIBRESETPROP
|
||||
endif
|
||||
|
||||
TWRP_REQUIRED_MODULES += \
|
||||
dump_image \
|
||||
erase_image \
|
||||
|
||||
+1
-1
@@ -577,7 +577,7 @@ ifeq ($(TW_INCLUDE_CRYPTO), true)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(TW_INCLUDE_REPACKTOOLS) $(TW_INCLUDE_RESETPROP), true))
|
||||
ifneq (,$(filter $(TW_INCLUDE_REPACKTOOLS) $(TW_INCLUDE_RESETPROP) $(TW_INCLUDE_LIBRESETPROP), true))
|
||||
ifeq ($(wildcard external/magisk-prebuilt/Android.mk),)
|
||||
$(warning Magisk prebuilt tools not found!)
|
||||
$(warning Please place https://github.com/TeamWin/external_magisk-prebuilt)
|
||||
|
||||
@@ -59,6 +59,10 @@ extern "C" {
|
||||
#include "libcrecovery/common.h"
|
||||
}
|
||||
|
||||
#ifdef TW_INCLUDE_LIBRESETPROP
|
||||
#include <resetprop.h>
|
||||
#endif
|
||||
|
||||
struct selabel_handle *selinux_handle;
|
||||
|
||||
/* Execute a command */
|
||||
@@ -1315,4 +1319,13 @@ bool TWFunc::Is_TWRP_App_In_System() {
|
||||
DataManager::SetValue("tw_app_installed_in_system", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
int TWFunc::Property_Override(string Prop_Name, string Prop_Value) {
|
||||
#ifdef TW_INCLUDE_LIBRESETPROP
|
||||
return setprop(Prop_Name.c_str(), Prop_Value.c_str(), false);
|
||||
#else
|
||||
return -2;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // ndef BUILD_TWRPTAR_MAIN
|
||||
|
||||
@@ -107,6 +107,7 @@ public:
|
||||
static std::string get_cache_dir(); // return the cache partition existence
|
||||
static void check_selinux_support(); // print whether selinux support is enabled to console
|
||||
static bool Is_TWRP_App_In_System(); // Check if the TWRP app is installed in the system partition
|
||||
static int Property_Override(string Prop_Name, string Prop_Value); // Override properties (including ro. properties)
|
||||
|
||||
private:
|
||||
static void Copy_Log(string Source, string Destination);
|
||||
|
||||
Reference in New Issue
Block a user