surfaceflinger: move some libs from shared to static
These libraries are only used by this process 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.
With 3 reboots before and after I'm seeing average savings of 398885 bytes of storage space from installed files, 60KB private dirty memory, 403KB PSS from libraries/binary only, and 780KB PSS from everything in showmap.
go/shared-to-static for more info on how this was determined.
Test: m
Bug: 280829178
Change-Id: Iafe01db89d55fe579b7c97832b0ed45298a424c4
diff --git a/services/surfaceflinger/TimeStats/Android.bp b/services/surfaceflinger/TimeStats/Android.bp
index 4686eed..c3141be 100644
--- a/services/surfaceflinger/TimeStats/Android.bp
+++ b/services/surfaceflinger/TimeStats/Android.bp
@@ -7,14 +7,9 @@
default_applicable_licenses: ["frameworks_native_license"],
}
-cc_library {
- name: "libtimestats",
- srcs: [
- "TimeStats.cpp",
- ],
- header_libs: [
- "libscheduler_headers",
- ],
+cc_defaults {
+ name: "libtimestats_deps",
+
shared_libs: [
"android.hardware.graphics.composer@2.4",
"libbase",
@@ -22,17 +17,34 @@
"liblog",
"libprotobuf-cpp-lite",
"libtimestats_atoms_proto",
- "libtimestats_proto",
"libui",
"libutils",
],
+
+ static_libs: [
+ "libtimestats_proto",
+ ],
+
+ export_static_lib_headers: [
+ "libtimestats_proto",
+ ],
+}
+
+cc_library {
+ name: "libtimestats",
+ defaults: [
+ "libtimestats_deps",
+ ],
+ srcs: [
+ "TimeStats.cpp",
+ ],
+ header_libs: [
+ "libscheduler_headers",
+ ],
export_include_dirs: ["."],
export_header_lib_headers: [
"libscheduler_headers",
],
- export_shared_lib_headers: [
- "libtimestats_proto",
- ],
cppflags: [
"-Wall",
"-Werror",