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

Commit b3798668 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android Git Automerger
Browse files

am cfbe5842: Merge "DO NOT MERGE Add logging to detect the start of a sync problem." into mnc-dev

* commit 'cfbe5842':
  DO NOT MERGE Add logging to detect the start of a sync problem.
parents 9fbf4e40 cfbe5842
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -454,6 +454,12 @@ public class PhoneFactory {
        }
    }

    public static LocalLog getLocalLog(String key) {
        synchronized (sLocalLogs) {
            return sLocalLogs.get(key);
        }
    }

    public static void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("PhoneFactory:");
        PhoneProxy [] phones = (PhoneProxy[])PhoneFactory.getPhones();
+26 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public class ApnContext {
        }
    }

    public void incRefCount(LocalLog log) {
    public void incRefCount(LocalLog log, int serialNum) {
        synchronized (mRefCountLock) {
            if (mRefCount == 0) {
               // we wanted to leave the last in so it could actually capture the tear down
@@ -302,10 +302,11 @@ public class ApnContext {
            if (mRefCount++ == 0) {
                mDcTracker.setEnabled(mDcTracker.apnTypeToId(mApnType), true);
            }
            DctController.getInstance().ackNetworkExecution(serialNum);
        }
    }

    public void decRefCount(LocalLog log) {
    public void decRefCount(LocalLog log, int serialNum) {
        synchronized (mRefCountLock) {
            // leave the last log alive to capture the actual tear down
            if (mRefCount != 1) {
@@ -320,6 +321,29 @@ public class ApnContext {
            if (mRefCount-- == 1) {
                mDcTracker.setEnabled(mDcTracker.apnTypeToId(mApnType), false);
            }
            DctController.getInstance().ackNetworkExecution(serialNum);
        }
    }

    public void clearRefCount() {
        synchronized (mRefCountLock) {
            for (LocalLog l : mLocalLogs) l.log("ApnContext.clearRefCount from " + mRefCount);
            mLocalLogs.clear();
            mRefCount = 0;
            mDcTracker.setEnabled(mDcTracker.apnTypeToId(mApnType), false);
        }
    }

    int getRefCount() {
        return mRefCount;
    }

    void copyLogTo(LocalLog other) {
        synchronized (mRefCountLock) {
            for (LocalLog l : mLocalLogs) {
                other.log("-----");
                l.copyTo(other, 30);
            }
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ public class DcSwitchAsyncChannel extends AsyncChannel {
        final NetworkRequest request;
        final int priority;
        private final LocalLog requestLog;
        int executionSerialNumber;

        public RequestInfo(NetworkRequest request, int priority, LocalLog l) {
            this.request = request;
+36 −6
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.UiccController;
@@ -253,20 +254,49 @@ public final class DcTracker extends DcTrackerBase {
    }

    @Override
    public void incApnRefCount(String name, LocalLog log) {
    public void incApnRefCount(String name, LocalLog log, int serialNum) {
        ApnContext apnContext = mApnContexts.get(name);
        log.log("DcTracker.incApnRefCount on " + name + " found " + apnContext);
        log.log("DcTracker.incApnRefCount on " + name + " found " + apnContext + " (" +
                serialNum + ")");
        if (apnContext != null) {
            apnContext.incRefCount(log);
            apnContext.incRefCount(log, serialNum);
        }

    }

    @Override
    public void decApnRefCount(String name, LocalLog log) {
    public void decApnRefCount(String name, LocalLog log, int serialNum) {
        ApnContext apnContext = mApnContexts.get(name);
        log.log("DcTracker.decApnRefCount on " + name + " found " + apnContext);
        log.log("DcTracker.decApnRefCount on " + name + " found " + apnContext + " (" +
                serialNum + ")");
        if (apnContext != null) {
            apnContext.decRefCount(log);
            apnContext.decRefCount(log, serialNum);
        }
    }

    @Override
    public int currentRequestCount() {
        int total = 0;
        for (ApnContext apnContext: mApnContexts.values()) {
            total += apnContext.getRefCount();
        }
        return total;
    }

    @Override
    public void clearApnRefCounts() {
        for (ApnContext apnContext : mApnContexts.values()) {
            apnContext.clearRefCount();
        }
    }

    public void snapshotContexts(String logName) {
        LocalLog l = PhoneFactory.getLocalLog(logName);
        if (l != null) {
            for (ApnContext apnContext : mApnContexts.values()) {
                l.log(apnContext.toString());
                apnContext.copyLogTo(l);
            }
        }
    }

+8 −2
Original line number Diff line number Diff line
@@ -662,9 +662,15 @@ public abstract class DcTrackerBase extends Handler {
        mPhone.notifyDataActivity();
    }

    abstract public void incApnRefCount(String name, LocalLog log);
    abstract public void incApnRefCount(String name, LocalLog log, int serialNum);

    abstract public void decApnRefCount(String name, LocalLog log);
    abstract public void decApnRefCount(String name, LocalLog log, int serialNum);

    abstract public int currentRequestCount();

    abstract public void clearApnRefCounts();

    abstract public void snapshotContexts(String logName);

    public boolean isApnSupported(String name) {
        return false;
Loading