libandroid_runtime & libhwui: use libstats*_lazy

Update libandroid_runtime and libhwui, both of which are dependencies of
bootanimation, to use listatssocket_lazy and libstatspull_lazy, which
are new static versions of libstatssocket and libstatspull. This means
that bootanimation does not depend on these libraries, which are shipped
from the statsd apex.

The change enables removing the statsd apex from the bootstrap apexes.

Test: m
Test: boots
Test: no fatal linker errors after removing statsd from the bootstrap
apexes
Bug: 178480419

Change-Id: I78f4abe71f4b3718bbd97522c16f1c5ab88f77ae
This commit is contained in:
Tej Singh
2021-03-18 16:19:55 -07:00
parent 9ad083d7ee
commit 78f65b6855
5 changed files with 73 additions and 43 deletions

View File

@@ -233,6 +233,7 @@ cc_library_shared {
"libseccomp_policy",
"libgrallocusage",
"libscrypt_static",
"libstatssocket_lazy",
],
shared_libs: [
@@ -296,11 +297,8 @@ cc_library_shared {
"libnativewindow",
"libdl",
"libdl_android",
"libstatslog",
"libstatssocket",
"libtimeinstate",
"server_configurable_flags",
"libstatspull",
],
export_shared_lib_headers: [
// our headers include libnativewindow's public headers

View File

@@ -87,8 +87,8 @@ cc_defaults {
cflags: [
"-Wno-unused-variable",
],
}
}
},
},
}
cc_defaults {
@@ -108,7 +108,6 @@ cc_defaults {
shared_libs: [
"liblog",
"libcutils",
"libstatslog",
"libutils",
"libEGL",
"libGLESv1_CM",
@@ -122,12 +121,13 @@ cc_defaults {
"libandroidfw",
"libcrypto",
"libsync",
"libstatspull",
"libstatssocket",
],
static_libs: [
"libEGL_blobCache",
"libprotoutil",
"libstatslog_hwui",
"libstatspull_lazy",
"libstatssocket_lazy",
],
},
host: {
@@ -135,8 +135,8 @@ cc_defaults {
"libandroidfw",
"libutils",
],
}
}
},
},
}
cc_defaults {
@@ -220,7 +220,7 @@ filegroup {
srcs: [
"apex/java/**/*.java",
],
path: "apex/java"
path: "apex/java",
}
// ------------------------
@@ -238,7 +238,7 @@ cc_library_headers {
windows: {
enabled: true,
},
}
},
}
cc_defaults {
@@ -263,7 +263,7 @@ cc_defaults {
"apex/android_region.cpp",
],
header_libs: [ "android_graphics_apex_headers" ],
header_libs: ["android_graphics_apex_headers"],
target: {
android: {
@@ -278,7 +278,7 @@ cc_defaults {
srcs: [
"apex/LayoutlibLoader.cpp",
],
}
},
},
}
@@ -297,7 +297,7 @@ cc_library_headers {
windows: {
enabled: true,
},
}
},
}
cc_defaults {
@@ -370,7 +370,7 @@ cc_defaults {
"jni/text/TextShaper.cpp",
],
header_libs: [ "android_graphics_jni_headers" ],
header_libs: ["android_graphics_jni_headers"],
include_dirs: [
"external/skia/include/private",
@@ -391,7 +391,10 @@ cc_defaults {
"libjpeg",
],
static_libs: ["libnativehelper_lazy", "libziparchive_for_incfs"],
static_libs: [
"libnativehelper_lazy",
"libziparchive_for_incfs",
],
target: {
android: {
@@ -417,13 +420,13 @@ cc_defaults {
"libmediandk",
"libnativedisplay",
"libnativewindow",
"libstatspull",
"libstatssocket",
"libpdfium",
],
static_libs: [
"libgif",
"libstatslog",
"libstatslog_hwui",
"libstatspull_lazy",
"libstatssocket_lazy",
],
},
host: {
@@ -434,10 +437,41 @@ cc_defaults {
static_libs: [
"libandroidfw",
],
}
},
},
}
cc_library_static {
name: "libstatslog_hwui",
generated_sources: ["statslog_hwui.cpp"],
generated_headers: ["statslog_hwui.h"],
export_generated_headers: ["statslog_hwui.h"],
static_libs: [
"libstatssocket_lazy",
"libstatspull_lazy",
],
}
genrule {
name: "statslog_hwui.h",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_hwui.h --module hwui" +
" --namespace android,uirenderer,stats",
out: [
"statslog_hwui.h",
],
}
genrule {
name: "statslog_hwui.cpp",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_hwui.cpp --module hwui" +
" --namespace android,uirenderer,stats --importHeader statslog_hwui.h",
out: [
"statslog_hwui.cpp",
],
}
// ------------------------
// library
// ------------------------
@@ -449,8 +483,8 @@ cc_library_headers {
export_include_dirs: [
".",
],
header_libs: [ "android_graphics_jni_headers" ],
export_header_lib_headers: [ "android_graphics_jni_headers" ],
header_libs: ["android_graphics_jni_headers"],
export_header_lib_headers: ["android_graphics_jni_headers"],
}
cc_defaults {
@@ -514,7 +548,7 @@ cc_defaults {
target: {
android: {
header_libs: ["libandroid_headers_private" ],
header_libs: ["libandroid_headers_private"],
srcs: [
"hwui/AnimatedImageThread.cpp",
@@ -572,8 +606,8 @@ cc_defaults {
export_static_lib_headers: [
"libarect",
],
}
}
},
},
}
cc_library {
@@ -589,7 +623,7 @@ cc_library {
target: {
android: {
version_script: "libhwui.map.txt",
}
},
},
}
@@ -608,10 +642,10 @@ cc_defaults {
target: {
android: {
shared_libs: [
"libgui",
"libui",
],
}
"libgui",
"libui",
],
},
},
srcs: [
"tests/common/scenes/*.cpp",
@@ -732,5 +766,5 @@ phony {
required: [
"hwuimicro",
"hwuimacro",
]
],
}

View File

@@ -20,7 +20,6 @@
#include <errno.h>
#include <inttypes.h>
#include <log/log.h>
#include <statslog.h>
#include <sys/mman.h>
#include <algorithm>

View File

@@ -24,10 +24,10 @@
#include <service/GraphicsStatsService.h>
#include <stats_event.h>
#include <stats_pull_atom_callback.h>
#include <statslog.h>
#include <statslog_hwui.h>
#include "android/graphics/jni_runtime.h"
#include "GraphicsJNI.h"
#include "android/graphics/jni_runtime.h"
namespace android {
@@ -161,14 +161,14 @@ static void nativeInit(JNIEnv* env, jobject javaObject) {
AStatsManager_PullAtomMetadata_setCoolDownMillis(metadata, 10); // 10 milliseconds
AStatsManager_PullAtomMetadata_setTimeoutMillis(metadata, 2 * MS_PER_SEC); // 2 seconds
AStatsManager_setPullAtomCallback(android::util::GRAPHICS_STATS, metadata,
&graphicsStatsPullCallback, nullptr);
AStatsManager_setPullAtomCallback(stats::GRAPHICS_STATS, metadata, &graphicsStatsPullCallback,
nullptr);
AStatsManager_PullAtomMetadata_release(metadata);
}
static void nativeDestructor(JNIEnv* env, jobject javaObject) {
AStatsManager_clearPullAtomCallback(android::util::GRAPHICS_STATS);
AStatsManager_clearPullAtomCallback(stats::GRAPHICS_STATS);
env->DeleteGlobalRef(gGraphicsStatsServiceObject);
gGraphicsStatsServiceObject = nullptr;
}

View File

@@ -16,20 +16,19 @@
#include "GraphicsStatsService.h"
#include <android/util/ProtoOutputStream.h>
#include <errno.h>
#include <fcntl.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <inttypes.h>
#include <log/log.h>
#include <stats_event.h>
#include <statslog_hwui.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <android/util/ProtoOutputStream.h>
#include <stats_event.h>
#include <statslog.h>
#include "JankTracker.h"
#include "protos/graphicsstats.pb.h"
@@ -539,7 +538,7 @@ void GraphicsStatsService::finishDumpInMemory(Dump* dump, AStatsEventList* data,
for (int stat_index = 0; stat_index < serviceDump.stats_size(); stat_index++) {
auto& stat = serviceDump.stats(stat_index);
AStatsEvent* event = AStatsEventList_addStatsEvent(data);
AStatsEvent_setAtomId(event, android::util::GRAPHICS_STATS);
AStatsEvent_setAtomId(event, stats::GRAPHICS_STATS);
AStatsEvent_writeString(event, stat.package_name().c_str());
AStatsEvent_writeInt64(event, (int64_t)stat.version_code());
AStatsEvent_writeInt64(event, (int64_t)stat.stats_start());