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

Commit 65ca53fb authored by Devin Moore's avatar Devin Moore
Browse files

cameraserver: 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 1632KB of
storage space from installed files, 224KB private dirty memory,
1498KB PSS from libraries/binary only, and 1511KB PSS from everything in showmap.

go/shared-to-static for more info on how this was determined.

Test: m
Bug: 280829178

Change-Id: I4c32327a1a6c4afe8bef15874ba8b9a3ea7fc854
parent 18d345ab
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -26,12 +26,15 @@ cc_binary {

    srcs: ["main_cameraserver.cpp"],

    defaults: [
        "libcameraservice_deps",
    ],

    header_libs: [
        "libmedia_headers",
    ],

    shared_libs: [
        "libcameraservice",
        "liblog",
        "libutils",
        "libui",
@@ -40,15 +43,13 @@ cc_binary {
        "libbinder_ndk",
        "libhidlbase",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
        "android.hardware.camera.provider@2.7",
        "android.hardware.camera.provider-V2-ndk",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.4",
    ],
    static_libs: [
        "libcameraservice",
    ],
    compile_multilib: "first",
    cflags: [
        "-Wall",
+81 −68
Original line number Diff line number Diff line
@@ -35,9 +35,89 @@ license {
    ],
}

cc_library_shared {
cc_defaults {
    name: "libcameraservice_deps",

    shared_libs: [
        "libactivitymanager_aidl",
        "libbase",
        "libdl",
        "libui",
        "liblog",
        "libutilscallstack",
        "libutils",
        "libbinder",
        "libbinder_ndk",
        "libactivitymanager_aidl",
        "libpermission",
        "libcutils",
        "libexif",
        "libmedia",
        "libmediautils",
        "libcamera_client",
        "libcamera_metadata",
        "libfmq",
        "libgui",
        "libhardware",
        "libhidlbase",
        "libimage_io",
        "libjpeg",
        "libultrahdr",
        "libmedia_codeclist",
        "libmedia_omx",
        "libmemunreachable",
        "libsensorprivacy",
        "libstagefright",
        "libstagefright_foundation",
        "libxml2",
        "libyuv",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.device@3.6",
        "android.hardware.camera.device@3.7",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "android.hardware.graphics.common-V4-ndk",
        "media_permission-aidl-cpp",
    ],

    static_libs: [
        "android.frameworks.cameraservice.common@2.0",
        "android.frameworks.cameraservice.service@2.0",
        "android.frameworks.cameraservice.service@2.1",
        "android.frameworks.cameraservice.service@2.2",
        "android.frameworks.cameraservice.device@2.0",
        "android.frameworks.cameraservice.device@2.1",
        "android.frameworks.cameraservice.common-V1-ndk",
        "android.frameworks.cameraservice.service-V1-ndk",
        "android.frameworks.cameraservice.device-V1-ndk",
        "android.hardware.camera.common-V1-ndk",
        "android.hardware.camera.device-V2-ndk",
        "android.hardware.camera.metadata-V2-ndk",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
        "android.hardware.camera.provider@2.7",
        "android.hardware.camera.provider-V2-ndk",
        "libaidlcommonsupport",
        "libdynamic_depth",
        "libprocessinfoservice_aidl",
        "libbinderthreadstateutils",
        "media_permission-aidl-cpp",
        "libcameraservice_device_independent",
    ],
}

cc_library {
    name: "libcameraservice",

    defaults: [
        "libcameraservice_deps",
    ],
    // Camera service source

    srcs: [
@@ -119,73 +199,6 @@ cc_library_shared {
        "libmediametrics_headers",
    ],

    shared_libs: [
        "libactivitymanager_aidl",
        "libbase",
        "libdl",
        "libexif",
        "libui",
        "liblog",
        "libutilscallstack",
        "libutils",
        "libbinder",
        "libbinder_ndk",
        "libactivitymanager_aidl",
        "libpermission",
        "libcutils",
        "libmedia",
        "libmediautils",
        "libcamera_client",
        "libcamera_metadata",
        "libdynamic_depth",
        "libfmq",
        "libgui",
        "libhardware",
        "libhidlbase",
        "libimage_io",
        "libjpeg",
        "libultrahdr",
        "libmedia_codeclist",
        "libmedia_omx",
        "libmemunreachable",
        "libsensorprivacy",
        "libstagefright",
        "libstagefright_foundation",
        "libxml2",
        "libyuv",
        "android.frameworks.cameraservice.common@2.0",
        "android.frameworks.cameraservice.service@2.0",
        "android.frameworks.cameraservice.service@2.1",
        "android.frameworks.cameraservice.service@2.2",
        "android.frameworks.cameraservice.device@2.0",
        "android.frameworks.cameraservice.device@2.1",
        "android.frameworks.cameraservice.common-V1-ndk",
        "android.frameworks.cameraservice.service-V1-ndk",
        "android.frameworks.cameraservice.device-V1-ndk",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
        "android.hardware.camera.provider@2.7",
        "android.hardware.camera.provider-V2-ndk",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.3",
        "android.hardware.camera.device@3.4",
        "android.hardware.camera.device@3.5",
        "android.hardware.camera.device@3.6",
        "android.hardware.camera.device@3.7",
        "android.hardware.camera.device-V2-ndk",
        "media_permission-aidl-cpp",
    ],

    static_libs: [
        "libaidlcommonsupport",
        "libprocessinfoservice_aidl",
        "libbinderthreadstateutils",
        "media_permission-aidl-cpp",
        "libcameraservice_device_independent",
    ],

    export_shared_lib_headers: [
        "libbinder",
        "libactivitymanager_aidl",
+10 −6
Original line number Diff line number Diff line
@@ -31,11 +31,14 @@ cc_test {
        "libmedia_headers",
    ],

    defaults: [
        "libcameraservice_deps",
    ],

    shared_libs: [
        "libbase",
        "libbinder",
        "libcutils",
        "libcameraservice",
        "libhidlbase",
        "liblog",
        "libcamera_client",
@@ -45,11 +48,6 @@ cc_test {
        "libjpeg",
        "libexif",
        "android.hardware.camera.common@1.0",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
        "android.hardware.camera.provider@2.7",
        "android.hardware.camera.provider-V2-ndk",
        "android.hardware.camera.device@1.0",
        "android.hardware.camera.device@3.2",
        "android.hardware.camera.device@3.4",
@@ -58,6 +56,12 @@ cc_test {
    ],

    static_libs: [
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
        "android.hardware.camera.provider@2.7",
        "android.hardware.camera.provider-V2-ndk",
        "libcameraservice",
        "libgmock",
    ],