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

Commit ddd3da0d authored by Jayant Chowdhary's avatar Jayant Chowdhary
Browse files

Add AIDL HAL stack traces to bug-reports



Bug: 233130219

Test: adb bugreport; check that camera provider has stack traces in VM
      traces

Ignore-AOSP-First: I will cherry-pick after the topic is submitted.

Change-Id: I1e087600ac764191a91eb9b1f11e51f21bce19e3
Signed-off-by: default avatarJayant Chowdhary <jchowdhary@google.com>
parent 2b9326b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2084,7 +2084,7 @@ Dumpstate::RunStatus Dumpstate::DumpTraces(const char** path) {
    int timeout_failures = 0;
    int timeout_failures = 0;
    bool dalvik_found = false;
    bool dalvik_found = false;


    const std::set<int> hal_pids = get_interesting_hal_pids();
    const std::set<int> hal_pids = get_interesting_pids();


    struct dirent* d;
    struct dirent* d;
    while ((d = readdir(proc.get()))) {
    while ((d = readdir(proc.get()))) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -65,6 +65,7 @@ class ServiceManagerMock : public IServiceManager {
                                             const sp<LocalRegistrationCallback>&));
                                             const sp<LocalRegistrationCallback>&));
    MOCK_METHOD2(unregisterForNotifications, status_t(const String16&,
    MOCK_METHOD2(unregisterForNotifications, status_t(const String16&,
                                             const sp<LocalRegistrationCallback>&));
                                             const sp<LocalRegistrationCallback>&));
    MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>());
  protected:
  protected:
    MOCK_METHOD0(onAsBinder, IBinder*());
    MOCK_METHOD0(onAsBinder, IBinder*());
};
};
+19 −0
Original line number Original line Diff line number Diff line
@@ -99,6 +99,8 @@ public:


    status_t unregisterForNotifications(const String16& service,
    status_t unregisterForNotifications(const String16& service,
                                        const sp<AidlRegistrationCallback>& cb) override;
                                        const sp<AidlRegistrationCallback>& cb) override;

    std::vector<IServiceManager::ServiceDebugInfo> getServiceDebugInfo() override;
    // for legacy ABI
    // for legacy ABI
    const String16& getInterfaceDescriptor() const override {
    const String16& getInterfaceDescriptor() const override {
        return mTheRealServiceManager->getInterfaceDescriptor();
        return mTheRealServiceManager->getInterfaceDescriptor();
@@ -543,6 +545,23 @@ status_t ServiceManagerShim::unregisterForNotifications(const String16& name,
    return OK;
    return OK;
}
}


std::vector<IServiceManager::ServiceDebugInfo> ServiceManagerShim::getServiceDebugInfo() {
    std::vector<os::ServiceDebugInfo> serviceDebugInfos;
    std::vector<IServiceManager::ServiceDebugInfo> ret;
    if (Status status = mTheRealServiceManager->getServiceDebugInfo(&serviceDebugInfos);
        !status.isOk()) {
        ALOGW("%s Failed to get ServiceDebugInfo", __FUNCTION__);
        return ret;
    }
    for (const auto& serviceDebugInfo : serviceDebugInfos) {
        IServiceManager::ServiceDebugInfo retInfo;
        retInfo.pid = serviceDebugInfo.debugPid;
        retInfo.name = serviceDebugInfo.name;
        ret.emplace_back(retInfo);
    }
    return ret;
}

#ifndef __ANDROID__
#ifndef __ANDROID__
// ServiceManagerShim for host. Implements the old libbinder android::IServiceManager API.
// ServiceManagerShim for host. Implements the old libbinder android::IServiceManager API.
// The internal implementation of the AIDL interface android::os::IServiceManager calls into
// The internal implementation of the AIDL interface android::os::IServiceManager calls into
+6 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,12 @@ public:


    virtual status_t unregisterForNotifications(const String16& name,
    virtual status_t unregisterForNotifications(const String16& name,
                                                const sp<LocalRegistrationCallback>& callback) = 0;
                                                const sp<LocalRegistrationCallback>& callback) = 0;

    struct ServiceDebugInfo {
        std::string name;
        int pid;
    };
    virtual std::vector<ServiceDebugInfo> getServiceDebugInfo() = 0;
};
};


sp<IServiceManager> defaultServiceManager();
sp<IServiceManager> defaultServiceManager();
+5 −1
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ cc_library {


    shared_libs: [
    shared_libs: [
        "libbase",
        "libbase",
        "libbinder",
        "libhidlbase",
        "libhidlbase",
        "liblog",
        "liblog",
        "libutils",
        "libutils",
@@ -33,7 +34,10 @@ cc_library {


    srcs: ["dump_utils.cpp"],
    srcs: ["dump_utils.cpp"],


    cflags: ["-Wall", "-Werror"],
    cflags: [
        "-Wall",
        "-Werror",
    ],


    export_include_dirs: [
    export_include_dirs: [
        "include",
        "include",
Loading