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

Commit 71df921a authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Revert "Moved DataProfile from telephony internal hidden API to System...

Merge "Revert "Moved DataProfile from telephony internal hidden API to System API"" am: ff4c8527 am: 58c26541
am: 9fc7a538

Change-Id: I5f7f6cb23a26994cea9961127d1a9935fbbd362b
parents f2ffcbcb 9fc7a538
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ import android.service.carrier.CarrierIdentifier;
import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.data.DataProfile;

import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.dataconnection.DataProfile;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import com.android.internal.telephony.uicc.IccCardStatus;

+20 −20
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ import android.telephony.SignalStrength;
import android.telephony.SmsManager;
import android.telephony.TelephonyHistogram;
import android.telephony.TelephonyManager;
import android.telephony.data.DataProfile;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
@@ -92,6 +91,7 @@ import com.android.internal.telephony.cat.ComprehensionTlvTag;
import com.android.internal.telephony.cdma.CdmaInformationRecords;
import com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo;
import com.android.internal.telephony.dataconnection.DataCallResponse;
import com.android.internal.telephony.dataconnection.DataProfile;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.nano.TelephonyProto.SmsSession;
@@ -1067,23 +1067,23 @@ public class RIL extends BaseCommands implements CommandsInterface {
    private static DataProfileInfo convertToHalDataProfile(DataProfile dp) {
        DataProfileInfo dpi = new DataProfileInfo();

        dpi.profileId = dp.getProfileId();
        dpi.apn = dp.getApn();
        dpi.protocol = dp.getProtocol();
        dpi.roamingProtocol = dp.getRoamingProtocol();
        dpi.authType = dp.getAuthType();
        dpi.user = dp.getUserName();
        dpi.password = dp.getPassword();
        dpi.type = dp.getType();
        dpi.maxConnsTime = dp.getMaxConnsTime();
        dpi.maxConns = dp.getMaxConns();
        dpi.waitTime = dp.getWaitTime();
        dpi.enabled = dp.isEnabled();
        dpi.supportedApnTypesBitmap = dp.getSupportedApnTypesBitmap();
        dpi.bearerBitmap = dp.getBearerBitmap();
        dpi.mtu = dp.getMtu();
        dpi.mvnoType = convertToHalMvnoType(dp.getMvnoType());
        dpi.mvnoMatchData = dp.getMvnoMatchData();
        dpi.profileId = dp.profileId;
        dpi.apn = dp.apn;
        dpi.protocol = dp.protocol;
        dpi.roamingProtocol = dp.roamingProtocol;
        dpi.authType = dp.authType;
        dpi.user = dp.user;
        dpi.password = dp.password;
        dpi.type = dp.type;
        dpi.maxConnsTime = dp.maxConnsTime;
        dpi.maxConns = dp.maxConns;
        dpi.waitTime = dp.waitTime;
        dpi.enabled = dp.enabled;
        dpi.supportedApnTypesBitmap = dp.supportedApnTypesBitmap;
        dpi.bearerBitmap = dp.bearerBitmap;
        dpi.mtu = dp.mtu;
        dpi.mvnoType = convertToHalMvnoType(dp.mvnoType);
        dpi.mvnoMatchData = dp.mvnoMatchData;

        return dpi;
    }
@@ -1149,7 +1149,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

            try {
                radioProxy.setupDataCall(rr.mSerial, radioTechnology, dpi,
                        dataProfile.isModemCognitive(), allowRoaming, isRoaming);
                        dataProfile.modemCognitive, allowRoaming, isRoaming);
                mMetrics.writeRilSetupDataCall(mPhoneId, rr.mSerial, radioTechnology, dpi.profileId,
                        dpi.apn, dpi.authType, dpi.protocol);
            } catch (RemoteException | RuntimeException e) {
@@ -2901,7 +2901,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

            try {
                radioProxy.setInitialAttachApn(rr.mSerial, convertToHalDataProfile(dataProfile),
                        dataProfile.isModemCognitive(), isRoaming);
                        dataProfile.modemCognitive, isRoaming);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setInitialAttachApn", e);
            }
