From 965d67ce6fc0200de62d28c24efae1350ef0e203 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 22 May 2023 18:14:40 +0000 Subject: [PATCH] vold: move some libs from shared to static These libraries are only used by vold on a device and gain no benifit from being included as shared libraries. Moving them to static saves disk space, memory, and cpu cycles from the dynamic linker. Checking on cuttlefish accross 3 reboots: This saves 613827 bytes of storage from the installed-files, 44KB of private dirty memory, 172KB of PSS when only looking at the libraries, and 155KB of PSS when looking at libraries and heap/stack with shomap. go/shared-to-static for more info on how this was determined. Test: m Bug: 280829178 Change-Id: I29af66dd66f4087ff1820ca661dc6dc2ace841fc --- Android.bp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Android.bp b/Android.bp index 1ccfc09..7e41f22 100644 --- a/Android.bp +++ b/Android.bp @@ -29,6 +29,9 @@ cc_defaults { name: "vold_default_libs", static_libs: [ + "android.hardware.health.storage@1.0", + "android.hardware.health.storage-V1-ndk", + "android.security.maintenance-ndk", "libasync_safe", "libavb", "libbootloader_message", @@ -47,10 +50,10 @@ cc_defaults { "libboot_control_client", "libbase", "libbinder", + "libbinder_ndk", "libcrypto", "libcrypto_utils", "libcutils", - "libdiskconfig", "libext4_utils", "libf2fs_sparseblock", "libgsi", @@ -58,6 +61,7 @@ cc_defaults { "libhardware_legacy", "libincfs", "libhidlbase", + "libkeymint_support", "libkeyutils", "liblog", "liblogwrap", @@ -160,13 +164,6 @@ cc_library_static { cppflags: ["-D__ANDROID_DEBUGGABLE__"], }, }, - shared_libs: [ - "android.hardware.health.storage@1.0", - "android.hardware.health.storage-V1-ndk", - "android.security.maintenance-ndk", - "libbinder_ndk", - "libkeymint_support", - ], whole_static_libs: [ "libcom.android.sysprop.apex", "libc++fs", @@ -182,7 +179,10 @@ cc_binary { ], srcs: ["main.cpp"], - static_libs: ["libvold"], + static_libs: [ + "libvold", + ], + init_rc: [ "vold.rc", ], @@ -193,14 +193,6 @@ cc_binary { "fuseMedia.o", ], - shared_libs: [ - "android.hardware.health.storage@1.0", - "android.hardware.health.storage-V1-ndk", - "android.security.maintenance-ndk", - "libbinder_ndk", - "libkeymint_support", - ], - product_variables: { arc: { exclude_srcs: [