From 5bf45276b75a9dc30b74a4dd1510d479cabb26eb Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Thu, 13 Oct 2016 13:24:39 +0100 Subject: [PATCH] charger: Use the same metrics as recovery to pick a density Change-Id: Ieb046c493ca3d367cff570bd08d38c84c74e5fbd --- charger/Android.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/charger/Android.mk b/charger/Android.mk index 0e3b1df0..f2bdde2d 100644 --- a/charger/Android.mk +++ b/charger/Android.mk @@ -1,5 +1,19 @@ LOCAL_PATH := $(call my-dir) +# Set healthd_density to the density bucket of the device. +healthd_density := unknown +ifneq (,$(TARGET_RECOVERY_DENSITY)) +healthd_density := $(filter %dpi,$(TARGET_RECOVERY_DENSITY)) +else +ifneq (,$(PRODUCT_AAPT_PREF_CONFIG)) +# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value. +healthd_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG)) +else +# Otherwise, use the default medium density. +healthd_density := mdpi +endif +endif + include $(CLEAR_VARS) LOCAL_SRC_FILES := healthd_board_cm.cpp LOCAL_MODULE := libhealthd.cm @@ -20,7 +34,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := font_log.png -LOCAL_SRC_FILES := fonts/$(PRODUCT_AAPT_PREF_CONFIG)/font_log.png +LOCAL_SRC_FILES := fonts/$(healthd_density)/font_log.png LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/res/images @@ -42,7 +56,7 @@ endef _img_modules := _images := -$(foreach _img, $(call find-subdir-subdir-files, "images/$(PRODUCT_AAPT_PREF_CONFIG)", "*.png"), \ +$(foreach _img, $(call find-subdir-subdir-files, "images/$(healthd_density)", "*.png"), \ $(eval $(call _add-charger-image,$(_img)))) include $(CLEAR_VARS)