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

Commit 9a290045 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by android-build-merger
Browse files

Plug hole in Roaming indication.

am: 1fb93b5f

Change-Id: I7686c1735833da83a703572110647e341d9f03f7
parents 96b668cc 1fb93b5f
Loading
Loading
Loading
Loading
+89 −1
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.EventLog;
import android.util.LocalLog;
import android.util.Pair;
import android.util.Pair;
import android.util.TimeUtils;
import android.util.TimeUtils;


@@ -89,6 +90,7 @@ import com.android.internal.telephony.uicc.RuimRecords;
import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.SIMRecords;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccCardApplication;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.util.IndentingPrintWriter;


/**
/**
 * {@hide}
 * {@hide}
@@ -277,6 +279,11 @@ public class ServiceStateTracker extends Handler {


    private final RatRatcheter mRatRatcheter;
    private final RatRatcheter mRatRatcheter;


    private final LocalLog mRoamingLog = new LocalLog(10);
    private final LocalLog mAttachLog = new LocalLog(10);
    private final LocalLog mPhoneTypeLog = new LocalLog(10);
    private final LocalLog mRatLog = new LocalLog(20);

    private class SstSubscriptionsChangedListener extends OnSubscriptionsChangedListener {
    private class SstSubscriptionsChangedListener extends OnSubscriptionsChangedListener {
        public final AtomicInteger mPreviousSubId =
        public final AtomicInteger mPreviousSubId =
                new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                new AtomicInteger(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
@@ -614,6 +621,15 @@ public class ServiceStateTracker extends Handler {
        // strength information displayed on the UI.
        // strength information displayed on the UI.
        mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
        mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
        sendMessage(obtainMessage(EVENT_PHONE_TYPE_SWITCHED));
        sendMessage(obtainMessage(EVENT_PHONE_TYPE_SWITCHED));

        logPhoneTypeChange();

        // Tell everybody that we've thrown away state and are starting over with
        // empty, detached ServiceStates.
        mVoiceRoamingOffRegistrants.notifyRegistrants();
        mDataRoamingOffRegistrants.notifyRegistrants();
        mDetachedRegistrants.notifyRegistrants();
        notifyDataRegStateRilRadioTechnologyChanged();
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -2380,6 +2396,22 @@ public class ServiceStateTracker extends Handler {
        }
        }
    }
    }


    private void logRoamingChange() {
        mRoamingLog.log(mSS.toString());
    }

    private void logAttachChange() {
        mAttachLog.log(mSS.toString());
    }

    private void logPhoneTypeChange() {
        mPhoneTypeLog.log(Integer.toString(mPhone.getPhoneType()));
    }

    private void logRatChange() {
        mRatLog.log(mSS.toString());
    }

    protected void log(String s) {
    protected void log(String s) {
        Rlog.d(LOG_TAG, s);
        Rlog.d(LOG_TAG, s);
    }
    }
@@ -2733,6 +2765,10 @@ public class ServiceStateTracker extends Handler {
            mEventLog.writeServiceStateChanged(mSS);
            mEventLog.writeServiceStateChanged(mSS);
        }
        }


        if (hasGprsAttached || hasGprsDetached || hasRegistered || hasDeregistered) {
            logAttachChange();
        }

        if (hasGprsAttached) {
        if (hasGprsAttached) {
            mAttachedRegistrants.notifyRegistrants();
            mAttachedRegistrants.notifyRegistrants();
        }
        }
@@ -2741,6 +2777,10 @@ public class ServiceStateTracker extends Handler {
            mDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }
        }


        if (hasRilDataRadioTechnologyChanged || hasRilVoiceRadioTechnologyChanged) {
            logRatChange();
        }

        if (hasDataRegStateChanged || hasRilDataRadioTechnologyChanged) {
        if (hasDataRegStateChanged || hasRilDataRadioTechnologyChanged) {
            notifyDataRegStateRilRadioTechnologyChanged();
            notifyDataRegStateRilRadioTechnologyChanged();


@@ -2752,6 +2792,10 @@ public class ServiceStateTracker extends Handler {
            }
            }
        }
        }


        if (hasVoiceRoamingOn || hasVoiceRoamingOff || hasDataRoamingOn || hasDataRoamingOff) {
            logRoamingChange();
        }

        if (hasVoiceRoamingOn) {
        if (hasVoiceRoamingOn) {
            mVoiceRoamingOnRegistrants.notifyRegistrants();
            mVoiceRoamingOnRegistrants.notifyRegistrants();
        }
        }
@@ -2929,6 +2973,10 @@ public class ServiceStateTracker extends Handler {
            mPhone.notifyServiceStateChanged(mSS);
            mPhone.notifyServiceStateChanged(mSS);
        }
        }


        if (hasCdmaDataConnectionAttached || hasCdmaDataConnectionDetached || hasRegistered) {
            logAttachChange();
        }

        if (hasCdmaDataConnectionAttached) {
        if (hasCdmaDataConnectionAttached) {
            mAttachedRegistrants.notifyRegistrants();
            mAttachedRegistrants.notifyRegistrants();
        }
        }
@@ -2937,6 +2985,10 @@ public class ServiceStateTracker extends Handler {
            mDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }
        }


        if (hasRilDataRadioTechnologyChanged || hasRilVoiceRadioTechnologyChanged) {
            logRatChange();
        }

        if (hasCdmaDataConnectionChanged || hasRilDataRadioTechnologyChanged) {
        if (hasCdmaDataConnectionChanged || hasRilDataRadioTechnologyChanged) {
            notifyDataRegStateRilRadioTechnologyChanged();
            notifyDataRegStateRilRadioTechnologyChanged();
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
@@ -2955,6 +3007,10 @@ public class ServiceStateTracker extends Handler {
            mVoiceRoamingOffRegistrants.notifyRegistrants();
            mVoiceRoamingOffRegistrants.notifyRegistrants();
        }
        }


        if (hasVoiceRoamingOn || hasVoiceRoamingOff || hasDataRoamingOn || hasDataRoamingOff) {
            logRoamingChange();
        }

        if (hasDataRoamingOn) {
        if (hasDataRoamingOn) {
            mDataRoamingOnRegistrants.notifyRegistrants();
            mDataRoamingOnRegistrants.notifyRegistrants();
        }
        }
@@ -3151,6 +3207,11 @@ public class ServiceStateTracker extends Handler {
            mPhone.notifyServiceStateChanged(mSS);
            mPhone.notifyServiceStateChanged(mSS);
        }
        }


        if (hasCdmaDataConnectionAttached || has4gHandoff || hasCdmaDataConnectionDetached ||
                hasRegistered || hasDeregistered) {
            logAttachChange();
        }

        if (hasCdmaDataConnectionAttached || has4gHandoff) {
        if (hasCdmaDataConnectionAttached || has4gHandoff) {
            mAttachedRegistrants.notifyRegistrants();
            mAttachedRegistrants.notifyRegistrants();
        }
        }
@@ -3159,6 +3220,10 @@ public class ServiceStateTracker extends Handler {
            mDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }
        }


        if (hasDataRadioTechnologyChanged || hasVoiceRadioTechnologyChanged) {
            logRatChange();
        }

        if ((hasCdmaDataConnectionChanged || hasDataRadioTechnologyChanged)) {
        if ((hasCdmaDataConnectionChanged || hasDataRadioTechnologyChanged)) {
            notifyDataRegStateRilRadioTechnologyChanged();
            notifyDataRegStateRilRadioTechnologyChanged();
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
            if (ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN
@@ -3169,6 +3234,10 @@ public class ServiceStateTracker extends Handler {
            }
            }
        }
        }


        if (hasVoiceRoamingOn || hasVoiceRoamingOff || hasDataRoamingOn || hasDataRoamingOff) {
            logRoamingChange();
        }

        if (hasVoiceRoamingOn) {
        if (hasVoiceRoamingOn) {
            mVoiceRoamingOnRegistrants.notifyRegistrants();
            mVoiceRoamingOnRegistrants.notifyRegistrants();
        }
        }
@@ -4637,7 +4706,26 @@ public class ServiceStateTracker extends Handler {
        pw.println(" mDeviceShuttingDown=" + mDeviceShuttingDown);
        pw.println(" mDeviceShuttingDown=" + mDeviceShuttingDown);
        pw.println(" mSpnUpdatePending=" + mSpnUpdatePending);
        pw.println(" mSpnUpdatePending=" + mSpnUpdatePending);



        pw.println(" Roaming Log:");
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "  ");
        ipw.increaseIndent();
        mRoamingLog.dump(fd, ipw, args);
        ipw.decreaseIndent();

        ipw.println(" Attach Log:");
        ipw.increaseIndent();
        mAttachLog.dump(fd, ipw, args);
        ipw.decreaseIndent();

        ipw.println(" Phone Change Log:");
        ipw.increaseIndent();
        mPhoneTypeLog.dump(fd, ipw, args);
        ipw.decreaseIndent();

        ipw.println(" Rat Change Log:");
        ipw.increaseIndent();
        mRatLog.dump(fd, ipw, args);
        ipw.decreaseIndent();
    }
    }


    public boolean isImsRegistered() {
    public boolean isImsRegistered() {
+18 −0
Original line number Original line Diff line number Diff line
@@ -1556,6 +1556,24 @@ public class DataConnection extends StateMachine {
        @Override public void enter() {
        @Override public void enter() {
            if (DBG) log("DcActiveState: enter dc=" + DataConnection.this);
            if (DBG) log("DcActiveState: enter dc=" + DataConnection.this);


            // verify and get updated information in case these things
            // are obsolete
            {
                ServiceState ss = mPhone.getServiceState();
                final int networkType = ss.getDataNetworkType();
                if (mNetworkInfo.getSubtype() != networkType) {
                    log("DcActiveState with incorrect subtype (" + mNetworkInfo.getSubtype() +
                            ", " + networkType + "), updating.");
                }
                mNetworkInfo.setSubtype(networkType, TelephonyManager.getNetworkTypeName(networkType));
                final boolean roaming = ss.getDataRoaming();
                if (roaming != mNetworkInfo.isRoaming()) {
                    log("DcActiveState with incorrect roaming (" + mNetworkInfo.isRoaming() +
                            ", " + roaming +"), updating.");
                }
                mNetworkInfo.setRoaming(roaming);
            }

            boolean createNetworkAgent = true;
            boolean createNetworkAgent = true;
            // If a disconnect is already pending, avoid notifying all of connected
            // If a disconnect is already pending, avoid notifying all of connected
            if (hasMessages(EVENT_DISCONNECT) ||
            if (hasMessages(EVENT_DISCONNECT) ||