kernel_module_loader: Add TW_BATTERY_SYSFS_WAIT_SECONDS to configure Wait_For_Battery timeout
Xiaomi sm8350 device test passed.
Change-Id: Icb55fe73bf2e5bf9b6f5de5edbac8a8aac80e7e5
Signed-off-by: sekaiacg <sekaiacg@gmail.com>
diff --git a/Android.mk b/Android.mk
index 53bc578..8488334 100755
--- a/Android.mk
+++ b/Android.mk
@@ -363,6 +363,11 @@
ifneq ($(TW_CUSTOM_BATTERY_PATH),)
LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
endif
+ifneq ($(TW_BATTERY_SYSFS_WAIT_SECONDS),)
+ LOCAL_CFLAGS += -DTW_BATTERY_SYSFS_WAIT_SECONDS=$(TW_BATTERY_SYSFS_WAIT_SECONDS)
+else
+ LOCAL_CFLAGS += -DTW_BATTERY_SYSFS_WAIT_SECONDS=3
+endif
ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
endif
diff --git a/kernel_module_loader.cpp b/kernel_module_loader.cpp
index f62eda8..db5dee8 100644
--- a/kernel_module_loader.cpp
+++ b/kernel_module_loader.cpp
@@ -76,7 +76,9 @@
android::base::SetProperty("twrp.modules.loaded", "true");
- TWFunc::Wait_For_Battery(3s);
+#ifdef TW_BATTERY_SYSFS_WAIT_SECONDS
+ TWFunc::Wait_For_Battery(std::chrono::seconds(TW_BATTERY_SYSFS_WAIT_SECONDS));
+#endif
return true;
}