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

Commit 596b6521 authored by android-build-team Robot's avatar android-build-team Robot Committed by Android (Google) Code Review
Browse files

Merge "Adding batterystats history to proto dump."

parents fe45568a 3d16091d
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "report_directory.h"
#include "section_list.h"

#include <android-base/properties.h>
#include <android/os/DropBoxManager.h>
#include <private/android_filesystem_config.h>
#include <utils/SystemClock.h>
@@ -31,6 +32,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string>

/**
 * The directory where the incident reports are stored.
@@ -129,6 +131,8 @@ Reporter::run_report_status_t Reporter::runReport(size_t* reportByteSize) {
    int mainDest = -1;
    HeaderSection headers;
    MetadataSection metadataSection;
    std::string buildType = android::base::GetProperty("ro.build.type", "");
    const bool isUserdebugOrEng = buildType == "userdebug" || buildType == "eng";

    // See if we need the main file
    for (ReportRequestSet::iterator it = batch.begin(); it != batch.end(); it++) {
@@ -175,6 +179,11 @@ Reporter::run_report_status_t Reporter::runReport(size_t* reportByteSize) {
    // and report to those that care that we're doing it.
    for (const Section** section = SECTION_LIST; *section; section++) {
        const int id = (*section)->id;
        if ((*section)->userdebugAndEngOnly && !isUserdebugOrEng) {
            ALOGD("Skipping incident report section %d '%s' because it's limited to userdebug/eng",
                  id, (*section)->name.string());
            continue;
        }
        if (this->batch.containsSection(id)) {
            ALOGD("Taking incident report section %d '%s'", id, (*section)->name.string());
            for (ReportRequestSet::iterator it = batch.begin(); it != batch.end(); it++) {
+10 −7
Original line number Diff line number Diff line
@@ -151,8 +151,11 @@ DONE:
}

// ================================================================================
Section::Section(int i, int64_t timeoutMs, bool deviceSpecific)
    : id(i), timeoutMs(timeoutMs), deviceSpecific(deviceSpecific) {}
Section::Section(int i, int64_t timeoutMs, bool userdebugAndEngOnly, bool deviceSpecific)
    : id(i),
      timeoutMs(timeoutMs),
      userdebugAndEngOnly(userdebugAndEngOnly),
      deviceSpecific(deviceSpecific) {}

Section::~Section() {}

@@ -239,7 +242,7 @@ static inline bool isSysfs(const char* filename) { return strncmp(filename, "/sy

FileSection::FileSection(int id, const char* filename, const bool deviceSpecific,
                         const int64_t timeoutMs)
    : Section(id, timeoutMs, deviceSpecific), mFilename(filename) {
    : Section(id, timeoutMs, false, deviceSpecific), mFilename(filename) {
    name = "file ";
    name += filename;
    mIsSysfs = isSysfs(filename);
@@ -399,8 +402,8 @@ WorkerThreadData::WorkerThreadData(const WorkerThreadSection* sec)
WorkerThreadData::~WorkerThreadData() {}

// ================================================================================
WorkerThreadSection::WorkerThreadSection(int id, const int64_t timeoutMs)
    : Section(id, timeoutMs) {}
WorkerThreadSection::WorkerThreadSection(int id, const int64_t timeoutMs, bool userdebugAndEngOnly)
    : Section(id, timeoutMs, userdebugAndEngOnly) {}

WorkerThreadSection::~WorkerThreadSection() {}

@@ -575,8 +578,8 @@ status_t CommandSection::Execute(ReportRequestSet* requests) const {
}

// ================================================================================
DumpsysSection::DumpsysSection(int id, const char* service, ...)
    : WorkerThreadSection(id), mService(service) {
DumpsysSection::DumpsysSection(int id, bool userdebugAndEngOnly, const char* service, ...)
    : WorkerThreadSection(id, REMOTE_CALL_TIMEOUT_MS, userdebugAndEngOnly), mService(service) {
    name = "dumpsys ";
    name += service;

+6 −3
Original line number Diff line number Diff line
@@ -40,10 +40,12 @@ class Section {
public:
    const int id;
    const int64_t timeoutMs;  // each section must have a timeout
    const bool userdebugAndEngOnly;
    const bool deviceSpecific;
    String8 name;

    Section(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS, bool deviceSpecific = false);
    Section(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS, bool userdebugAndEngOnly = false,
            bool deviceSpecific = false);
    virtual ~Section();

    virtual status_t Execute(ReportRequestSet* requests) const = 0;
@@ -107,7 +109,8 @@ private:
 */
class WorkerThreadSection : public Section {
public:
    WorkerThreadSection(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS);
    WorkerThreadSection(int id, int64_t timeoutMs = REMOTE_CALL_TIMEOUT_MS,
                        bool userdebugAndEngOnly = false);
    virtual ~WorkerThreadSection();

    virtual status_t Execute(ReportRequestSet* requests) const;
@@ -137,7 +140,7 @@ private:
 */
class DumpsysSection : public WorkerThreadSection {
public:
    DumpsysSection(int id, const char* service, ...);
    DumpsysSection(int id, bool userdebugAndEngOnly, const char* service, ...);
    virtual ~DumpsysSection();

    virtual status_t BlockingCall(int pipeWriteFd) const;
+322 −189

File changed.

Preview size limit exceeded, changes collapsed.

+8 −0
Original line number Diff line number Diff line
@@ -239,6 +239,14 @@ public class TimeUtils {
        }
    }

    /** @hide Just for debugging; not internationalized. */
    public static void formatDuration(long duration, StringBuilder builder, int fieldLen) {
        synchronized (sFormatSync) {
            int len = formatDurationLocked(duration, fieldLen);
            builder.append(sFormatStr, 0, len);
        }
    }

    /** @hide Just for debugging; not internationalized. */
    public static void formatDuration(long duration, PrintWriter pw, int fieldLen) {
        synchronized (sFormatSync) {
Loading