From 64c2559577eeb9ce3bb46f808c340bebd4b07145 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 31 May 2023 21:45:09 +0000 Subject: [PATCH 1/2] Remove hwservicemanager and hidl allocator. ...from devices launching after Android V. Devices can add them back in explicitly now that they are also moved to system_ext. Test: m Bug: 218588089 Change-Id: Ib3c917896c7a9b2c5940922c9faddb44cc7a0766 --- core/product.mk | 7 +++++++ core/product_config.mk | 3 +++ target/product/base_system.mk | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/core/product.mk b/core/product.mk index 8f4db38038..c29cf8a878 100644 --- a/core/product.mk +++ b/core/product.mk @@ -43,6 +43,13 @@ _product_list_vars += PRODUCT_PACKAGES _product_list_vars += PRODUCT_PACKAGES_DEBUG _product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN _product_list_vars += PRODUCT_PACKAGES_ARM64 + +# packages that are added to PRODUCT_PACKAGES based on the PRODUCT_SHIPPING_API_LEVEL +# These are only added if the shipping API level is that level or lower +_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29 +_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_33 +_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34 + # Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true _product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE _product_list_vars += PRODUCT_PACKAGES_ENG diff --git a/core/product_config.mk b/core/product_config.mk index 3f9eb24ab2..ad13269b10 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -500,6 +500,9 @@ ifdef PRODUCT_SHIPPING_API_LEVEL ifneq (,$(call math_gt_or_eq,33,$(PRODUCT_SHIPPING_API_LEVEL))) PRODUCT_PACKAGES += $(PRODUCT_PACKAGES_SHIPPING_API_LEVEL_33) endif + ifneq (,$(call math_gt_or_eq,34,$(PRODUCT_SHIPPING_API_LEVEL))) + PRODUCT_PACKAGES += $(PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34) + endif endif # If build command defines OVERRIDE_PRODUCT_EXTRA_VNDK_VERSIONS, diff --git a/target/product/base_system.mk b/target/product/base_system.mk index a23fdd5fe9..65e9bd051c 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -19,7 +19,6 @@ PRODUCT_PACKAGES += \ abx \ adbd_system_api \ am \ - android.hidl.allocator@1.0-service \ android.hidl.base-V1.0-java \ android.hidl.manager-V1.0-java \ android.hidl.memory@1.0-impl \ @@ -109,7 +108,6 @@ PRODUCT_PACKAGES += \ gatekeeperd \ gpuservice \ hid \ - hwservicemanager \ idmap2 \ idmap2d \ ime \ @@ -302,6 +300,14 @@ PRODUCT_PACKAGES += \ system_manifest.xml \ system_compatibility_matrix.xml \ +HIDL_SUPPORT_SERVICES := \ + hwservicemanager \ + android.hidl.allocator@1.0-service \ + +# Base modules when shipping api level is less than or equal to 34 +PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34 += \ + $(HIDL_SUPPORT_SERVICES) \ + PRODUCT_PACKAGES_ARM64 := libclang_rt.hwasan \ libclang_rt.hwasan.bootstrap \ libc_hwasan \ From 7083a1c98e2402871268b629f054b106632d920b Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 28 Jun 2023 00:41:23 +0000 Subject: [PATCH 2/2] Add symlink to hwservicemanager The binary has moved from /system to /system_ext to allow devices to choose when to include it. Unfortunately libhidlbase looks for /system/bin/hwservicemanager to determine if it is present on the device. This library is available in /vendor so it may not be updated to look in /system_ext when flashing GSI or doing a system-only update. So we add this symlink to keep backwards compatbililty. Test: aosp_bramble_hwasan-userdebug boot test Bug: 218588089 Change-Id: I74b2c25f484556c5fa91a3c9b175362c09d082e1 --- core/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/Makefile b/core/Makefile index 46350f6b38..397b07d407 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3233,6 +3233,12 @@ ifdef BOARD_USES_SYSTEM_EXTIMAGE ALL_DEFAULT_INSTALLED_MODULES += $(_systemext_symlink) endif +# Create symlink /system/bin/hwservicemanager -> /system/system_ext/bin/hwservicemanager +# Old vendor libraries (like libhidlbase) may require /system/bin/hwservicemanager to be present +$(call symlink-file,$(TARGET_OUT_SYSTEM_EXT)/bin/hwservicemanager,/system/system_ext/bin/hwservicemanager, $(TARGET_OUT)/bin/hwservicemanager) +INTERNAL_SYSTEMIMAGE_FILES += \ + $(TARGET_OUT)/bin/hwservicemanager + # ----------------------------------------------------------------- # system_dlkm partition image