From 42c45e2b66790a7fe97acf7a300b025d79f2aa57 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 31 Jul 2018 09:37:12 -0700 Subject: Dynamically load device-specific recovery UI lib. We used to statically link the device-specific recovery UI extension (`TARGET_RECOVERY_UI_LIB`) into `recovery`. Such a logic can't be easily migrated to Soong, as modules specified by `TARGET_RECOVERY_UI_LIB` may not be built with Soong. Instead of porting all the device-specific codes over, this CL builds and installs the UI lib as a shared library with Android.mk. `recovery` dlopen(3)'s and dlsym(3)'s `make_device` to invoke the device-specific UI lib on start. Note that in order to make dlopen(3) actually working, we have to switch `recovery` to be dynamically linked (we will make the move later anyway). Bug: 110380063 Test: Build and boot into marlin recovery image. Check that device-specific recovery UI is successfully loaded. Change-Id: Ia9861c7559a95f3f50676534540c0cb87cae4574 --- device.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'device.h') diff --git a/device.h b/device.h index cbecc4371..a6ad62788 100644 --- a/device.h +++ b/device.h @@ -119,8 +119,12 @@ class Device { std::unique_ptr ui_; }; +// Disable name mangling, as this function will be loaded via dlsym(3). +extern "C" { + // The device-specific library must define this function (or the default one will be used, if there // is no device-specific library). It returns the Device object that recovery should use. Device* make_device(); +} #endif // _DEVICE_H -- cgit v1.2.3