Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1889805 authored by Devin Moore's avatar Devin Moore
Browse files

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
parent bedc9fe9
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -23,7 +23,7 @@ package {
    default_applicable_licenses: ["frameworks_native_license"],
    default_applicable_licenses: ["frameworks_native_license"],
}
}


cc_library_shared {
cc_library_static {
    name: "libdisplayservicehidl",
    name: "libdisplayservicehidl",


    srcs: [
    srcs: [
@@ -37,18 +37,24 @@ cc_library_shared {
        "libgui",
        "libgui",
        "libhidlbase",
        "libhidlbase",
        "libutils",
        "libutils",
    ],

    static_libs: [
        "android.frameworks.displayservice@1.0",
        "android.frameworks.displayservice@1.0",
    ],
    ],


    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "android.frameworks.displayservice@1.0",
        "libgui",
        "libgui",
        "libutils",
        "libutils",
    ],
    ],


    export_static_lib_headers: [
        "android.frameworks.displayservice@1.0",
    ],

    cflags: [
    cflags: [
        "-Werror",
        "-Werror",
        "-Wall",
        "-Wall",
    ]
    ],
}
}
+6 −5
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ cc_defaults {
    defaults: [
    defaults: [
        "android.hardware.graphics.composer3-ndk_shared",
        "android.hardware.graphics.composer3-ndk_shared",
        "librenderengine_deps",
        "librenderengine_deps",
        "libtimestats_deps",
        "surfaceflinger_defaults",
        "surfaceflinger_defaults",
    ],
    ],
    cflags: [
    cflags: [
@@ -58,14 +59,12 @@ cc_defaults {
        "libGLESv2",
        "libGLESv2",
        "libgui",
        "libgui",
        "libhidlbase",
        "libhidlbase",
        "liblayers_proto",
        "liblog",
        "liblog",
        "libnativewindow",
        "libnativewindow",
        "libpowermanager",
        "libpowermanager",
        "libprocessgroup",
        "libprocessgroup",
        "libprotobuf-cpp-lite",
        "libprotobuf-cpp-lite",
        "libsync",
        "libsync",
        "libtimestats",
        "libui",
        "libui",
        "libinput",
        "libinput",
        "libutils",
        "libutils",
@@ -77,11 +76,13 @@ cc_defaults {
        "libcompositionengine",
        "libcompositionengine",
        "libframetimeline",
        "libframetimeline",
        "libgui_aidl_static",
        "libgui_aidl_static",
        "liblayers_proto",
        "libperfetto_client_experimental",
        "libperfetto_client_experimental",
        "librenderengine",
        "librenderengine",
        "libscheduler",
        "libscheduler",
        "libserviceutils",
        "libserviceutils",
        "libshaders",
        "libshaders",
        "libtimestats",
        "libtonemap",
        "libtonemap",
    ],
    ],
    header_libs: [
    header_libs: [
@@ -95,6 +96,7 @@ cc_defaults {
        "libcompositionengine",
        "libcompositionengine",
        "librenderengine",
        "librenderengine",
        "libserviceutils",
        "libserviceutils",
        "libtimestats",
    ],
    ],
    export_shared_lib_headers: [
    export_shared_lib_headers: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
@@ -106,7 +108,6 @@ cc_defaults {
        "android.hardware.graphics.composer@2.4",
        "android.hardware.graphics.composer@2.4",
        "libpowermanager",
        "libpowermanager",
        "libhidlbase",
        "libhidlbase",
        "libtimestats",
    ],
    ],
    // TODO (marissaw): this library is not used by surfaceflinger. This is here so
    // TODO (marissaw): this library is not used by surfaceflinger. This is here so
    // the library compiled in a way that is accessible to system partition when running
    // the library compiled in a way that is accessible to system partition when running
@@ -213,14 +214,12 @@ cc_defaults {
        "-DLOG_TAG=\"SurfaceFlinger\"",
        "-DLOG_TAG=\"SurfaceFlinger\"",
    ],
    ],
    shared_libs: [
    shared_libs: [
        "android.frameworks.displayservice@1.0",
        "android.hardware.configstore-utils",
        "android.hardware.configstore-utils",
        "android.hardware.configstore@1.0",
        "android.hardware.configstore@1.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@3.0",
        "android.hardware.graphics.allocator@3.0",
        "libbinder",
        "libbinder",
        "libcutils",
        "libcutils",
        "libdisplayservicehidl",
        "libhidlbase",
        "libhidlbase",
        "liblog",
        "liblog",
        "libprocessgroup",
        "libprocessgroup",
@@ -228,6 +227,8 @@ cc_defaults {
        "libutils",
        "libutils",
    ],
    ],
    static_libs: [
    static_libs: [
        "android.frameworks.displayservice@1.0",
        "libdisplayservicehidl",
        "libserviceutils",
        "libserviceutils",
    ],
    ],
}
}
+3 −2
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@ cc_defaults {
    defaults: [
    defaults: [
        "android.hardware.graphics.composer3-ndk_shared",
        "android.hardware.graphics.composer3-ndk_shared",
        "librenderengine_deps",
        "librenderengine_deps",
        "libtimestats_deps",
        "surfaceflinger_defaults",
        "surfaceflinger_defaults",
    ],
    ],
    cflags: [
    cflags: [
@@ -30,18 +31,18 @@ cc_defaults {
        "libbase",
        "libbase",
        "libcutils",
        "libcutils",
        "libgui",
        "libgui",
        "liblayers_proto",
        "liblog",
        "liblog",
        "libnativewindow",
        "libnativewindow",
        "libprotobuf-cpp-lite",
        "libprotobuf-cpp-lite",
        "libSurfaceFlingerProp",
        "libSurfaceFlingerProp",
        "libtimestats",
        "libui",
        "libui",
        "libutils",
        "libutils",
    ],
    ],
    static_libs: [
    static_libs: [
        "liblayers_proto",
        "libmath",
        "libmath",
        "librenderengine",
        "librenderengine",
        "libtimestats",
        "libtonemap",
        "libtonemap",
        "libaidlcommonsupport",
        "libaidlcommonsupport",
        "libprocessgroup",
        "libprocessgroup",
+24 −12
Original line number Original line Diff line number Diff line
@@ -7,14 +7,9 @@ package {
    default_applicable_licenses: ["frameworks_native_license"],
    default_applicable_licenses: ["frameworks_native_license"],
}
}


cc_library {
cc_defaults {
    name: "libtimestats",
    name: "libtimestats_deps",
    srcs: [

        "TimeStats.cpp",
    ],
    header_libs: [
        "libscheduler_headers",
    ],
    shared_libs: [
    shared_libs: [
        "android.hardware.graphics.composer@2.4",
        "android.hardware.graphics.composer@2.4",
        "libbase",
        "libbase",
@@ -22,17 +17,34 @@ cc_library {
        "liblog",
        "liblog",
        "libprotobuf-cpp-lite",
        "libprotobuf-cpp-lite",
        "libtimestats_atoms_proto",
        "libtimestats_atoms_proto",
        "libtimestats_proto",
        "libui",
        "libui",
        "libutils",
        "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_include_dirs: ["."],
    export_header_lib_headers: [
    export_header_lib_headers: [
        "libscheduler_headers",
        "libscheduler_headers",
    ],
    ],
    export_shared_lib_headers: [
        "libtimestats_proto",
    ],
    cppflags: [
    cppflags: [
        "-Wall",
        "-Wall",
        "-Werror",
        "-Werror",