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

Commit 4b677c10 authored by Michele's avatar Michele
Browse files

Improved mechanism to retrieve metrics

Added --keep option to maintain the metrics after collecting them.
Added --metricsprototext option to directly print the TelephonyLog proto
file.

Bug: 129085752
Test: Tested on device
Change-Id: Ic01a00ad68e585772247d9b64a316e27c236bdf2
parent 3d604644
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -44,8 +44,9 @@ public class DebugService {
     */
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (args != null && args.length > 0) {
            if (TextUtils.equals(args[0], "--metrics") ||
                    TextUtils.equals(args[0], "--metricsproto"))
            if (TextUtils.equals(args[0], "--metrics")
                    || TextUtils.equals(args[0], "--metricsproto")
                    || TextUtils.equals(args[0], "--metricsprototext"))
            {
                log("Collecting telephony metrics..");
                TelephonyMetrics.getInstance().dump(fd, pw, args);
+11 −1
Original line number Diff line number Diff line
@@ -241,13 +241,23 @@ public class TelephonyMetrics {
     */
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (args != null && args.length > 0) {
            boolean reset = true;
            if (args.length > 1 && "--keep".equals(args[1])) {
                reset = false;
            }

            switch (args[0]) {
                case "--metrics":
                    printAllMetrics(pw);
                    break;
                case "--metricsproto":
                    pw.println(convertProtoToBase64String(buildProto()));
                    if (reset) {
                        reset();
                    }
                    break;
                case "--metricsprototext":
                    pw.println(buildProto().toString());
                    break;
            }
        }