Merge "Telephony data refactoring API changes" am: f6a697293d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2011720

Change-Id: I64a1b5d3ffdc0b9996d7d8d6ed6b292b3a34752e
This commit is contained in:
Treehugger Robot
2022-03-08 18:26:37 +00:00
committed by Automerger Merge Worker
7 changed files with 168 additions and 73 deletions

View File

@@ -41762,6 +41762,7 @@ package android.telephony {
field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1 field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1
field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3 field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3
field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0 field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
field public static final int DATA_HANDOVER_IN_PROGRESS = 5; // 0x5
field public static final int DATA_SUSPENDED = 3; // 0x3 field public static final int DATA_SUSPENDED = 3; // 0x3
field public static final int DATA_UNKNOWN = -1; // 0xffffffff field public static final int DATA_UNKNOWN = -1; // 0xffffffff
field public static final int ERI_FLASH = 2; // 0x2 field public static final int ERI_FLASH = 2; // 0x2
@@ -42030,6 +42031,8 @@ package android.telephony.data {
method public String getMmsProxyAddressAsString(); method public String getMmsProxyAddressAsString();
method public int getMmsProxyPort(); method public int getMmsProxyPort();
method public android.net.Uri getMmsc(); method public android.net.Uri getMmsc();
method public int getMtuV4();
method public int getMtuV6();
method public int getMvnoType(); method public int getMvnoType();
method public int getNetworkTypeBitmask(); method public int getNetworkTypeBitmask();
method public String getOperatorNumeric(); method public String getOperatorNumeric();
@@ -42086,10 +42089,14 @@ package android.telephony.data {
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(@Nullable String); method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(@Nullable String);
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyPort(int); method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyPort(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsc(@Nullable android.net.Uri); method @NonNull public android.telephony.data.ApnSetting.Builder setMmsc(@Nullable android.net.Uri);
method @NonNull public android.telephony.data.ApnSetting.Builder setMtuV4(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setMtuV6(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setMvnoType(int); method @NonNull public android.telephony.data.ApnSetting.Builder setMvnoType(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setNetworkTypeBitmask(int); method @NonNull public android.telephony.data.ApnSetting.Builder setNetworkTypeBitmask(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setOperatorNumeric(@Nullable String); method @NonNull public android.telephony.data.ApnSetting.Builder setOperatorNumeric(@Nullable String);
method @NonNull public android.telephony.data.ApnSetting.Builder setPassword(@Nullable String); method @NonNull public android.telephony.data.ApnSetting.Builder setPassword(@Nullable String);
method @NonNull public android.telephony.data.ApnSetting.Builder setPersistent(boolean);
method @NonNull public android.telephony.data.ApnSetting.Builder setProfileId(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setProtocol(int); method @NonNull public android.telephony.data.ApnSetting.Builder setProtocol(int);
method @Deprecated public android.telephony.data.ApnSetting.Builder setProxyAddress(java.net.InetAddress); method @Deprecated public android.telephony.data.ApnSetting.Builder setProxyAddress(java.net.InetAddress);
method @NonNull public android.telephony.data.ApnSetting.Builder setProxyAddress(@Nullable String); method @NonNull public android.telephony.data.ApnSetting.Builder setProxyAddress(@Nullable String);

View File

@@ -12070,21 +12070,23 @@ package android.telephony.data {
public final class DataProfile implements android.os.Parcelable { public final class DataProfile implements android.os.Parcelable {
method public int describeContents(); method public int describeContents();
method @NonNull public String getApn(); method @Deprecated @NonNull public String getApn();
method public int getAuthType(); method @Nullable public android.telephony.data.ApnSetting getApnSetting();
method public int getBearerBitmask(); method @Deprecated public int getAuthType();
method @Deprecated public int getBearerBitmask();
method @Deprecated public int getMtu(); method @Deprecated public int getMtu();
method public int getMtuV4(); method @Deprecated public int getMtuV4();
method public int getMtuV6(); method @Deprecated public int getMtuV6();
method @Nullable public String getPassword(); method @Deprecated @Nullable public String getPassword();
method public int getProfileId(); method @Deprecated public int getProfileId();
method public int getProtocolType(); method @Deprecated public int getProtocolType();
method public int getRoamingProtocolType(); method @Deprecated public int getRoamingProtocolType();
method public int getSupportedApnTypesBitmask(); method @Deprecated public int getSupportedApnTypesBitmask();
method @Nullable public android.telephony.data.TrafficDescriptor getTrafficDescriptor();
method public int getType(); method public int getType();
method @Nullable public String getUserName(); method @Deprecated @Nullable public String getUserName();
method public boolean isEnabled(); method public boolean isEnabled();
method public boolean isPersistent(); method @Deprecated public boolean isPersistent();
method public boolean isPreferred(); method public boolean isPreferred();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR; field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR;
@@ -12097,21 +12099,23 @@ package android.telephony.data {
ctor public DataProfile.Builder(); ctor public DataProfile.Builder();
method @NonNull public android.telephony.data.DataProfile build(); method @NonNull public android.telephony.data.DataProfile build();
method @NonNull public android.telephony.data.DataProfile.Builder enable(boolean); method @NonNull public android.telephony.data.DataProfile.Builder enable(boolean);
method @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int); method @NonNull public android.telephony.data.DataProfile.Builder setApnSetting(@NonNull android.telephony.data.ApnSetting);
method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtu(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtu(int);
method @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int);
method @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
method @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean);
method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean); method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean);
method @NonNull public android.telephony.data.DataProfile.Builder setProfileId(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setProfileId(int);
method @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int);
method @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(int);
method @NonNull public android.telephony.data.DataProfile.Builder setSupportedApnTypesBitmask(int); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setSupportedApnTypesBitmask(int);
method @NonNull public android.telephony.data.DataProfile.Builder setTrafficDescriptor(@NonNull android.telephony.data.TrafficDescriptor);
method @NonNull public android.telephony.data.DataProfile.Builder setType(int); method @NonNull public android.telephony.data.DataProfile.Builder setType(int);
method @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String); method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String);
} }
public abstract class DataService extends android.app.Service { public abstract class DataService extends android.app.Service {

View File

@@ -743,6 +743,7 @@ public class PhoneStateListener {
* @see TelephonyManager#DATA_CONNECTING * @see TelephonyManager#DATA_CONNECTING
* @see TelephonyManager#DATA_CONNECTED * @see TelephonyManager#DATA_CONNECTED
* @see TelephonyManager#DATA_SUSPENDED * @see TelephonyManager#DATA_SUSPENDED
* @see TelephonyManager#DATA_HANDOVER_IN_PROGRESS
* @deprecated Use {@link TelephonyCallback.DataConnectionStateListener} instead. * @deprecated Use {@link TelephonyCallback.DataConnectionStateListener} instead.
*/ */
@Deprecated @Deprecated

View File

@@ -792,6 +792,7 @@ public class TelephonyCallback {
* @see TelephonyManager#DATA_CONNECTING * @see TelephonyManager#DATA_CONNECTING
* @see TelephonyManager#DATA_CONNECTED * @see TelephonyManager#DATA_CONNECTED
* @see TelephonyManager#DATA_SUSPENDED * @see TelephonyManager#DATA_SUSPENDED
* @see TelephonyManager#DATA_HANDOVER_IN_PROGRESS
*/ */
void onDataConnectionStateChanged(@TelephonyManager.DataState int state, void onDataConnectionStateChanged(@TelephonyManager.DataState int state,
@Annotation.NetworkType int networkType); @Annotation.NetworkType int networkType);

View File

@@ -5985,6 +5985,7 @@ public class TelephonyManager {
DATA_CONNECTED, DATA_CONNECTED,
DATA_SUSPENDED, DATA_SUSPENDED,
DATA_DISCONNECTING, DATA_DISCONNECTING,
DATA_HANDOVER_IN_PROGRESS,
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface DataState{} public @interface DataState{}
@@ -6008,6 +6009,12 @@ public class TelephonyManager {
*/ */
public static final int DATA_DISCONNECTING = 4; public static final int DATA_DISCONNECTING = 4;
/**
* Data connection state: Handover in progress. The connection is being transited from cellular
* network to IWLAN, or from IWLAN to cellular network.
*/
public static final int DATA_HANDOVER_IN_PROGRESS = 5;
/** /**
* Used for checking if the SDK version for {@link TelephonyManager#getDataState} is above Q. * Used for checking if the SDK version for {@link TelephonyManager#getDataState} is above Q.
*/ */
@@ -6024,6 +6031,7 @@ public class TelephonyManager {
* @see #DATA_CONNECTED * @see #DATA_CONNECTED
* @see #DATA_SUSPENDED * @see #DATA_SUSPENDED
* @see #DATA_DISCONNECTING * @see #DATA_DISCONNECTING
* @see #DATA_HANDOVER_IN_PROGRESS
*/ */
public int getDataState() { public int getDataState() {
try { try {

View File

@@ -521,11 +521,11 @@ public class ApnSetting implements Parcelable {
private final boolean mAlwaysOn; private final boolean mAlwaysOn;
/** /**
* Returns the MTU size of the IPv4 mobile interface to which the APN connected. Note this value * Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
* is used only if MTU size is not provided in {@link DataCallResponse}. * up by this APN setting. Note this value will only be used when MTU size is not provided
* in {@link DataCallResponse#getMtuV4()} during network bring up.
* *
* @return the MTU size of the APN * @return the MTU size in bytes of the route.
* @hide
*/ */
public int getMtuV4() { public int getMtuV4() {
return mMtuV4; return mMtuV4;
@@ -533,10 +533,10 @@ public class ApnSetting implements Parcelable {
/** /**
* Returns the MTU size of the IPv6 mobile interface to which the APN connected. Note this value * Returns the MTU size of the IPv6 mobile interface to which the APN connected. Note this value
* is used only if MTU size is not provided in {@link DataCallResponse}. * will only be used when MTU size is not provided in {@link DataCallResponse#getMtuV6()}
* during network bring up.
* *
* @return the MTU size of the APN * @return the MTU size in bytes of the route.
* @hide
*/ */
public int getMtuV6() { public int getMtuV6() {
return mMtuV6; return mMtuV6;
@@ -1753,25 +1753,25 @@ public class ApnSetting implements Parcelable {
} }
/** /**
* Set the MTU size of the IPv4 mobile interface to which the APN connected. Note this value * Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
* is used only if MTU size is not provided in {@link DataCallResponse}. * up by this APN setting. Note this value will only be used when MTU size is not provided
* in {@link DataCallResponse#getMtuV4()} during network bring up.
* *
* @param mtuV4 the MTU size to set for the APN * @param mtuV4 the MTU size in bytes of the route.
* @hide
*/ */
public Builder setMtuV4(int mtuV4) { public @NonNull Builder setMtuV4(int mtuV4) {
this.mMtuV4 = mtuV4; this.mMtuV4 = mtuV4;
return this; return this;
} }
/** /**
* Set the MTU size of the IPv6 mobile interface to which the APN connected. Note this value * Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv6 routes brought
* is used only if MTU size is not provided in {@link DataCallResponse}. * up by this APN setting. Note this value will only be used when MTU size is not provided
* in {@link DataCallResponse#getMtuV6()} during network bring up.
* *
* @param mtuV6 the MTU size to set for the APN * @param mtuV6 the MTU size in bytes of the route.
* @hide
*/ */
public Builder setMtuV6(int mtuV6) { public @NonNull Builder setMtuV6(int mtuV6) {
this.mMtuV6 = mtuV6; this.mMtuV6 = mtuV6;
return this; return this;
} }
@@ -1779,14 +1779,24 @@ public class ApnSetting implements Parcelable {
/** /**
* Sets the profile id to which the APN saved in modem. * Sets the profile id to which the APN saved in modem.
* *
* @param profileId the profile id to set for the APN * @param profileId the profile id to set for the APN.
* @hide
*/ */
public Builder setProfileId(int profileId) { public @NonNull Builder setProfileId(int profileId) {
this.mProfileId = profileId; this.mProfileId = profileId;
return this; return this;
} }
/**
* Set if the APN setting should be persistent/non-persistent in modem.
*
* @param isPersistent {@code true} if this APN setting should be persistent/non-persistent
* in modem.
* @return The same instance of the builder.
*/
public @NonNull Builder setPersistent(boolean isPersistent) {
return setModemCognitive(isPersistent);
}
/** /**
* Sets if the APN setting is to be set in modem. * Sets if the APN setting is to be set in modem.
* *

View File

@@ -38,8 +38,10 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Objects; import java.util.Objects;
/** /**
* Description of a mobile data profile used for establishing * Description of a mobile data profile used for establishing data networks. The data profile
* data connections. * consist an {@link ApnSetting} which is needed for 2G/3G/4G networks bring up, and a
* {@link TrafficDescriptor} contains additional information that can be used for 5G standalone
* network bring up.
* *
* @hide * @hide
*/ */
@@ -113,7 +115,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return Id of the data profile. * @return Id of the data profile.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProfileId()} instead.
*/ */
@Deprecated
public int getProfileId() { public int getProfileId() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getProfileId(); return mApnSetting.getProfileId();
@@ -124,9 +128,10 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The APN (Access Point Name) to establish data connection. This is a string * @return The APN (Access Point Name) to establish data connection. This is a string
* specifically defined by the carrier. * specifically defined by the carrier.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnName()} instead.
*/ */
@NonNull @Deprecated
public String getApn() { public @NonNull String getApn() {
if (mApnSetting != null) { if (mApnSetting != null) {
return TextUtils.emptyIfNull(mApnSetting.getApnName()); return TextUtils.emptyIfNull(mApnSetting.getApnName());
} }
@@ -135,7 +140,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The connection protocol defined in 3GPP TS 27.007 section 10.1.1. * @return The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProtocol()} instead.
*/ */
@Deprecated
public @ProtocolType int getProtocolType() { public @ProtocolType int getProtocolType() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getProtocol(); return mApnSetting.getProtocol();
@@ -145,7 +152,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The authentication protocol used for this PDP context. * @return The authentication protocol used for this PDP context.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getAuthType()} instead.
*/ */
@Deprecated
public @AuthType int getAuthType() { public @AuthType int getAuthType() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getAuthType(); return mApnSetting.getAuthType();
@@ -154,10 +163,11 @@ public final class DataProfile implements Parcelable {
} }
/** /**
* @return The username for APN. Can be null. * @return The username for APN.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getUser()} instead.
*/ */
@Nullable @Deprecated
public String getUserName() { public @Nullable String getUserName() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getUser(); return mApnSetting.getUser();
} }
@@ -165,10 +175,11 @@ public final class DataProfile implements Parcelable {
} }
/** /**
* @return The password for APN. Can be null. * @return The password for APN.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getPassword()} instead.
*/ */
@Nullable @Deprecated
public String getPassword() { public @Nullable String getPassword() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getPassword(); return mApnSetting.getPassword();
} }
@@ -232,7 +243,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The supported APN types bitmask. * @return The supported APN types bitmask.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnTypeBitmask()} instead.
*/ */
@Deprecated
public @ApnType int getSupportedApnTypesBitmask() { public @ApnType int getSupportedApnTypesBitmask() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getApnTypeBitmask(); return mApnSetting.getApnTypeBitmask();
@@ -242,7 +255,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The connection protocol on roaming network defined in 3GPP TS 27.007 section 10.1.1. * @return The connection protocol on roaming network defined in 3GPP TS 27.007 section 10.1.1.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getRoamingProtocol()} instead.
*/ */
@Deprecated
public @ProtocolType int getRoamingProtocolType() { public @ProtocolType int getRoamingProtocolType() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getRoamingProtocol(); return mApnSetting.getRoamingProtocol();
@@ -252,7 +267,10 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The bearer bitmask indicating the applicable networks for this data profile. * @return The bearer bitmask indicating the applicable networks for this data profile.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getNetworkTypeBitmask()}
* instead.
*/ */
@Deprecated
public @NetworkTypeBitMask int getBearerBitmask() { public @NetworkTypeBitMask int getBearerBitmask() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getNetworkTypeBitmask(); return mApnSetting.getNetworkTypeBitmask();
@@ -262,7 +280,8 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The maximum transmission unit (MTU) size in bytes. * @return The maximum transmission unit (MTU) size in bytes.
* @deprecated use {@link #getMtuV4} or {@link #getMtuV6} instead. * @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV4()}/
* {@link ApnSetting#getMtuV6()} instead.
*/ */
@Deprecated @Deprecated
public int getMtu() { public int getMtu() {
@@ -272,7 +291,9 @@ public final class DataProfile implements Parcelable {
/** /**
* This replaces the deprecated method getMtu. * This replaces the deprecated method getMtu.
* @return The maximum transmission unit (MTU) size in bytes, for IPv4. * @return The maximum transmission unit (MTU) size in bytes, for IPv4.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV4()} instead.
*/ */
@Deprecated
public int getMtuV4() { public int getMtuV4() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getMtuV4(); return mApnSetting.getMtuV4();
@@ -282,7 +303,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return The maximum transmission unit (MTU) size in bytes, for IPv6. * @return The maximum transmission unit (MTU) size in bytes, for IPv6.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV6()} instead.
*/ */
@Deprecated
public int getMtuV6() { public int getMtuV6() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.getMtuV6(); return mApnSetting.getMtuV6();
@@ -292,7 +315,9 @@ public final class DataProfile implements Parcelable {
/** /**
* @return {@code true} if modem must persist this data profile. * @return {@code true} if modem must persist this data profile.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#isPersistent()} instead.
*/ */
@Deprecated
public boolean isPersistent() { public boolean isPersistent() {
if (mApnSetting != null) { if (mApnSetting != null) {
return mApnSetting.isPersistent(); return mApnSetting.isPersistent();
@@ -320,16 +345,16 @@ public final class DataProfile implements Parcelable {
} }
/** /**
* @return The APN setting * @return The APN setting {@link ApnSetting}, which is used to establish data network on
* @hide TODO: Remove before T is released. * 2G/3G/4G.
*/ */
public @Nullable ApnSetting getApnSetting() { public @Nullable ApnSetting getApnSetting() {
return mApnSetting; return mApnSetting;
} }
/** /**
* @return The traffic descriptor * @return The traffic descriptor {@link TrafficDescriptor}, which can be used to establish
* @hide TODO: Remove before T is released. * data network on 5G.
*/ */
public @Nullable TrafficDescriptor getTrafficDescriptor() { public @Nullable TrafficDescriptor getTrafficDescriptor() {
return mTrafficDescriptor; return mTrafficDescriptor;
@@ -539,7 +564,10 @@ public final class DataProfile implements Parcelable {
* *
* @param profileId Network domain. * @param profileId Network domain.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setProfileId(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setProfileId(int profileId) { public @NonNull Builder setProfileId(int profileId) {
mProfileId = profileId; mProfileId = profileId;
return this; return this;
@@ -551,7 +579,10 @@ public final class DataProfile implements Parcelable {
* *
* @param apn Access point name * @param apn Access point name
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setApnName(String)} instead.
*/ */
@Deprecated
public @NonNull Builder setApn(@NonNull String apn) { public @NonNull Builder setApn(@NonNull String apn) {
mApn = apn; mApn = apn;
return this; return this;
@@ -562,7 +593,10 @@ public final class DataProfile implements Parcelable {
* *
* @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1. * @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setProtocol(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setProtocolType(@ProtocolType int protocolType) { public @NonNull Builder setProtocolType(@ProtocolType int protocolType) {
mProtocolType = protocolType; mProtocolType = protocolType;
return this; return this;
@@ -573,7 +607,10 @@ public final class DataProfile implements Parcelable {
* *
* @param authType The authentication type * @param authType The authentication type
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setAuthType(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setAuthType(@AuthType int authType) { public @NonNull Builder setAuthType(@AuthType int authType) {
mAuthType = authType; mAuthType = authType;
return this; return this;
@@ -584,7 +621,10 @@ public final class DataProfile implements Parcelable {
* *
* @param userName The user name * @param userName The user name
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setUser(String)} instead.
*/ */
@Deprecated
public @NonNull Builder setUserName(@NonNull String userName) { public @NonNull Builder setUserName(@NonNull String userName) {
mUserName = userName; mUserName = userName;
return this; return this;
@@ -595,7 +635,10 @@ public final class DataProfile implements Parcelable {
* *
* @param password The password * @param password The password
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setPassword(String)} (int)} instead.
*/ */
@Deprecated
public @NonNull Builder setPassword(@NonNull String password) { public @NonNull Builder setPassword(@NonNull String password) {
mPassword = password; mPassword = password;
return this; return this;
@@ -628,7 +671,10 @@ public final class DataProfile implements Parcelable {
* *
* @param supportedApnTypesBitmask The supported APN types bitmask. * @param supportedApnTypesBitmask The supported APN types bitmask.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setApnTypeBitmask(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setSupportedApnTypesBitmask(@ApnType int supportedApnTypesBitmask) { public @NonNull Builder setSupportedApnTypesBitmask(@ApnType int supportedApnTypesBitmask) {
mSupportedApnTypesBitmask = supportedApnTypesBitmask; mSupportedApnTypesBitmask = supportedApnTypesBitmask;
return this; return this;
@@ -639,7 +685,10 @@ public final class DataProfile implements Parcelable {
* *
* @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1. * @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setRoamingProtocol(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setRoamingProtocolType(@ProtocolType int protocolType) { public @NonNull Builder setRoamingProtocolType(@ProtocolType int protocolType) {
mRoamingProtocolType = protocolType; mRoamingProtocolType = protocolType;
return this; return this;
@@ -651,7 +700,10 @@ public final class DataProfile implements Parcelable {
* @param bearerBitmask The bearer bitmask indicating the applicable networks for this data * @param bearerBitmask The bearer bitmask indicating the applicable networks for this data
* profile. * profile.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setNetworkTypeBitmask(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setBearerBitmask(@NetworkTypeBitMask int bearerBitmask) { public @NonNull Builder setBearerBitmask(@NetworkTypeBitMask int bearerBitmask) {
mBearerBitmask = bearerBitmask; mBearerBitmask = bearerBitmask;
return this; return this;
@@ -662,7 +714,9 @@ public final class DataProfile implements Parcelable {
* *
* @param mtu The maximum transmission unit (MTU) size in bytes. * @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated use {@link #setApnSetting(ApnSetting)} instead. * @deprecated use {@link #setApnSetting(ApnSetting)} and
* {@link ApnSetting.Builder#setMtuV4(int)}/{@link ApnSetting.Builder#setMtuV6(int)}
* instead.
*/ */
@Deprecated @Deprecated
public @NonNull Builder setMtu(int mtu) { public @NonNull Builder setMtu(int mtu) {
@@ -672,11 +726,13 @@ public final class DataProfile implements Parcelable {
/** /**
* Set the maximum transmission unit (MTU) size in bytes, for IPv4. * Set the maximum transmission unit (MTU) size in bytes, for IPv4.
* This replaces the deprecated method setMtu.
* *
* @param mtu The maximum transmission unit (MTU) size in bytes. * @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
* {@link ApnSetting.Builder#setMtuV4(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setMtuV4(int mtu) { public @NonNull Builder setMtuV4(int mtu) {
mMtuV4 = mtu; mMtuV4 = mtu;
return this; return this;
@@ -687,7 +743,10 @@ public final class DataProfile implements Parcelable {
* *
* @param mtu The maximum transmission unit (MTU) size in bytes. * @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
* {@link ApnSetting.Builder#setMtuV6(int)} instead.
*/ */
@Deprecated
public @NonNull Builder setMtuV6(int mtu) { public @NonNull Builder setMtuV6(int mtu) {
mMtuV6 = mtu; mMtuV6 = mtu;
return this; return this;
@@ -712,19 +771,23 @@ public final class DataProfile implements Parcelable {
* @param isPersistent {@code true} if this data profile was used to bring up the last * @param isPersistent {@code true} if this data profile was used to bring up the last
* default (i.e internet) data connection successfully. * default (i.e internet) data connection successfully.
* @return The same instance of the builder. * @return The same instance of the builder.
* @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
* {@link ApnSetting.Builder#setPersistent(boolean)} instead.
*/ */
@Deprecated
public @NonNull Builder setPersistent(boolean isPersistent) { public @NonNull Builder setPersistent(boolean isPersistent) {
mPersistent = isPersistent; mPersistent = isPersistent;
return this; return this;
} }
/** /**
* Set APN setting. * Set the APN setting. Note that if an APN setting is not set here, then either
* {@link #setApn(String)} or {@link #setTrafficDescriptor(TrafficDescriptor)} must be
* called. Otherwise {@link IllegalArgumentException} will be thrown when {@link #build()}
* the data profile.
* *
* @param apnSetting APN setting * @param apnSetting The APN setting.
* @return The same instance of the builder * @return The same instance of the builder.
*
* @hide // TODO: Remove before T is released.
*/ */
public @NonNull Builder setApnSetting(@NonNull ApnSetting apnSetting) { public @NonNull Builder setApnSetting(@NonNull ApnSetting apnSetting) {
mApnSetting = apnSetting; mApnSetting = apnSetting;
@@ -732,12 +795,13 @@ public final class DataProfile implements Parcelable {
} }
/** /**
* Set traffic descriptor. * Set the traffic descriptor. Note that if a traffic descriptor is not set here, then
* either {@link #setApnSetting(ApnSetting)} or {@link #setApn(String)} must be called.
* Otherwise {@link IllegalArgumentException} will be thrown when {@link #build()} the data
* profile.
* *
* @param trafficDescriptor Traffic descriptor * @param trafficDescriptor The traffic descriptor.
* @return The same instance of the builder * @return The same instance of the builder.
*
* @hide // TODO: Remove before T is released.
*/ */
public @NonNull Builder setTrafficDescriptor(@NonNull TrafficDescriptor trafficDescriptor) { public @NonNull Builder setTrafficDescriptor(@NonNull TrafficDescriptor trafficDescriptor) {
mTrafficDescriptor = trafficDescriptor; mTrafficDescriptor = trafficDescriptor;
@@ -745,9 +809,9 @@ public final class DataProfile implements Parcelable {
} }
/** /**
* Build the DataProfile object * Build the DataProfile object.
* *
* @return The data profile object * @return The data profile object.
*/ */
public @NonNull DataProfile build() { public @NonNull DataProfile build() {
if (mApnSetting == null && mApn != null) { if (mApnSetting == null && mApn != null) {