tzdata: add to TWRP build automatically
Fixes "__bionic_open_tzdata" errors in recovery log
Use "TW_EXCLUDE_TZDATA := true" flag to exclude from build
if needed for space reasons. Will automatically be excluded
is "TW_OEM_BUILD := true" flag is present
Change-Id: I2f4a0f3a354a32c2f4f9733b3e88beedc4773020
diff --git a/Android.mk b/Android.mk
index f82a0ba..d32d055 100755
--- a/Android.mk
+++ b/Android.mk
@@ -135,6 +135,7 @@
BOARD_HAS_NO_REAL_SDCARD := true
TW_USE_TOOLBOX := true
TW_EXCLUDE_MTP := true
+ TW_EXCLUDE_TZDATA := true
endif
ifeq ($(AB_OTA_UPDATER),true)
@@ -403,6 +404,11 @@
me.twrp.twrpapp.apk \
privapp-permissions-twrpapp.xml
+ifneq ($(TW_EXCLUDE_TZDATA), true)
+TWRP_REQUIRED_MODULES += \
+ tzdata_twrp
+endif
+
ifneq ($(TW_INCLUDE_CRYPTO),)
TWRP_REQUIRED_MODULES += \
hwservicemanager \
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 491d1c6..3f54db1 100755
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -505,3 +505,19 @@
$(error magiskboot prebuilts not present; exiting)
endif
endif
+
+# Include tzdata in TWRP to fix "__bionic_open_tzdata" log spam
+# Dummy file to apply post-install patch
+ifneq ($(TW_EXCLUDE_TZDATA), true)
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := tzdata_twrp
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_CLASS := ETC
+ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/system/bin
+ LOCAL_REQUIRED_MODULES := tzdata
+
+ LOCAL_POST_INSTALL_CMD += \
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/usr/share/zoneinfo; \
+ cp -f $(TARGET_OUT)/usr/share/zoneinfo/tzdata $(TARGET_RECOVERY_ROOT_OUT)/system/usr/share/zoneinfo/;
+ include $(BUILD_PHONY_PACKAGE)
+endif