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

Commit 9dd8de1a authored by Jack Yu's avatar Jack Yu
Browse files

Logged historical APN state

Added historical APN state into local log for debugging
purposes.

Test: Manual
Merged-In: I2a3c32dfc8fb750fd369d48fc77b9630d84f4c94
Change-Id: I2a3c32dfc8fb750fd369d48fc77b9630d84f4c94
(cherry picked from commit 58b0c014)
parent 12efa860
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import com.android.internal.util.IndentingPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -272,7 +271,10 @@ public class ApnContext {
            log("setState: " + s + ", previous state:" + mState);
        }

        if (mState != s) {
            mStateLocalLog.log("State changed from " + mState + " to " + s);
            mState = s;
        }

        if (mState == DctConstants.State.FAILED) {
            if (mRetryManager.getWaitingApns() != null) {
@@ -399,8 +401,7 @@ public class ApnContext {

    private final ArrayList<LocalLog> mLocalLogs = new ArrayList<>();
    private final ArrayList<NetworkRequest> mNetworkRequests = new ArrayList<>();
    private final ArrayDeque<LocalLog> mHistoryLogs = new ArrayDeque<>();
    private final static int MAX_HISTORY_LOG_COUNT = 4;
    private final LocalLog mStateLocalLog = new LocalLog(50);

    public void requestLog(String str) {
        synchronized (mRefCountLock) {
@@ -719,13 +720,15 @@ public class ApnContext {
            pw.increaseIndent();
            for (LocalLog l : mLocalLogs) {
                l.dump(fd, pw, args);
                pw.println("-----");
            }
            if (mHistoryLogs.size() > 0) pw.println("Historical Logs:");
            for (LocalLog l : mHistoryLogs) {
                l.dump(fd, pw, args);
            }
            pw.decreaseIndent();
            pw.println("Historical APN state:");
            pw.increaseIndent();
            mStateLocalLog.dump(fd, pw, args);
            pw.decreaseIndent();
            pw.println(mRetryManager);
            pw.println("--------------------------");
        }
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ public class DataConnection extends StateMachine {
    private int mDataRegState = Integer.MAX_VALUE;
    private NetworkInfo mNetworkInfo;
    private NetworkAgent mNetworkAgent;
    private LocalLog mLocalLog = new LocalLog(50);
    private LocalLog mNetCapsLocalLog = new LocalLog(50);

    int mTag;
    public int mCid;
@@ -1849,7 +1849,7 @@ public class DataConnection extends StateMachine {
        public DcNetworkAgent(Looper l, Context c, String TAG, NetworkInfo ni,
                NetworkCapabilities nc, LinkProperties lp, int score, NetworkMisc misc) {
            super(l, c, TAG, ni, nc, lp, score, misc);
            mLocalLog.log("New network agent created. capabilities=" + nc);
            mNetCapsLocalLog.log("New network agent created. capabilities=" + nc);
            mNetworkCapabilities = nc;
        }

@@ -1902,7 +1902,7 @@ public class DataConnection extends StateMachine {
                        + mPhone.getServiceState().getRilDataRadioTechnology()
                        + ", DUN APN=\"" + mDct.fetchDunApn() + "\""
                        + ", mApnSetting=" + mApnSetting;
                mLocalLog.log(logStr);
                mNetCapsLocalLog.log(logStr);
                log(logStr);
                mNetworkCapabilities = networkCapabilities;
            }
@@ -2145,7 +2145,7 @@ public class DataConnection extends StateMachine {
        pw.println("mAc=" + mAc);
        pw.println("Network capabilities changed history:");
        pw.increaseIndent();
        mLocalLog.dump(fd, pw, args);
        mNetCapsLocalLog.dump(fd, pw, args);
        pw.decreaseIndent();
        pw.decreaseIndent();
        pw.println();