Merge "Data profile refactoring"
This commit is contained in:
@@ -6451,7 +6451,7 @@ package android.telephony {
|
||||
package android.telephony.data {
|
||||
|
||||
public final class DataCallResponse implements android.os.Parcelable {
|
||||
ctor public DataCallResponse(int, int, int, int, @Nullable String, @Nullable String, @Nullable java.util.List<android.net.LinkAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.lang.String>, int);
|
||||
ctor public DataCallResponse(int, int, int, int, int, @Nullable String, @Nullable java.util.List<android.net.LinkAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.net.InetAddress>, @Nullable java.util.List<java.lang.String>, int);
|
||||
ctor public DataCallResponse(android.os.Parcel);
|
||||
method public int describeContents();
|
||||
method public int getActive();
|
||||
@@ -6462,9 +6462,9 @@ package android.telephony.data {
|
||||
method @NonNull public String getIfname();
|
||||
method public int getMtu();
|
||||
method @NonNull public java.util.List<java.lang.String> getPcscfs();
|
||||
method public int getProtocolType();
|
||||
method public int getStatus();
|
||||
method public int getSuggestedRetryTime();
|
||||
method @NonNull public String getType();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
|
||||
}
|
||||
@@ -6478,8 +6478,8 @@ package android.telephony.data {
|
||||
method public int getMtu();
|
||||
method public String getPassword();
|
||||
method public int getProfileId();
|
||||
method public String getProtocol();
|
||||
method public String getRoamingProtocol();
|
||||
method public int getProtocol();
|
||||
method public int getRoamingProtocol();
|
||||
method public int getSupportedApnTypesBitmap();
|
||||
method public int getType();
|
||||
method public String getUserName();
|
||||
|
||||
@@ -1631,8 +1631,9 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
|
||||
public static boolean bearerBitmapHasCdma(int radioTechnologyBitmap) {
|
||||
return (RIL_RADIO_CDMA_TECHNOLOGY_BITMASK & radioTechnologyBitmap) != 0;
|
||||
public static boolean bearerBitmapHasCdma(int networkTypeBitmask) {
|
||||
return (RIL_RADIO_CDMA_TECHNOLOGY_BITMASK
|
||||
& convertNetworkTypeBitmaskToBearerBitmask(networkTypeBitmask)) != 0;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.annotation.SystemApi;
|
||||
import android.net.LinkAddress;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.data.ApnSetting.ProtocolType;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
@@ -40,7 +41,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
private final int mSuggestedRetryTime;
|
||||
private final int mCid;
|
||||
private final int mActive;
|
||||
private final String mType;
|
||||
private final int mProtocolType;
|
||||
private final String mIfname;
|
||||
private final List<LinkAddress> mAddresses;
|
||||
private final List<InetAddress> mDnses;
|
||||
@@ -53,8 +54,8 @@ public final class DataCallResponse implements Parcelable {
|
||||
* @param suggestedRetryTime The suggested data retry time in milliseconds.
|
||||
* @param cid The unique id of the data connection.
|
||||
* @param active Data connection active status. 0 = inactive, 1 = dormant, 2 = active.
|
||||
* @param type The connection protocol, should be one of the PDP_type values in TS 27.007
|
||||
* section 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
|
||||
* @param protocolType The connection protocol, should be one of the PDP_type values in 3GPP
|
||||
* TS 27.007 section 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
|
||||
* @param ifname The network interface name.
|
||||
* @param addresses A list of addresses with optional "/" prefix length, e.g.,
|
||||
* "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". Typically 1 IPv4 or 1 IPv6 or
|
||||
@@ -71,7 +72,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
* either not sent a value or sent an invalid value.
|
||||
*/
|
||||
public DataCallResponse(int status, int suggestedRetryTime, int cid, int active,
|
||||
@Nullable String type, @Nullable String ifname,
|
||||
@ProtocolType int protocolType, @Nullable String ifname,
|
||||
@Nullable List<LinkAddress> addresses,
|
||||
@Nullable List<InetAddress> dnses,
|
||||
@Nullable List<InetAddress> gateways,
|
||||
@@ -80,7 +81,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
mSuggestedRetryTime = suggestedRetryTime;
|
||||
mCid = cid;
|
||||
mActive = active;
|
||||
mType = (type == null) ? "" : type;
|
||||
mProtocolType = protocolType;
|
||||
mIfname = (ifname == null) ? "" : ifname;
|
||||
mAddresses = (addresses == null) ? new ArrayList<>() : addresses;
|
||||
mDnses = (dnses == null) ? new ArrayList<>() : dnses;
|
||||
@@ -94,7 +95,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
mSuggestedRetryTime = source.readInt();
|
||||
mCid = source.readInt();
|
||||
mActive = source.readInt();
|
||||
mType = source.readString();
|
||||
mProtocolType = source.readInt();
|
||||
mIfname = source.readString();
|
||||
mAddresses = new ArrayList<>();
|
||||
source.readList(mAddresses, LinkAddress.class.getClassLoader());
|
||||
@@ -128,11 +129,10 @@ public final class DataCallResponse implements Parcelable {
|
||||
public int getActive() { return mActive; }
|
||||
|
||||
/**
|
||||
* @return The connection protocol, should be one of the PDP_type values in TS 27.007 section
|
||||
* 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
|
||||
* @return The connection protocol type.
|
||||
*/
|
||||
@NonNull
|
||||
public String getType() { return mType; }
|
||||
@ProtocolType
|
||||
public int getProtocolType() { return mProtocolType; }
|
||||
|
||||
/**
|
||||
* @return The network interface name.
|
||||
@@ -181,7 +181,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
.append(" retry=").append(mSuggestedRetryTime)
|
||||
.append(" cid=").append(mCid)
|
||||
.append(" active=").append(mActive)
|
||||
.append(" type=").append(mType)
|
||||
.append(" protocolType=").append(mProtocolType)
|
||||
.append(" ifname=").append(mIfname)
|
||||
.append(" addresses=").append(mAddresses)
|
||||
.append(" dnses=").append(mDnses)
|
||||
@@ -205,7 +205,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
&& this.mSuggestedRetryTime == other.mSuggestedRetryTime
|
||||
&& this.mCid == other.mCid
|
||||
&& this.mActive == other.mActive
|
||||
&& this.mType.equals(other.mType)
|
||||
&& this.mProtocolType == other.mProtocolType
|
||||
&& this.mIfname.equals(other.mIfname)
|
||||
&& mAddresses.size() == other.mAddresses.size()
|
||||
&& mAddresses.containsAll(other.mAddresses)
|
||||
@@ -220,8 +220,8 @@ public final class DataCallResponse implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mStatus, mSuggestedRetryTime, mCid, mActive, mType, mIfname, mAddresses,
|
||||
mDnses, mGateways, mPcscfs, mMtu);
|
||||
return Objects.hash(mStatus, mSuggestedRetryTime, mCid, mActive, mProtocolType, mIfname,
|
||||
mAddresses, mDnses, mGateways, mPcscfs, mMtu);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,7 +235,7 @@ public final class DataCallResponse implements Parcelable {
|
||||
dest.writeInt(mSuggestedRetryTime);
|
||||
dest.writeInt(mCid);
|
||||
dest.writeInt(mActive);
|
||||
dest.writeString(mType);
|
||||
dest.writeInt(mProtocolType);
|
||||
dest.writeString(mIfname);
|
||||
dest.writeList(mAddresses);
|
||||
dest.writeList(mDnses);
|
||||
|
||||
@@ -16,14 +16,23 @@
|
||||
|
||||
package android.telephony.data;
|
||||
|
||||
import static android.telephony.data.ApnSetting.ProtocolType;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Build;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.TelephonyManager.NetworkTypeBitMask;
|
||||
import android.telephony.data.ApnSetting.ApnType;
|
||||
import android.telephony.data.ApnSetting.AuthType;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.telephony.RILConstants;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Description of a mobile data profile used for establishing
|
||||
* data connections.
|
||||
@@ -32,24 +41,39 @@ import com.android.internal.telephony.RILConstants;
|
||||
*/
|
||||
@SystemApi
|
||||
public final class DataProfile implements Parcelable {
|
||||
/** @hide */
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(prefix = {"TYPE_"},
|
||||
value = {
|
||||
TYPE_COMMON,
|
||||
TYPE_3GPP,
|
||||
TYPE_3GPP2})
|
||||
public @interface DataProfileType {}
|
||||
|
||||
// The types indicating the data profile is used on GSM (3GPP) or CDMA (3GPP2) network.
|
||||
/** Common data profile */
|
||||
public static final int TYPE_COMMON = 0;
|
||||
|
||||
/** 3GPP type data profile */
|
||||
public static final int TYPE_3GPP = 1;
|
||||
|
||||
/** 3GPP2 type data profile */
|
||||
public static final int TYPE_3GPP2 = 2;
|
||||
|
||||
private final int mProfileId;
|
||||
|
||||
private final String mApn;
|
||||
|
||||
private final String mProtocol;
|
||||
@ProtocolType
|
||||
private final int mProtocolType;
|
||||
|
||||
@AuthType
|
||||
private final int mAuthType;
|
||||
|
||||
private final String mUserName;
|
||||
|
||||
private final String mPassword;
|
||||
|
||||
@DataProfileType
|
||||
private final int mType;
|
||||
|
||||
private final int mMaxConnsTime;
|
||||
@@ -60,10 +84,13 @@ public final class DataProfile implements Parcelable {
|
||||
|
||||
private final boolean mEnabled;
|
||||
|
||||
@ApnType
|
||||
private final int mSupportedApnTypesBitmap;
|
||||
|
||||
private final String mRoamingProtocol;
|
||||
@ProtocolType
|
||||
private final int mRoamingProtocolType;
|
||||
|
||||
@NetworkTypeBitMask
|
||||
private final int mBearerBitmap;
|
||||
|
||||
private final int mMtu;
|
||||
@@ -73,14 +100,14 @@ public final class DataProfile implements Parcelable {
|
||||
private final boolean mPreferred;
|
||||
|
||||
/** @hide */
|
||||
public DataProfile(int profileId, String apn, String protocol, int authType, String userName,
|
||||
String password, int type, int maxConnsTime, int maxConns, int waitTime,
|
||||
boolean enabled, int supportedApnTypesBitmap, String roamingProtocol,
|
||||
int bearerBitmap, int mtu, boolean persistent, boolean preferred) {
|
||||
|
||||
public DataProfile(int profileId, String apn, @ProtocolType int protocolType, int authType,
|
||||
String userName, String password, int type, int maxConnsTime, int maxConns,
|
||||
int waitTime, boolean enabled, @ApnType int supportedApnTypesBitmap,
|
||||
@ProtocolType int roamingProtocolType, @NetworkTypeBitMask int bearerBitmap,
|
||||
int mtu, boolean persistent, boolean preferred) {
|
||||
this.mProfileId = profileId;
|
||||
this.mApn = apn;
|
||||
this.mProtocol = protocol;
|
||||
this.mProtocolType = protocolType;
|
||||
if (authType == -1) {
|
||||
authType = TextUtils.isEmpty(userName) ? RILConstants.SETUP_DATA_AUTH_NONE
|
||||
: RILConstants.SETUP_DATA_AUTH_PAP_CHAP;
|
||||
@@ -95,7 +122,7 @@ public final class DataProfile implements Parcelable {
|
||||
this.mEnabled = enabled;
|
||||
|
||||
this.mSupportedApnTypesBitmap = supportedApnTypesBitmap;
|
||||
this.mRoamingProtocol = roamingProtocol;
|
||||
this.mRoamingProtocolType = roamingProtocolType;
|
||||
this.mBearerBitmap = bearerBitmap;
|
||||
this.mMtu = mtu;
|
||||
this.mPersistent = persistent;
|
||||
@@ -106,7 +133,7 @@ public final class DataProfile implements Parcelable {
|
||||
public DataProfile(Parcel source) {
|
||||
mProfileId = source.readInt();
|
||||
mApn = source.readString();
|
||||
mProtocol = source.readString();
|
||||
mProtocolType = source.readInt();
|
||||
mAuthType = source.readInt();
|
||||
mUserName = source.readString();
|
||||
mPassword = source.readString();
|
||||
@@ -116,7 +143,7 @@ public final class DataProfile implements Parcelable {
|
||||
mWaitTime = source.readInt();
|
||||
mEnabled = source.readBoolean();
|
||||
mSupportedApnTypesBitmap = source.readInt();
|
||||
mRoamingProtocol = source.readString();
|
||||
mRoamingProtocolType = source.readInt();
|
||||
mBearerBitmap = source.readInt();
|
||||
mMtu = source.readInt();
|
||||
mPersistent = source.readBoolean();
|
||||
@@ -134,16 +161,14 @@ public final class DataProfile implements Parcelable {
|
||||
public String getApn() { return mApn; }
|
||||
|
||||
/**
|
||||
* @return The connection protocol, should be one of the PDP_type values in TS 27.007 section
|
||||
* 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
|
||||
* @return The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
|
||||
*/
|
||||
public String getProtocol() { return mProtocol; }
|
||||
public @ProtocolType int getProtocol() { return mProtocolType; }
|
||||
|
||||
/**
|
||||
* @return The authentication protocol used for this PDP context
|
||||
* (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
|
||||
* @return The authentication protocol used for this PDP context.
|
||||
*/
|
||||
public int getAuthType() { return mAuthType; }
|
||||
public @AuthType int getAuthType() { return mAuthType; }
|
||||
|
||||
/**
|
||||
* @return The username for APN. Can be null.
|
||||
@@ -156,9 +181,9 @@ public final class DataProfile implements Parcelable {
|
||||
public String getPassword() { return mPassword; }
|
||||
|
||||
/**
|
||||
* @return The profile type. Could be one of TYPE_COMMON, TYPE_3GPP, or TYPE_3GPP2.
|
||||
* @return The profile type.
|
||||
*/
|
||||
public int getType() { return mType; }
|
||||
public @DataProfileType int getType() { return mType; }
|
||||
|
||||
/**
|
||||
* @return The period in seconds to limit the maximum connections.
|
||||
@@ -183,20 +208,19 @@ public final class DataProfile implements Parcelable {
|
||||
public boolean isEnabled() { return mEnabled; }
|
||||
|
||||
/**
|
||||
* @return The supported APN types bitmap. See RIL_ApnTypes for the value of each bit.
|
||||
* @return The supported APN types bitmap.
|
||||
*/
|
||||
public int getSupportedApnTypesBitmap() { return mSupportedApnTypesBitmap; }
|
||||
public @ApnType int getSupportedApnTypesBitmap() { return mSupportedApnTypesBitmap; }
|
||||
|
||||
/**
|
||||
* @return The connection protocol on roaming network, should be one of the PDP_type values in
|
||||
* TS 27.007 section 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
|
||||
* @return The connection protocol on roaming network defined in 3GPP TS 27.007 section 10.1.1.
|
||||
*/
|
||||
public String getRoamingProtocol() { return mRoamingProtocol; }
|
||||
public @ProtocolType int getRoamingProtocol() { return mRoamingProtocolType; }
|
||||
|
||||
/**
|
||||
* @return The bearer bitmap. See RIL_RadioAccessFamily for the value of each bit.
|
||||
* @return The bearer bitmap indicating the applicable networks for this data profile.
|
||||
*/
|
||||
public int getBearerBitmap() { return mBearerBitmap; }
|
||||
public @NetworkTypeBitMask int getBearerBitmap() { return mBearerBitmap; }
|
||||
|
||||
/**
|
||||
* @return The maximum transmission unit (MTU) size in bytes.
|
||||
@@ -222,12 +246,12 @@ public final class DataProfile implements Parcelable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataProfile=" + mProfileId + "/" + mProtocol + "/" + mAuthType
|
||||
return "DataProfile=" + mProfileId + "/" + mProtocolType + "/" + mAuthType
|
||||
+ "/" + (Build.IS_USER ? "***/***/***" :
|
||||
(mApn + "/" + mUserName + "/" + mPassword)) + "/" + mType + "/"
|
||||
+ mMaxConnsTime + "/" + mMaxConns + "/"
|
||||
+ mWaitTime + "/" + mEnabled + "/" + mSupportedApnTypesBitmap + "/"
|
||||
+ mRoamingProtocol + "/" + mBearerBitmap + "/" + mMtu + "/" + mPersistent + "/"
|
||||
+ mRoamingProtocolType + "/" + mBearerBitmap + "/" + mMtu + "/" + mPersistent + "/"
|
||||
+ mPreferred;
|
||||
}
|
||||
|
||||
@@ -242,7 +266,7 @@ public final class DataProfile implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mProfileId);
|
||||
dest.writeString(mApn);
|
||||
dest.writeString(mProtocol);
|
||||
dest.writeInt(mProtocolType);
|
||||
dest.writeInt(mAuthType);
|
||||
dest.writeString(mUserName);
|
||||
dest.writeString(mPassword);
|
||||
@@ -252,7 +276,7 @@ public final class DataProfile implements Parcelable {
|
||||
dest.writeInt(mWaitTime);
|
||||
dest.writeBoolean(mEnabled);
|
||||
dest.writeInt(mSupportedApnTypesBitmap);
|
||||
dest.writeString(mRoamingProtocol);
|
||||
dest.writeInt(mRoamingProtocolType);
|
||||
dest.writeInt(mBearerBitmap);
|
||||
dest.writeInt(mMtu);
|
||||
dest.writeBoolean(mPersistent);
|
||||
|
||||
@@ -192,31 +192,11 @@ public interface RILConstants {
|
||||
int LTE_ON_CDMA_FALSE = 0;
|
||||
int LTE_ON_CDMA_TRUE = 1;
|
||||
|
||||
int CDM_TTY_MODE_DISABLED = 0;
|
||||
int CDM_TTY_MODE_ENABLED = 1;
|
||||
|
||||
int CDM_TTY_FULL_MODE = 1;
|
||||
int CDM_TTY_HCO_MODE = 2;
|
||||
int CDM_TTY_VCO_MODE = 3;
|
||||
|
||||
/* Setup a packet data connection. See ril.h RIL_REQUEST_SETUP_DATA_CALL */
|
||||
int SETUP_DATA_TECH_CDMA = 0;
|
||||
int SETUP_DATA_TECH_GSM = 1;
|
||||
|
||||
int SETUP_DATA_AUTH_NONE = 0;
|
||||
int SETUP_DATA_AUTH_PAP = 1;
|
||||
int SETUP_DATA_AUTH_CHAP = 2;
|
||||
int SETUP_DATA_AUTH_PAP_CHAP = 3;
|
||||
|
||||
String SETUP_DATA_PROTOCOL_IP = "IP";
|
||||
String SETUP_DATA_PROTOCOL_IPV6 = "IPV6";
|
||||
String SETUP_DATA_PROTOCOL_IPV4V6 = "IPV4V6";
|
||||
|
||||
/* NV config radio reset types. */
|
||||
int NV_CONFIG_RELOAD_RESET = 1;
|
||||
int NV_CONFIG_ERASE_RESET = 2;
|
||||
int NV_CONFIG_FACTORY_RESET = 3;
|
||||
|
||||
/* LCE service related constants. */
|
||||
int LCE_NOT_AVAILABLE = -1;
|
||||
int LCE_STOPPED = 0;
|
||||
|
||||
Reference in New Issue
Block a user