android_system_core/libstats/socket_lazy/Android.bp
Tej Singh f9d87bd36f Create libstatssocket_lazy
Add lazy loading support to libstatssocket.

There are many clients of libstatssocket (lmkd, surfaceflinger,
bootanimation dependencies) that run before the statsd apex is mounted
and cannot link libstatssocket.so when the process starts. Lazy loading
will load the library when the logging apis get called.

This change is modeled heavily off of aosp/1570701, which added
libnativehelper_lazy.

Bug: 178480419
Test: atest libstatssocket_lazy_test
Change-Id: I57e6f698ad43dddc98dc787ba2fe888030c8a282
2021-03-15 20:27:56 -07:00

40 lines
No EOL
1 KiB
Text

// Lazy loading version of libstatssocket that can be used by code
// that is running before the statsd APEX is mounted and
// libstatssocket.so is available.
cc_library_static {
name: "libstatssocket_lazy",
header_libs: [
"libstatssocket_headers",
],
export_header_lib_headers: [
"libstatssocket_headers",
],
apex_available: ["//apex_available:platform"],
srcs: ["libstatssocket_lazy.cpp"],
}
cc_test {
name: "libstatssocket_lazy_test",
srcs: [
"tests/libstatssocket_lazy_test.cpp",
],
static_libs: ["libstatssocket_lazy"],
shared_libs: ["liblog"],
cflags: [
"-Wall",
"-Werror",
],
test_suites: ["device-tests", "mts-statsd"],
test_config: "libstatssocket_lazy_test.xml",
// TODO(b/153588990): Remove when the build system properly separates.
// 32bit and 64bit architectures.
compile_multilib: "both",
multilib: {
lib64: {
suffix: "64",
},
lib32: {
suffix: "32",
},
},
}