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

Commit 2082830d authored by Ray Essick's avatar Ray Essick Committed by Android (Google) Code Review
Browse files

Merge "'dumpsys media.metrics -proto #' doesn't lose default"

parents cd742b91 583a23ae
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -159,7 +159,8 @@ MediaAnalyticsService::MediaAnalyticsService()
          mMaxRecordAgeNs(kMaxRecordAgeNs),
          mMaxRecordSets(kMaxRecordSets),
          mNewSetInterval(kNewSetIntervalNs),
          mDumpProto(MediaAnalyticsItem::PROTO_V0) {
          mDumpProto(MediaAnalyticsItem::PROTO_V1),
          mDumpProtoDefault(MediaAnalyticsItem::PROTO_V1) {

    ALOGD("MediaAnalyticsService created");
    // clear our queues
@@ -381,6 +382,7 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
    String16 summaryOption("-summary");
    bool summary = false;
    String16 protoOption("-proto");
    int chosenProto = mDumpProtoDefault;
    String16 clearOption("-clear");
    bool clear = false;
    String16 sinceOption("-since");
@@ -400,7 +402,7 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
            i++;
            if (i < n) {
                String8 value(args[i]);
                int proto = MediaAnalyticsItem::PROTO_V0;       // default to original
                int proto = MediaAnalyticsItem::PROTO_V0;
                char *endp;
                const char *p = value.string();
                proto = strtol(p, &endp, 10);
@@ -410,8 +412,12 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
                    } else if (proto > MediaAnalyticsItem::PROTO_LAST) {
                        proto = MediaAnalyticsItem::PROTO_LAST;
                    }
                    mDumpProto = proto;
                    chosenProto = proto;
                } else {
                    result.append("unable to parse value for -proto\n\n");
                }
            } else {
                result.append("missing value for -proto\n\n");
            }
        } else if (args[i] == sinceOption) {
            i++;
@@ -437,7 +443,7 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
        } else if (args[i] == helpOption) {
            result.append("Recognized parameters:\n");
            result.append("-help        this help message\n");
            result.append("-proto X     dump using protocol X (defaults to 1)");
            result.append("-proto #     dump using protocol #");
            result.append("-summary     show summary info\n");
            result.append("-clear       clears out saved records\n");
            result.append("-only X      process records for component X\n");
@@ -450,6 +456,8 @@ status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)

    Mutex::Autolock _l(mLock);

    mDumpProto = chosenProto;

    // we ALWAYS dump this piece
    snprintf(buffer, SIZE, "Dump of the %s process:\n", kServiceName);
    result.append(buffer);
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ class MediaAnalyticsService : public BnMediaAnalyticsService

    // support for generating output
    int mDumpProto;
    int mDumpProtoDefault;
    String8 dumpQueue(List<MediaAnalyticsItem*> *);
    String8 dumpQueue(List<MediaAnalyticsItem*> *, nsecs_t, const char *only);