+1 −2
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import android.os.SystemProperties;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.data.DataProfile;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Pair;
@@ -466,7 +465,7 @@ public class DataConnection extends StateMachine {
        Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
        msg.obj = cp;

        DataProfile dp = DcTracker.createDataProfile(mApnSetting, cp.mProfileId);
        DataProfile dp = new DataProfile(mApnSetting, cp.mProfileId);

        // We need to use the actual modem roaming state instead of the framework roaming state
        // here. This flag is only passed down to ril_service for picking the correct protocol (for
+133 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.telephony.dataconnection;

import android.telephony.ServiceState;
import android.text.TextUtils;

import com.android.internal.telephony.RILConstants;

public class DataProfile {

    static final int TYPE_COMMON = 0;
    static final int TYPE_3GPP = 1;
    static final int TYPE_3GPP2 = 2;

    //id of the data profile
    public final int profileId;
    //the APN to connect to
    public final String apn;
    //one of the PDP_type values in TS 27.007 section 10.1.1.
    //For example, "IP", "IPV6", "IPV4V6", or "PPP".
    public final String protocol;
    //authentication protocol used for this PDP context
    //(None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
    public final int authType;
    //the username for APN, or NULL
    public final String user;
    //the password for APN, or NULL
    public final String password;
    //the profile type, TYPE_COMMON, TYPE_3GPP, TYPE_3GPP2
    public final int type;
    //the period in seconds to limit the maximum connections
    public final int maxConnsTime;
    //the maximum connections during maxConnsTime
    public final int maxConns;
    //the required wait time in seconds after a successful UE initiated
    //disconnect of a given PDN connection before the device can send
    //a new PDN connection request for that given PDN
    public final int waitTime;
    //true to enable the profile, false to disable
    public final boolean enabled;
    //supported APN types bitmap. See RIL_ApnTypes for the value of each bit.
    public final int supportedApnTypesBitmap;
    //one of the PDP_type values in TS 27.007 section 10.1.1 used on roaming network.
    //For example, "IP", "IPV6", "IPV4V6", or "PPP".
    public final String roamingProtocol;
    //The bearer bitmap. See RIL_RadioAccessFamily for the value of each bit.
    public final int bearerBitmap;
    //maximum transmission unit (MTU) size in bytes
    public final int mtu;
    //the MVNO type: possible values are "imsi", "gid", "spn"
    public final String mvnoType;
    //MVNO match data. For example, SPN: A MOBILE, BEN NL, ...
    //IMSI: 302720x94, 2060188, ...
    //GID: 4E, 33, ...
    public final String mvnoMatchData;
    //indicating the data profile was sent to the modem through setDataProfile earlier.
    public final boolean modemCognitive;

    DataProfile(int profileId, String apn, String protocol, int authType,
                String user, String password, int type, int maxConnsTime, int maxConns,
                int waitTime, boolean enabled, int supportedApnTypesBitmap, String roamingProtocol,
                int bearerBitmap, int mtu, String mvnoType, String mvnoMatchData,
                boolean modemCognitive) {

        this.profileId = profileId;
        this.apn = apn;
        this.protocol = protocol;
        if (authType == -1) {
            authType = TextUtils.isEmpty(user) ? RILConstants.SETUP_DATA_AUTH_NONE
                    : RILConstants.SETUP_DATA_AUTH_PAP_CHAP;
        }
        this.authType = authType;
        this.user = user;
        this.password = password;
        this.type = type;
        this.maxConnsTime = maxConnsTime;
        this.maxConns = maxConns;
        this.waitTime = waitTime;
        this.enabled = enabled;

        this.supportedApnTypesBitmap = supportedApnTypesBitmap;
        this.roamingProtocol = roamingProtocol;
        this.bearerBitmap = bearerBitmap;
        this.mtu = mtu;
        this.mvnoType = mvnoType;
        this.mvnoMatchData = mvnoMatchData;
        this.modemCognitive = modemCognitive;
    }

    public DataProfile(ApnSetting apn) {
        this(apn, apn.profileId);
    }

    public DataProfile(ApnSetting apn, int profileId) {
        this(profileId, apn.apn, apn.protocol,
                apn.authType, apn.user, apn.password, apn.bearerBitmask == 0
                        ? TYPE_COMMON : (ServiceState.bearerBitmapHasCdma(apn.bearerBitmask)
                        ? TYPE_3GPP2 : TYPE_3GPP),
                apn.maxConnsTime, apn.maxConns, apn.waitTime, apn.carrierEnabled, apn.typesBitmap,
                apn.roamingProtocol, apn.bearerBitmask, apn.mtu, apn.mvnoType, apn.mvnoMatchData,
                apn.modemCognitive);
    }

    @Override
    public String toString() {
        return "DataProfile=" + profileId + "/" + apn + "/" + protocol + "/" + authType
                + "/" + user + "/" + password + "/" + type + "/" + maxConnsTime
                + "/" + maxConns + "/" + waitTime + "/" + enabled + "/" + supportedApnTypesBitmap
                + "/" + roamingProtocol + "/" + bearerBitmap + "/" + mtu + "/" + mvnoType + "/"
                + mvnoMatchData + "/" + modemCognitive;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof DataProfile == false) return false;
        return (o == this || toString().equals(o.toString()));
    }
}
+2 −24
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.data.DataProfile;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.EventLog;
@@ -2094,7 +2093,7 @@ public class DcTracker extends Handler {
        } else {
            if (DBG) log("setInitialAttachApn: X selected Apn=" + initialAttachApnSetting);

            mPhone.mCi.setInitialAttachApn(createDataProfile(initialAttachApnSetting),
            mPhone.mCi.setInitialAttachApn(new DataProfile(initialAttachApnSetting),
                    mPhone.getServiceState().getDataRoamingFromRegistration(), null);
        }
    }
@@ -3282,7 +3281,7 @@ public class DcTracker extends Handler {
            ArrayList<DataProfile> dps = new ArrayList<DataProfile>();
            for (ApnSetting apn : mAllApnSettings) {
                if (apn.modemCognitive) {
                    DataProfile dp = createDataProfile(apn);
                    DataProfile dp = new DataProfile(apn);
                    if (!dps.contains(dp)) {
                        dps.add(dp);
                    }
@@ -4801,25 +4800,4 @@ public class DcTracker extends Handler {
        }
    }

    private static DataProfile createDataProfile(ApnSetting apn) {
        return createDataProfile(apn, apn.profileId);
    }

    @VisibleForTesting
    public static DataProfile createDataProfile(ApnSetting apn, int profileId) {
        int profileType;
        if (apn.bearerBitmask == 0) {
            profileType = DataProfile.TYPE_COMMON;
        } else if (ServiceState.bearerBitmapHasCdma(apn.bearerBitmask)) {
            profileType = DataProfile.TYPE_3GPP2;
        } else {
            profileType = DataProfile.TYPE_3GPP;
        }

        return new DataProfile(profileId, apn.apn, apn.protocol,
                apn.authType, apn.user, apn.password, profileType,
                apn.maxConnsTime, apn.maxConns, apn.waitTime, apn.carrierEnabled, apn.typesBitmap,
                apn.roamingProtocol, apn.bearerBitmask, apn.mtu, apn.mvnoType, apn.mvnoMatchData,
                apn.modemCognitive);
    }
}
Loading