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

Commit 333bb3d7 authored by Andy Hung's avatar Andy Hung
Browse files

MediaMetrics: Minor logging fixes

Remove extraneous right brace in Time Machine dump.
Do not suppress repeated EVENT properties in the Time Machine.
Use "--" prefix instead of "-" for long dumpsys argv options.

Test: atest mediametrics_tests
Test: adb shell dumpsys media.metrics
Bug: 138583596
Change-Id: I874be909ac08641b14dd12fb2c83de7a276a1796
parent 9e89b4f0
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -70,14 +70,21 @@
// Underscores after the AMEDIAMETRICS_PROP_* prefix indicate
// a "dot" in the property name. For example AMEDIAMETRICS_PROP_VOLUME_LEFT
// corresponds to "volume.left".

//
// The property names are camel case, typically a lowercase letter [a-z]
// followed by one or more characters in the range [a-zA-Z0-9_.].
// Special symbols such as !@#$%^&*()[]{}<>,:;'"\/?|+-=~ are reserved.
//
// A property that ends with a ! will have duplicate values listed instead
// of suppressed in the Time Machine.
//
#define AMEDIAMETRICS_PROP_AUXEFFECTID    "auxEffectId"    // int32 (AudioTrack)
#define AMEDIAMETRICS_PROP_CHANNELCOUNT   "channelCount"   // int32
#define AMEDIAMETRICS_PROP_CHANNELMASK    "channelMask"    // int32
#define AMEDIAMETRICS_PROP_CONTENTTYPE    "contentType"    // string attributes (AudioTrack)
#define AMEDIAMETRICS_PROP_DURATIONNS     "durationNs"     // int64 duration time span
#define AMEDIAMETRICS_PROP_ENCODING       "encoding"       // string value of format
#define AMEDIAMETRICS_PROP_EVENT          "event"          // string value (often func name)
#define AMEDIAMETRICS_PROP_EVENT          "event!"         // string value (often func name)

// TODO: fix inconsistency in flags: AudioRecord / AudioTrack int32,  AudioThread string
#define AMEDIAMETRICS_PROP_FLAGS          "flags"
+10 −10
Original line number Diff line number Diff line
@@ -204,13 +204,13 @@ status_t MediaMetricsService::dump(int fd, const Vector<String16>& args)
    }

    // crack any parameters
    const String16 protoOption("-proto");
    const String16 clearOption("-clear");
    const String16 protoOption("--proto");
    const String16 clearOption("--clear");
    bool clear = false;
    const String16 sinceOption("-since");
    const String16 sinceOption("--since");
    nsecs_t ts_since = 0;
    const String16 helpOption("-help");
    const String16 onlyOption("-only");
    const String16 helpOption("--help");
    const String16 onlyOption("--only");
    std::string only;
    const int n = args.size();
    for (int i = 0; i < n; i++) {
@@ -250,11 +250,11 @@ status_t MediaMetricsService::dump(int fd, const Vector<String16>& args)
            // or dumpsys media.metrics audiotrack codec

            result.append("Recognized parameters:\n");
            result.append("-help        this help message\n");
            result.append("-proto #     dump using protocol #");
            result.append("-clear       clears out saved records\n");
            result.append("-only X      process records for component X\n");
            result.append("-since X     include records since X\n");
            result.append("--help        this help message\n");
            result.append("--proto #     dump using protocol #");
            result.append("--clear       clears out saved records\n");
            result.append("--only X      process records for component X\n");
            result.append("--since X     include records since X\n");
            result.append("             (X is milliseconds since the UNIX epoch)\n");
            write(fd, result.string(), result.size());
            return NO_ERROR;
+0 −1
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ private:
                ss << "(" << (offset == 0 ? "" : "~") << &timestring.time[offset]
                    << ") " << eptr->second;
                if (++eptr == timeSequence.end()) {
                    ss << "}";
                    break;
                }
                ss << ", ";