Software codecs are required by mediacodec
vndk_package is a phony module that includes ALL VNDK libs found in the
source code. As a result, VNDK libs that were actually not needed for
the device have been installed consuming storage. For example,
/system/lib/vndk/android.hardware.automotive*.so files were installed
even though walleye/taimen do not have automotive HALs.
VNDK libs are now installed by their link time dependencies (i.e. if a
vendor module uses libcutils, then /system/lib[64]/vndk-sp/libcutils.so
is automatically installed.).
By the way, there is a few number of VNDK libs that do not have any
link time dependency from vendor modules. They are always opened via
dlopen. In such cases, the vndk modules are added to `required`
or `LOCAL_REQUIRED_MODULES` of the module that dlopens them.
Bug: 67002788
Test: walleye builds and boots to the UI
Test: basic functionalities work (sound, camera, camcorder, slow-mo,
youtube, wifi, bluetooth)
Change-Id: I52f9d58a3fdc2ad8fb7d9798f2c9f9162d002b5c
diff --git a/services/mediacodec/Android.mk b/services/mediacodec/Android.mk
index 8e5b260..97eaf77 100644
--- a/services/mediacodec/Android.mk
+++ b/services/mediacodec/Android.mk
@@ -1,5 +1,28 @@
LOCAL_PATH := $(call my-dir)
+_software_codecs := \
+ libstagefright_soft_aacdec \
+ libstagefright_soft_aacenc \
+ libstagefright_soft_amrdec \
+ libstagefright_soft_amrnbenc \
+ libstagefright_soft_amrwbenc \
+ libstagefright_soft_avcdec \
+ libstagefright_soft_avcenc \
+ libstagefright_soft_flacdec \
+ libstagefright_soft_flacenc \
+ libstagefright_soft_g711dec \
+ libstagefright_soft_gsmdec \
+ libstagefright_soft_hevcdec \
+ libstagefright_soft_mp3dec \
+ libstagefright_soft_mpeg2dec \
+ libstagefright_soft_mpeg4dec \
+ libstagefright_soft_mpeg4enc \
+ libstagefright_soft_opusdec \
+ libstagefright_soft_rawdec \
+ libstagefright_soft_vorbisdec \
+ libstagefright_soft_vpxdec \
+ libstagefright_soft_vpxenc \
+
# service executable
include $(CLEAR_VARS)
# seccomp is not required for coverage build.
@@ -27,6 +50,15 @@
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_VENDOR_MODULE := true
LOCAL_32_BIT_ONLY := true
+# Since this is 32-bit-only module, only 32-bit version of the codecs are installed.
+# TODO(b/72343507): eliminate the need for manually adding .vendor suffix. This should be done
+# by the build system.
+LOCAL_REQUIRED_MODULES := \
+$(foreach codec,$(_software_codecs),\
+ $(eval _vendor_suffix := $(if $(BOARD_VNDK_VERSION),.vendor))\
+ $(codec)$(_vendor_suffix)\
+)
+_software_codecs :=
LOCAL_INIT_RC := android.hardware.media.omx@1.0-service.rc
include $(BUILD_EXECUTABLE)