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

Commit 78f65b68 authored by Tej Singh's avatar Tej Singh
Browse files

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
parent 9ad083d7
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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
+63 −29
Original line number Diff line number Diff line
@@ -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 {
@@ -278,7 +278,7 @@ cc_defaults {
            srcs: [
                "apex/LayoutlibLoader.cpp",
            ],
        }
        },
    },
}

@@ -297,7 +297,7 @@ cc_library_headers {
        windows: {
            enabled: true,
        },
    }
    },
}

cc_defaults {
@@ -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,8 +437,39 @@ 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",
    ],
}

// ------------------------
@@ -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",
        }
        },
    },
}

@@ -611,7 +645,7 @@ cc_defaults {
                "libgui",
                "libui",
            ],
	}
        },
    },
    srcs: [
        "tests/common/scenes/*.cpp",
@@ -732,5 +766,5 @@ phony {
    required: [
        "hwuimicro",
        "hwuimacro",
    ]
    ],
}
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <errno.h>
#include <inttypes.h>
#include <log/log.h>
#include <statslog.h>
#include <sys/mman.h>

#include <algorithm>
+5 −5
Original line number Diff line number Diff line
@@ -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;
}
+4 −5
Original line number Diff line number Diff line
@@ -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());