blob: 17defd953cbfbdbfef15d63b7bf231ab03acc279 [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
35ifneq ($(TWRP_CUSTOM_KEYBOARD),)
Ethan Yonker591b9202015-03-11 11:17:15 -050036 LOCAL_SRC_FILES += $(TWRP_CUSTOM_KEYBOARD)
Dees_Troy51a0e822012-09-05 15:24:24 -040037else
Ethan Yonker591b9202015-03-11 11:17:15 -050038 LOCAL_SRC_FILES += hardwarekeyboard.cpp
Dees_Troy51a0e822012-09-05 15:24:24 -040039endif
40
Ethan Yonker34ae4832016-08-24 15:32:18 -050041LOCAL_SHARED_LIBRARIES += libminuitwrp libc libstdc++ libminzip libaosprecovery libselinux
Dees_Troy2673cec2013-04-02 20:22:16 +000042LOCAL_MODULE := libguitwrp
Dees_Troy51a0e822012-09-05 15:24:24 -040043
Dees_Troy51a0e822012-09-05 15:24:24 -040044#TWRP_EVENT_LOGGING := true
45ifeq ($(TWRP_EVENT_LOGGING), true)
Ethan Yonker30fa3352015-03-09 13:57:21 -050046 LOCAL_CFLAGS += -D_EVENT_LOGGING
47endif
48ifneq ($(TW_USE_KEY_CODE_TOUCH_SYNC),)
49 LOCAL_CFLAGS += -DTW_USE_KEY_CODE_TOUCH_SYNC=$(TW_USE_KEY_CODE_TOUCH_SYNC)
Dees_Troy51a0e822012-09-05 15:24:24 -040050endif
51
bigbiff bigbiff87940362013-03-09 09:58:50 -050052ifneq ($(TW_NO_SCREEN_BLANK),)
Ethan Yonker591b9202015-03-11 11:17:15 -050053 LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
bigbiff bigbiff87940362013-03-09 09:58:50 -050054endif
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070055ifneq ($(TW_NO_SCREEN_TIMEOUT),)
Ethan Yonker591b9202015-03-11 11:17:15 -050056 LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT
Ricardo Gomezc9ecd442013-07-05 16:13:52 -070057endif
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040058ifeq ($(TW_OEM_BUILD), true)
Ethan Yonker83e82572014-04-04 10:59:28 -050059 LOCAL_CFLAGS += -DTW_OEM_BUILD
60endif
Ethan Yonker751a85e2014-12-12 16:59:10 -060061ifneq ($(TW_X_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050062 LOCAL_CFLAGS += -DTW_X_OFFSET=$(TW_X_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060063endif
64ifneq ($(TW_Y_OFFSET),)
Ethan Yonker591b9202015-03-11 11:17:15 -050065 LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
Ethan Yonker751a85e2014-12-12 16:59:10 -060066endif
James Christopher Adduonodcd1e442016-11-06 13:17:34 -050067ifneq ($(TW_W_OFFSET),)
68 LOCAL_CFLAGS += -DTW_W_OFFSET=$(TW_W_OFFSET)
69endif
70ifneq ($(TW_H_OFFSET),)
71 LOCAL_CFLAGS += -DTW_H_OFFSET=$(TW_H_OFFSET)
72endif
Ethan Yonker63e414f2015-02-06 15:44:39 -060073ifeq ($(TW_ROUND_SCREEN), true)
Ethan Yonker591b9202015-03-11 11:17:15 -050074 LOCAL_CFLAGS += -DTW_ROUND_SCREEN
bigbiff bigbiff163d4742013-11-16 13:25:27 -050075endif
76
Xing0af1ac12015-11-27 11:19:37 -080077LOCAL_C_INCLUDES += bionic system/core/libpixelflinger/include
78ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0)
79 LOCAL_C_INCLUDES += external/stlport/stlport
80endif
81
Dees Troy3454ade2015-01-20 19:21:04 +000082LOCAL_CFLAGS += -DTWRES=\"$(TWRES_PATH)\"
Dees_Troy51a0e822012-09-05 15:24:24 -040083
84include $(BUILD_STATIC_LIBRARY)
85
86# Transfer in the resources for the device
87include $(CLEAR_VARS)
88LOCAL_MODULE := twrp
89LOCAL_MODULE_TAGS := eng
90LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
Dees Troy3454ade2015-01-20 19:21:04 +000091LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -040092
Matt Mowerd4a11182017-01-18 20:06:36 -060093# The extra blank line before *** is intentional to ensure it ends up on its own line
94define TW_THEME_WARNING_MSG
95
96****************************************************************************
97 Could not find ui.xml for TW_THEME: $(TW_THEME)
98 Set TARGET_SCREEN_WIDTH and TARGET_SCREEN_HEIGHT to automatically select
99 an appropriate theme, or set TW_THEME to one of the following:
100 $(notdir $(wildcard $(commands_recovery_local_path)/gui/theme/*_*))
101****************************************************************************
102endef
103define TW_CUSTOM_THEME_WARNING_MSG
104
105****************************************************************************
106 Could not find ui.xml for TW_CUSTOM_THEME: $(TW_CUSTOM_THEME)
107 Expected to find cutom theme's ui.xml at:
108 $(TWRP_THEME_LOC)/ui.xml
109 Please fix this or set TW_THEME to one of the following:
110 $(notdir $(wildcard $(commands_recovery_local_path)/gui/theme/*_*))
111****************************************************************************
112endef
113
nkk716e4114f2017-01-19 16:56:07 +0200114TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts
115TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/languages
116ifeq ($(TW_EXTRA_LANGUAGES),true)
117 TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/fonts
118 TWRP_RES += $(commands_recovery_local_path)/gui/theme/extra-languages/languages
119endif
120
Ethan Yonker1ecaca72014-04-14 09:27:15 -0500121ifeq ($(TW_CUSTOM_THEME),)
Ethan Yonker591b9202015-03-11 11:17:15 -0500122 ifeq ($(TW_THEME),)
niks255d73903c2017-01-15 17:39:48 +0600123 ifeq ($(DEVICE_RESOLUTION),)
Matt Mowerd4a11182017-01-18 20:06:36 -0600124 GUI_WIDTH := $(TARGET_SCREEN_WIDTH)
125 GUI_HEIGHT := $(TARGET_SCREEN_HEIGHT)
126 else
127 SPLIT_DEVICE_RESOLUTION := $(subst x, ,$(DEVICE_RESOLUTION))
128 GUI_WIDTH := $(word 1, $(SPLIT_DEVICE_RESOLUTION))
129 GUI_HEIGHT := $(word 2, $(SPLIT_DEVICE_RESOLUTION))
niks255d73903c2017-01-15 17:39:48 +0600130 endif
Matt Mowerd4a11182017-01-18 20:06:36 -0600131
132 # Minimum resolution of 100x100
133 # This also ensures GUI_WIDTH and GUI_HEIGHT are numbers
134 ifeq ($(shell test $(GUI_WIDTH) -ge 100; echo $$?),0)
135 ifeq ($(shell test $(GUI_HEIGHT) -ge 100; echo $$?),0)
136 ifeq ($(shell test $(GUI_WIDTH) -gt $(GUI_HEIGHT); echo $$?),0)
137 ifeq ($(shell test $(GUI_WIDTH) -ge 1280; echo $$?),0)
138 TW_THEME := landscape_hdpi
139 else
140 TW_THEME := landscape_mdpi
141 endif
142 else ifeq ($(shell test $(GUI_WIDTH) -lt $(GUI_HEIGHT); echo $$?),0)
143 ifeq ($(shell test $(GUI_WIDTH) -ge 720; echo $$?),0)
144 TW_THEME := portrait_hdpi
145 else
146 TW_THEME := portrait_mdpi
147 endif
148 else ifeq ($(shell test $(GUI_WIDTH) -eq $(GUI_HEIGHT); echo $$?),0)
149 # watch_hdpi does not yet exist
150 TW_THEME := watch_mdpi
151 endif
152 endif
Ethan Yonker591b9202015-03-11 11:17:15 -0500153 endif
154 endif
bigbiffce8f83c2015-12-12 18:30:21 -0500155
nkk716e4114f2017-01-19 16:56:07 +0200156 TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME)
Matt Mowerd4a11182017-01-18 20:06:36 -0600157 ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
158 $(warning $(TW_THEME_WARNING_MSG))
159 $(error Theme selection failed; exiting)
160 endif
161
nkk716e4114f2017-01-19 16:56:07 +0200162 TWRP_RES += $(commands_recovery_local_path)/gui/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml
163 # for future copying of used include xmls and fonts:
164 # UI_XML := $(TWRP_THEME_LOC)/ui.xml
165 # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)
166 # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq)
167else
168 TWRP_THEME_LOC := $(TW_CUSTOM_THEME)
Matt Mowerd4a11182017-01-18 20:06:36 -0600169 ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),)
170 $(warning $(TW_CUSTOM_THEME_WARNING_MSG))
171 $(error Theme selection failed; exiting)
nkk716e4114f2017-01-19 16:56:07 +0200172 endif
thatd16b2ce2015-07-27 20:39:19 +0200173endif
Vojtech Bocek76ee9032014-09-07 15:01:56 +0200174
Matt Mowerd4a11182017-01-18 20:06:36 -0600175TWRP_RES += $(TW_ADDITIONAL_RES)
176
Dees_Troy51a0e822012-09-05 15:24:24 -0400177TWRP_RES_GEN := $(intermediates)/twrp
Ethan Yonker5c933692014-04-04 11:26:32 -0500178$(TWRP_RES_GEN):
Dees Troy3454ade2015-01-20 19:21:04 +0000179 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
thatd16b2ce2015-07-27 20:39:19 +0200180 cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees Troy3454ade2015-01-20 19:21:04 +0000181 cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
Dees_Troy51a0e822012-09-05 15:24:24 -0400182
183LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN)
184LOCAL_SRC_FILES := twrp $(TWRP_RES_GEN)
Dees_Troy7d15c252012-09-05 20:47:21 -0400185include $(BUILD_PREBUILT)