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

Commit 768692f3 authored by Kiwon Park's avatar Kiwon Park Committed by Automerger Merge Worker
Browse files

Merge "Add dumpsys command to save atoms to disks immediately" am: 074147a3

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1959541

Change-Id: I187ce3b531155efcf335e8112bc292881103eceb
parents 631f6e2a 074147a3
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.internal.telephony;

import android.text.TextUtils;

import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.telephony.Rlog;

@@ -44,13 +42,17 @@ 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")
                    || TextUtils.equals(args[0], "--metricsprototext"))
            {
            switch (args[0]) {
                case "--metrics":
                case "--metricsproto":
                case "--metricsprototext":
                    log("Collecting telephony metrics..");
                    TelephonyMetrics.getInstance().dump(fd, pw, args);
                    return;
                case "--saveatoms":
                    log("Saving atoms..");
                    PhoneFactory.getMetricsCollector().getAtomsStorage().flushAtoms();
                    return;
            }
        }
        log("Dump telephony.");
+8 −0
Original line number Diff line number Diff line
@@ -998,6 +998,14 @@ public class PersistAtomsStorage {
        }
    }

    /** Saves a pending {@link PersistAtoms} to a file in private storage immediately. */
    public void flushAtoms() {
        if (mHandler.hasCallbacks(mSaveRunnable)) {
            mHandler.removeCallbacks(mSaveRunnable);
            saveAtomsToFileNow();
        }
    }

    /** Loads {@link PersistAtoms} from a file in private storage. */
    private PersistAtoms loadAtomsFromFile() {
        try {