Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 1 | LOCAL_PATH := $(call my-dir) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 2 | |
| 3 | # Transfer in the resources for the device |
| 4 | include $(CLEAR_VARS) |
| 5 | LOCAL_MODULE := twrp |
bigbiff | d58ba18 | 2020-03-23 10:02:29 -0400 | [diff] [blame] | 6 | LOCAL_MODULE_TAGS := optional |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 7 | LOCAL_MODULE_CLASS := DATA |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 8 | LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 9 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 10 | # The extra blank line before *** is intentional to ensure it ends up on its own line |
| 11 | define TW_THEME_WARNING_MSG |
| 12 | |
| 13 | **************************************************************************** |
| 14 | Could not find ui.xml for TW_THEME: $(TW_THEME) |
| 15 | Set TARGET_SCREEN_WIDTH and TARGET_SCREEN_HEIGHT to automatically select |
| 16 | an appropriate theme, or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 17 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 18 | **************************************************************************** |
| 19 | endef |
| 20 | define TW_CUSTOM_THEME_WARNING_MSG |
| 21 | |
| 22 | **************************************************************************** |
| 23 | Could not find ui.xml for TW_CUSTOM_THEME: $(TW_CUSTOM_THEME) |
Matt Mower | 0c00571 | 2017-02-12 13:10:08 -0600 | [diff] [blame] | 24 | Expected to find custom theme's ui.xml at: |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 25 | $(TWRP_THEME_LOC)/ui.xml |
| 26 | Please fix this or set TW_THEME to one of the following: |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 27 | $(notdir $(wildcard $(LOCAL_PATH)/theme/*_*)) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 28 | **************************************************************************** |
| 29 | endef |
| 30 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 31 | TWRP_RES := $(LOCAL_PATH)/theme/common/fonts |
| 32 | TWRP_RES += $(LOCAL_PATH)/theme/common/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 33 | ifeq ($(TW_EXTRA_LANGUAGES),true) |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 34 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/fonts |
| 35 | TWRP_RES += $(LOCAL_PATH)/theme/extra-languages/languages |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 36 | endif |
| 37 | |
Ethan Yonker | 1ecaca7 | 2014-04-14 09:27:15 -0500 | [diff] [blame] | 38 | ifeq ($(TW_CUSTOM_THEME),) |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 39 | ifeq ($(TW_THEME),) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 40 | ifeq ($(DEVICE_RESOLUTION),) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 41 | GUI_WIDTH := $(TARGET_SCREEN_WIDTH) |
| 42 | GUI_HEIGHT := $(TARGET_SCREEN_HEIGHT) |
| 43 | else |
| 44 | SPLIT_DEVICE_RESOLUTION := $(subst x, ,$(DEVICE_RESOLUTION)) |
| 45 | GUI_WIDTH := $(word 1, $(SPLIT_DEVICE_RESOLUTION)) |
| 46 | GUI_HEIGHT := $(word 2, $(SPLIT_DEVICE_RESOLUTION)) |
niks255 | d73903c | 2017-01-15 17:39:48 +0600 | [diff] [blame] | 47 | endif |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 48 | |
| 49 | # Minimum resolution of 100x100 |
| 50 | # This also ensures GUI_WIDTH and GUI_HEIGHT are numbers |
| 51 | ifeq ($(shell test $(GUI_WIDTH) -ge 100; echo $$?),0) |
| 52 | ifeq ($(shell test $(GUI_HEIGHT) -ge 100; echo $$?),0) |
| 53 | ifeq ($(shell test $(GUI_WIDTH) -gt $(GUI_HEIGHT); echo $$?),0) |
| 54 | ifeq ($(shell test $(GUI_WIDTH) -ge 1280; echo $$?),0) |
| 55 | TW_THEME := landscape_hdpi |
| 56 | else |
| 57 | TW_THEME := landscape_mdpi |
| 58 | endif |
| 59 | else ifeq ($(shell test $(GUI_WIDTH) -lt $(GUI_HEIGHT); echo $$?),0) |
| 60 | ifeq ($(shell test $(GUI_WIDTH) -ge 720; echo $$?),0) |
| 61 | TW_THEME := portrait_hdpi |
| 62 | else |
| 63 | TW_THEME := portrait_mdpi |
| 64 | endif |
| 65 | else ifeq ($(shell test $(GUI_WIDTH) -eq $(GUI_HEIGHT); echo $$?),0) |
| 66 | # watch_hdpi does not yet exist |
| 67 | TW_THEME := watch_mdpi |
| 68 | endif |
| 69 | endif |
Ethan Yonker | 591b920 | 2015-03-11 11:17:15 -0500 | [diff] [blame] | 70 | endif |
| 71 | endif |
bigbiff | ce8f83c | 2015-12-12 18:30:21 -0500 | [diff] [blame] | 72 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 73 | TWRP_THEME_LOC := $(LOCAL_PATH)/theme/$(TW_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 74 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 75 | $(warning $(TW_THEME_WARNING_MSG)) |
| 76 | $(error Theme selection failed; exiting) |
| 77 | endif |
| 78 | |
Ethan Yonker | 58f2132 | 2018-08-24 11:17:36 -0500 | [diff] [blame] | 79 | TWRP_RES += $(LOCAL_PATH)/theme/common/$(word 1,$(subst _, ,$(TW_THEME))).xml |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 80 | # for future copying of used include xmls and fonts: |
| 81 | # UI_XML := $(TWRP_THEME_LOC)/ui.xml |
| 82 | # TWRP_INCLUDE_XMLS := $(shell xmllint --xpath '/recovery/include/xmlfile/@name' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq) |
| 83 | # TWRP_FONTS_TTF := $(shell xmllint --xpath '/recovery/resources/font/@filename' $(UI_XML)|sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1\n/gp'|sort|uniq)niq) |
| 84 | else |
| 85 | TWRP_THEME_LOC := $(TW_CUSTOM_THEME) |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 86 | ifeq ($(wildcard $(TWRP_THEME_LOC)/ui.xml),) |
| 87 | $(warning $(TW_CUSTOM_THEME_WARNING_MSG)) |
| 88 | $(error Theme selection failed; exiting) |
nkk71 | 6e4114f | 2017-01-19 16:56:07 +0200 | [diff] [blame] | 89 | endif |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 90 | endif |
Vojtech Bocek | 76ee903 | 2014-09-07 15:01:56 +0200 | [diff] [blame] | 91 | |
Matt Mower | d4a1118 | 2017-01-18 20:06:36 -0600 | [diff] [blame] | 92 | TWRP_RES += $(TW_ADDITIONAL_RES) |
| 93 | |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 94 | TWRP_RES_GEN := $(intermediates)/twrp |
Ethan Yonker | 5c93369 | 2014-04-04 11:26:32 -0500 | [diff] [blame] | 95 | $(TWRP_RES_GEN): |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 96 | mkdir -p $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
that | d16b2ce | 2015-07-27 20:39:19 +0200 | [diff] [blame] | 97 | cp -fr $(TWRP_RES) $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees Troy | 3454ade | 2015-01-20 19:21:04 +0000 | [diff] [blame] | 98 | cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH) |
Dees_Troy | 51a0e82 | 2012-09-05 15:24:24 -0400 | [diff] [blame] | 99 | |
| 100 | LOCAL_GENERATED_SOURCES := $(TWRP_RES_GEN) |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 101 | #LOCAL_SRC_FILES := twrp |
| 102 | LOCAL_SRC_FILES := $(TWRP_RES_GEN) |
| 103 | $(warning LOCAL_SRC_FILES: $(LOCAL_SRC_FILES)) |
Dees_Troy | 7d15c25 | 2012-09-05 20:47:21 -0400 | [diff] [blame] | 104 | include $(BUILD_PREBUILT) |