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

Commit c7095185 authored by Kweku Adams's avatar Kweku Adams Committed by android-build-merger
Browse files

Merge "Dumping stack traces to proto." into pi-dev

am: 09ed26a0

Change-Id: I549bdaa5f38cf0bb5a630cecf20b10eb35295120
parents d02c6b7f 09ed26a0
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -813,6 +813,7 @@ gensrcs {
    ],
    ],


    srcs: [
    srcs: [
        "core/proto/android/os/backtrace.proto",
        "core/proto/android/os/batterytype.proto",
        "core/proto/android/os/batterytype.proto",
        "core/proto/android/os/cpufreq.proto",
        "core/proto/android/os/cpufreq.proto",
        "core/proto/android/os/cpuinfo.proto",
        "core/proto/android/os/cpuinfo.proto",
+8 −2
Original line number Original line Diff line number Diff line
@@ -15,8 +15,10 @@
LOCAL_PATH:= $(call my-dir)
LOCAL_PATH:= $(call my-dir)


# proto files used in incidentd to generate cppstream proto headers.
# proto files used in incidentd to generate cppstream proto headers.
PROTO_FILES:= frameworks/base/core/proto/android/util/log.proto \
PROTO_FILES:= \
        frameworks/base/core/proto/android/os/data.proto
        frameworks/base/core/proto/android/os/backtrace.proto \
        frameworks/base/core/proto/android/os/data.proto \
        frameworks/base/core/proto/android/util/log.proto


# ========= #
# ========= #
# incidentd #
# incidentd #
@@ -46,6 +48,8 @@ LOCAL_SHARED_LIBRARIES := \
        libbase \
        libbase \
        libbinder \
        libbinder \
        libcutils \
        libcutils \
        libdebuggerd_client \
        libdumputils \
        libincident \
        libincident \
        liblog \
        liblog \
        libprotobuf-cpp-lite \
        libprotobuf-cpp-lite \
@@ -119,6 +123,8 @@ LOCAL_SHARED_LIBRARIES := \
    libbase \
    libbase \
    libbinder \
    libbinder \
    libcutils \
    libcutils \
    libdebuggerd_client \
    libdumputils \
    libincident \
    libincident \
    liblog \
    liblog \
    libprotobuf-cpp-lite \
    libprotobuf-cpp-lite \
+1 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@ service incidentd /system/bin/incidentd
    class main
    class main
    user incidentd
    user incidentd
    group incidentd log readproc
    group incidentd log readproc
    capabilities KILL SYS_PTRACE


on post-fs-data
on post-fs-data
    # Create directory for incidentd
    # Create directory for incidentd
+29 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,35 @@ status_t FdBuffer::read(int fd, int64_t timeout) {
    return NO_ERROR;
    return NO_ERROR;
}
}


status_t FdBuffer::readFully(int fd) {
    mStartTime = uptimeMillis();

    while (true) {
        if (mBuffer.size() >= MAX_BUFFER_COUNT * BUFFER_SIZE) {
            // Don't let it get too big.
            mTruncated = true;
            VLOG("Truncating data");
            break;
        }
        if (mBuffer.writeBuffer() == NULL) return NO_MEMORY;

        ssize_t amt =
                TEMP_FAILURE_RETRY(::read(fd, mBuffer.writeBuffer(), mBuffer.currentToWrite()));
        if (amt < 0) {
            VLOG("Fail to read %d: %s", fd, strerror(errno));
            return -errno;
        } else if (amt == 0) {
            VLOG("Done reading %zu bytes", mBuffer.size());
            // We're done.
            break;
        }
        mBuffer.wp()->move(amt);
    }

    mFinishTime = uptimeMillis();
    return NO_ERROR;
}

status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs,
status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs,
                                             const bool isSysfs) {
                                             const bool isSysfs) {
    struct pollfd pfds[] = {
    struct pollfd pfds[] = {
+6 −0
Original line number Original line Diff line number Diff line
@@ -40,6 +40,12 @@ public:
     */
     */
    status_t read(int fd, int64_t timeoutMs);
    status_t read(int fd, int64_t timeoutMs);


    /**
     * Read the data until we hit eof.
     * Returns NO_ERROR if there were no errors.
     */
    status_t readFully(int fd);

    /**
    /**
     * Read processed results by streaming data to a parsing process, e.g. incident helper.
     * Read processed results by streaming data to a parsing process, e.g. incident helper.
     * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function
     * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function
Loading