blob: 32c0d5b1f2903e3dfeb6f9316cfb0fbfa9a94e28 [file] [log] [blame]
Dees_Troy51a0e822012-09-05 15:24:24 -04001LOCAL_PATH := $(call my-dir)
2include $(CLEAR_VARS)
3
Motorhead1991c7f2e122014-06-12 15:57:36 -07004LOCAL_CFLAGS := -fno-strict-aliasing
5
Dees_Troy51a0e822012-09-05 15:24:24 -04006LOCAL_SRC_FILES := \
7 gui.cpp \
8 resources.cpp \
9 pages.cpp \
10 text.cpp \
11 image.cpp \
12 action.cpp \
13 console.cpp \
14 fill.cpp \
15 button.cpp \
16 checkbox.cpp \
17 fileselector.cpp \
18 progressbar.cpp \
19 animation.cpp \
Vojtech Bocekede51c52014-02-07 23:58:09 +010020 object.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040021 slider.cpp \
Vojtech Bocek85932342013-04-01 22:11:33 +020022 slidervalue.cpp \
Dees_Troy51a0e822012-09-05 15:24:24 -040023 listbox.cpp \
24 keyboard.cpp \
bigbiff bigbiff8a68c312013-02-10 14:28:30 -050025 input.cpp \
26 blanktimer.cpp \
Vojtech Bocek1fc30fc2014-01-29 18:37:19 +010027 partitionlist.cpp \
Ethan Yonker0a3a98f2015-02-05 00:48:28 +010028 mousecursor.cpp \
Vojtech Bocek7e11ac52015-03-05 23:21:49 +010029 scrolllist.cpp \
Ethan Yonker44925ad2015-07-22 12:33:59 -050030 patternpassword.cpp \
Ethan Yonker74db1572015-10-28 12:44:49 -050031 textbox.cpp \
that1964d192016-01-07 00:41:03 +010032 terminal.cpp \
Ethan Yonker74db1572015-10-28 12:44:49 -050033 twmsg.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040034
bigbiffc6e2cfe2020-06-26 16:14:32 -040035ifneq ($(TW_DELAY_TOUCH_INIT_MS),)
36 LOCAL_CFLAGS += -DTW_DELAY_TOUCH_INIT_MS=$(TW_DELAY_TOUCH_INIT_MS)
37endif
38
Dees_Troy51a0e822012-09-05 15:24:24 -040039ifneq ($(TWRP_CUSTOM_KEYBOARD),)
Ethan Yonker591b9202015-03-11 11:17:15 -050040 LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
Dees_Troy51a0e822012-09-05 15:24:24 -040041else
Ethan Yonker591b9202015-03-11 11:17:15 -050042 LOCAL_SRC_FILES += hardwarekeyboard.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040043endif
44
Ethan Yonker8373cfe2017-09-08 06:50:54 -050045LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libaosprecovery libselinux
46ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0)
47 LOCAL_SHARED_LIBRARIES += libziparchive
Ethan Yonker58f21322018-08-24 11:17:36 -050048 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../otautil/include
Ethan Yonker8373cfe2017-09-08 06:50:54 -050049else
50 LOCAL_SHARED_LIBRARIES += libminzip
51 LOCAL_CFLAGS += -DUSE_MINZIP
52endif
bigbiffa2bd7b72020-05-07 21:45:34 -040053ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
54 ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 28; echo $$?),0)
55 LOCAL_C_INCLUDES += system/extras/ext4_utils \
56 system/extras/ext4_utils/include \
bigbiff186eb702020-06-08 15:59:32 -040057 $(LOCAL_PATH)/../crypto/ext4crypt
bigbiffa2bd7b72020-05-07 21:45:34 -040058 LOCAL_SHARED_LIBRARIES += libext4_utils
59 endif
60endif
61
Dees_Troy2673cec2013-04-02 20:22:16 +000062LOCAL_MODULE := libguitwrp
Dees_Troy51a0e822012-09-05 15:24:24 -040063
Dees_Troy51a0e822012-09-05 15:24:24 -040064#TWRP_EVENT_LOGGING := true
65ifeq ($(TWRP_EVENT_LOGGING), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050066 LOCAL_CFLAGS += -D_EVENT_LOGGING
67endif
68ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),)
69 LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC)
Dees_Troy51a0e822012-09-05 15:24:24 -040070endif
mauronofrio0ff59842019-10-26 19:47:55 +020071ifneq ($(TW_OZIP_DECRYPT_KEY),)
72 LOCAL_CFLAGS += -DTW_OZIP_DECRYPT_KEY=\"$(TW_OZIP_DECRYPT_KEY)\"
73else
74 LOCAL_CFLAGS += -DTW_OZIP_DECRYPT_KEY=0
75endif
bigbiff bigbiff87940362013-03-09 09:58:50 -050076ifneq ($(TW_NO_SCREEN_BLANK),)
Ethan Yonker591b9202015-03-11 11:17:15 -050077 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
bigbiff bigbiff87940362013-03-09 09:58:50 -050078endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070079ifneq ($(TW_NO_SCREEN_TIMEOUT),)
Ethan Yonker591b9202015-03-11 11:17:15 -050080 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070081endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040082ifeq ($(TW_OEM_BUILD), true)
Ethan Yonker83e82572014-04-04 10:59:28 -050083 LOCAL_CFLAGS += -DTW_OEM_BUILD
84endif
Ethan Yonker751a85e2014-12-12 16:59:10 -060085ifneq ($(TW_X_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050086 LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060087endif
88ifneq ($(TW_Y_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050089 LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060090endif
James Christopher Adduonodcd1e442016-11-06 13:17:34 -050091ifneq ($(TW_W_OFFSET),)
92 LOCAL_CFLAGS += -DTW_W_OFFSET=$(TW_W_OFFSET)
93endif
94ifneq ($(TW_H_OFFSET),)
95 LOCAL_CFLAGS += -DTW_H_OFFSET=$(TW_H_OFFSET)
96endif
Ethan Yonker63e414f2015-02-06 15:44:39 -060097ifeq ($(TW_ROUND_SCREEN), true)
Ethan Yonker591b9202015-03-11 11:17:15 -050098 LOCAL_CFLAGS += -DTW_ROUND_SCREEN
bigbiff bigbiff163d4742013-11-16 13:25:27 -050099endif
Sean hoyt28d8dec2018-07-15 06:16:09 +0200100ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true)
101 LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT
102endif
Captain Throwback3b556102021-02-12 19:32:36 -0500103ifeq ($(TW_EXCLUDE_NANO), true)
104 LOCAL_CFLAGS += -DTW_EXCLUDE_NANO
105endif
epicXb7337372021-02-24 23:12:08 +0530106ifeq ($(AB_OTA_UPDATER),true)
107 LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
108endif
bigbiff bigbiff163d4742013-11-16 13:25:27 -0500109
Matt Mower0c88b842017-01-15 16:00:49 -0600110LOCAL_C_INCLUDES += \
111 bionic \
mauronofrio27020942020-01-10 16:44:28 +0100112 system/core/base/include \
Matt Mower0c88b842017-01-15 16:00:49 -0600113 system/core/include \
114 system/core/libpixelflinger/include
115
Xing0af1ac12015-11-27 11:19:37 -0800116ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
117 LOCAL_C_INCLUDES += external/stlport/stlport
Ethan Yonker58f21322018-08-24 11:17:36 -0500118 LOCAL_CFLAGS += -DUSE_FUSE_SIDELOAD22
Xing0af1ac12015-11-27 11:19:37 -0800119endif
120
Dees Troy3454ade2015-01-20 19:21:04 +0000121LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees_Troy51a0e822012-09-05 15:24:24 -0400122
123include $(BUILD_STATIC_LIBRARY)
124
125# Transfer in the resources for the device
126include $(CLEAR_VARS)
127LOCAL_MODULE := twrp
128LOCAL_MODULE_TAGS := eng
129LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +0000130LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400131
Matt Mowerd4a11182017-01-18 20:06:36 -0600132# The extra blank line before *** is intentional to ensure it ends up on its own line
133define TW_THEME_WARNING_MSG
134
135****************************************************************************
136 Could not find ui.xml for TW_THEME: $(TW_THEME)
137 Set TARGET_SCREEN_WIDTH and TARGET_SCREEN_HEIGHT to automatically select
138 an appropriate theme, or set TW_THEME to one of the following:
Ethan Yonker58f21322018-08-24 11:17:36 -0500139 $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*))
Matt Mowerd4a11182017-01-18 20:06:36 -0600140****************************************************************************
141endef
142define TW_CUSTOM_THEME_WARNING_MSG
143
144****************************************************************************
145 Could not find ui.xml for TW_CUSTOM_THEME: $(TW_CUSTOM_THEME)
Matt Mower0c005712017-02-12 13:10:08 -0600146 Expected to find custom theme's ui.xml at:
Matt Mowerd4a11182017-01-18 20:06:36 -0600147 $(TWRP_THEME_LOC)/ui.xml
148 Please fix this or set TW_THEME to one of the following:
Ethan Yonker58f21322018-08-24 11:17:36 -0500149 $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*))
Matt Mowerd4a11182017-01-18 20:06:36 -0600150****************************************************************************
151endef
152
Ethan Yonker58f21322018-08-24 11:17:36 -0500153TWRP_RES := $(LOCAL_PATH)/theme/common/fonts
154TWRP_RES += $(LOCAL_PATH)/theme/common/languages
nkk716e4114f2017-01-19 16:56:07 +0200155ifeq ($(TW_EXTRA_LANGUAGES),true)
Ethan Yonker58f21322018-08-24 11:17:36 -0500156 TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/fonts
157 TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/languages
nkk716e4114f2017-01-19 16:56:07 +0200158endif
159
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500160ifeq ($(TW_CUSTOM_THEME),)
Ethan Yonker591b9202015-03-11 11:17:15 -0500161 ifeq ($(TW_THEME),)
niks255d73903c2017-01-15 17:39:48 +0600162 ifeq ($(DEVICE_RESOLUTION),)
Matt Mowerd4a11182017-01-18 20:06:36 -0600163 GUI_WIDTH := $(TARGET_SCREEN_WIDTH)
164 GUI_HEIGHT := $(TARGET_SCREEN_HEIGHT)
165 else
166 SPLIT_DEVICE_RESOLUTION := $(subst x, ,$(DEVICE_RESOLUTION))
167 GUI_WIDTH := $(word 1, $(SPLIT_DEVICE_RESOLUTION))
168 GUI_HEIGHT := $(word 2, $(SPLIT_DEVICE_RESOLUTION))
niks255d73903c2017-01-15 17:39:48 +0600169 endif
Matt Mowerd4a11182017-01-18 20:06:36 -0600170
171 # Minimum resolution of 100x100
172 # This also ensures GUI_WIDTH and GUI_HEIGHT are numbers
173 ifeq ($(shell test $(GUI_WIDTH) -ge 100; echo $$?),0)
174 ifeq ($(shell test $(GUI_HEIGHT) -ge 100; echo $$?),0)
175 ifeq ($(shell test $(GUI_WIDTH) -gt $(GUI_HEIGHT); echo $$?),0)
176 ifeq ($(shell test $(GUI_WIDTH) -ge 1280; echo $$?),0)
177 TW_THEME := landscape_hdpi
178 else
179 TW_THEME := landscape_mdpi
180 endif
181 else ifeq ($(shell test $(GUI_WIDTH) -lt $(GUI_HEIGHT); echo $$?),0)
182 ifeq ($(shell test $(GUI_WIDTH) -ge 720; echo $$?),0)
183 TW_THEME := portrait_hdpi
184 else
185 TW_THEME := portrait_mdpi
186 endif
187 else ifeq ($(shell test $(GUI_WIDTH) -eq $(GUI_HEIGHT); echo $$?),0)
188 # watch_hdpi does not yet exist
189 TW_THEME := watch_mdpi
190 endif
191 endif
Ethan Yonker591b9202015-03-11 11:17:15 -0500192 endif
193 endif
bigbiffce8f83c2015-12-12 18:30:21 -0500194
Ethan Yonker58f21322018-08-24 11:17:36 -0500195 TWRP_THEME_LOC := $(LOCAL_PATH)/theme/$(TW_THEME)
Matt Mowerd4a11182017-01-18 20:06:36 -0600196 ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
197 $(warning $(TW_THEME_WARNING_MSG))
198 $(error Theme selection failed; exiting)
199 endif
200
Ethan Yonker58f21322018-08-24 11:17:36 -0500201 TWRP_RES += $(LOCAL_PATH)/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
nkk716e4114f2017-01-19 16:56:07 +0200202 # for future copying of used include xmls and fonts:
203 # UI_XML := $(TWRP_THEME_LOC)/ui.xml
204 # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)
205 # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq)
206else
207 TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
Matt Mowerd4a11182017-01-18 20:06:36 -0600208 ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
209 $(warning $(TW_CUSTOM_THEME_WARNING_MSG))
210 $(error Theme selection failed; exiting)
nkk716e4114f2017-01-19 16:56:07 +0200211 endif
thatd16b2ce2015-07-27 20:39:19 +0200212endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200213
Matt Mowerd4a11182017-01-18 20:06:36 -0600214TWRP_RES += $(TW_ADDITIONAL_RES)
215
Dees_Troy51a0e822012-09-05 15:24:24 -0400216TWRP_RES_GEN := $(intermediates)/twrp
Ethan Yonker5c933692014-04-04 11:26:32 -0500217$(TWRP_RES_GEN):
Dees Troy3454ade2015-01-20 19:21:04 +0000218 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
thatd16b2ce2015-07-27 20:39:19 +0200219 cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees Troy3454ade2015-01-20 19:21:04 +0000220 cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400221
222LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
223LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Dees_Troy7d15c252012-09-05 20:47:21 -0400224include $(BUILD_PREBUILT)