device_xiaomi_sweet/display/Android.mk
daniml3 d934151ef3 sweet: override the SetRefreshRate HWC builtin display function
* This function causes the refresh rate to change randomly, and
  produces flickering on the display

* Override the original function by renaming the symbol so linker
  uses the symbol from the shim instead of the original library's
  symbol

Signed-off-by: daniml3 <daniel@danielml.dev>
Change-Id: I2fa6b3f834df79c32d22f5a057da2108cc9cacab
2022-04-13 11:38:43 -04:00

25 lines
890 B
Makefile

LOCAL_PATH := $(call my-dir)
HWC := hwcomposer.$(TARGET_BOARD_PLATFORM)
LIBSDMCORE := $(TARGET_OUT_VENDOR)/lib64/libsdmcore.so
HWCOMPOSER := $(TARGET_OUT_VENDOR)/lib64/hw/$(HWC).so
ORIGINAL_SYMBOL := _ZN3sdm14DisplayBuiltIn14SetRefreshRateEjb
CUSTOM_SYMBOL := _ZN3sdm14DisplayBuiltIn14SetRefreshCustEjb
include $(CLEAR_VARS)
LOCAL_MODULE := libsdmcore-patch
LOCAL_PREBUILT_MODULE_FILE := /dev/null
LOCAL_MODULE_CLASS := ETC
LOCAL_VENDOR_MODULE := true
LOCAL_REQUIRED_MODULES := $(HWC) libsdmcore
LOCAL_POST_INSTALL_CMD := \
cp $(PRODUCT_OUT)/symbols/vendor/lib64/libsdmcore.so $(LIBSDMCORE) && \
cp $(PRODUCT_OUT)/symbols/vendor/lib64/hw/$(HWC).so $(HWCOMPOSER) && \
sed -i s/$(ORIGINAL_SYMBOL)/$(CUSTOM_SYMBOL)/g $(LIBSDMCORE) && \
sed -i s/libdisplaydebug/libsdmcore-shim/g $(HWCOMPOSER) && \
rm $(TARGET_OUT_VENDOR)/etc/$(LOCAL_MODULE)
include $(BUILD_PREBUILT)