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

Commit 98abb09c authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes Ia27d8f06,I6694a1a9

* changes:
  Revert "Remove the usage of hidden APIs from NetworkInfo"
  Revert "Set the APN when DcNetworkAgent is created"
parents 6d621a8e 2f82d5e2
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1732,6 +1732,7 @@ public class DataConnection extends StateMachine {
                                + " drs=" + mDataRegState
                                + " mRilRat=" + mRilRat);
                    }
                    updateNetworkInfo();
                    break;
                default:
                    if (DBG) {
@@ -1744,6 +1745,19 @@ public class DataConnection extends StateMachine {
        }
    }

    private void updateNetworkInfo() {
        final ServiceState state = mPhone.getServiceState();

        NetworkRegistrationInfo nri = state.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        int subtype = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (nri != null) {
            subtype = nri.getAccessNetworkTechnology();
        }

        mNetworkInfo.setSubtype(subtype, TelephonyManager.getNetworkTypeName(subtype));
    }

    private void updateNetworkInfoSuspendState() {
        // this is only called when we are either connected or suspended.  Decide which.
        if (mNetworkAgent == null) {
@@ -2085,6 +2099,8 @@ public class DataConnection extends StateMachine {
                    mApnSetting != null
                        ? mApnSetting.canHandleType(ApnSetting.TYPE_DEFAULT) : false);

            updateNetworkInfo();

            // If we were retrying there maybe more than one, otherwise they'll only be one.
            notifyAllWithEvent(null, DctConstants.EVENT_DATA_SETUP_COMPLETE,
                    Phone.REASON_CONNECTED);
@@ -2100,6 +2116,7 @@ public class DataConnection extends StateMachine {

            mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED,
                    mNetworkInfo.getReason(), null);
            mNetworkInfo.setExtraInfo(mApnSetting.getApnName());
            updateTcpBufferSizes(mRilRat);
            updateLinkBandwidthsFromCarrierConfig(mRilRat);

@@ -2366,6 +2383,7 @@ public class DataConnection extends StateMachine {
                case EVENT_DATA_CONNECTION_ROAM_ON:
                case EVENT_DATA_CONNECTION_ROAM_OFF:
                case EVENT_DATA_CONNECTION_OVERRIDE_CHANGED: {
                    updateNetworkInfo();
                    if (mNetworkAgent != null) {
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
                                DataConnection.this);
@@ -2387,6 +2405,7 @@ public class DataConnection extends StateMachine {
                }
                case EVENT_DATA_CONNECTION_VOICE_CALL_STARTED:
                case EVENT_DATA_CONNECTION_VOICE_CALL_ENDED: {
                    updateNetworkInfo();
                    updateNetworkInfoSuspendState();
                    if (mNetworkAgent != null) {
                        mNetworkAgent.sendNetworkCapabilities(getNetworkCapabilities(),
+3 −22
Original line number Diff line number Diff line
@@ -30,10 +30,7 @@ import android.net.Uri;
import android.os.Message;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.NetworkType;
import android.telephony.AnomalyReporter;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.util.LocalLog;
import android.util.SparseArray;
@@ -96,9 +93,6 @@ public class DcNetworkAgent extends NetworkAgent {
        mTransportType = transportType;
        mDataConnection = dc;
        mNetworkInfo = new NetworkInfo(ni);
        setLegacyExtraInfo(dc.getApnSetting().getApnName());
        int subType = getNetworkType();
        setLegacySubtype(subType, TelephonyManager.getNetworkTypeName(subType));
        // TODO: Remove after b/151487565 is fixed.
        sNetworkAgents.add(this);
        checkRedundantIms();
@@ -288,12 +282,10 @@ public class DcNetworkAgent extends NetworkAgent {
        if (!isOwned(dc, "sendNetworkInfo")) return;
        final NetworkInfo.State oldState = mNetworkInfo.getState();
        final NetworkInfo.State state = networkInfo.getState();
        String extraInfo = dc.getApnSetting().getApnName();
        if (mNetworkInfo.getExtraInfo() != extraInfo) {
            setLegacyExtraInfo(extraInfo);
        if (mNetworkInfo.getExtraInfo() != networkInfo.getExtraInfo()) {
            setLegacyExtraInfo(networkInfo.getExtraInfo());
        }

        int subType = getNetworkType();
        int subType = networkInfo.getSubtype();
        if (mNetworkInfo.getSubtype() != subType) {
            setLegacySubtype(subType, TelephonyManager.getNetworkTypeName(subType));
        }
@@ -386,17 +378,6 @@ public class DcNetworkAgent extends NetworkAgent {
        Rlog.e(mTag, s);
    }

    private @NetworkType int getNetworkType() {
        final ServiceState serviceState = mPhone.getServiceState();
        NetworkRegistrationInfo nri = serviceState.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, mTransportType);
        int subType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        if (nri != null) {
            subType = nri.getAccessNetworkTechnology();
        }
        return subType;
    }

    class DcKeepaliveTracker {
        private class KeepaliveRecord {
            public int slotId;