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/prebuilt/Android.mk b/prebuilt/Android.mk
index e27f6cd..0cdf5c2 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -600,3 +600,25 @@
$(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)/sbin
+ LOCAL_REQUIRED_MODULES := tzdata
+
+ ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ LOCAL_POST_INSTALL_CMD += \
+ mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root/system/usr/share/zoneinfo; \
+ cp -f $(TARGET_OUT)/usr/share/zoneinfo/tzdata $(TARGET_RECOVERY_ROOT_OUT)/system_root/system/usr/share/zoneinfo/;
+ else
+ 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/;
+ endif
+ include $(BUILD_PHONY_PACKAGE)
+endif