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

Commit 7f3764cd 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...

Merge "Add dumpsys command to save atoms to disks immediately" am: 074147a3 am: 768692f3 am: 40390d9b

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

Change-Id: I1cb355c5617fe9007c8114b3765ae961c36dc9a9
parents a9d80645 40390d9b
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 {