Merge "Telephony data refactoring API changes" am: f6a697293d am: 01c4416295

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

Change-Id: I875b0a8f19f19dbc0b38373b1e054ca9f8979572
This commit is contained in:
Treehugger Robot
2022-03-08 18:52:13 +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_THERMAL = 3; // 0x3
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_UNKNOWN = -1; // 0xffffffff
field public static final int ERI_FLASH = 2; // 0x2
@@ -42030,6 +42031,8 @@ package android.telephony.data {
method public String getMmsProxyAddressAsString();
method public int getMmsProxyPort();
method public android.net.Uri getMmsc();
method public int getMtuV4();
method public int getMtuV6();
method public int getMvnoType();
method public int getNetworkTypeBitmask();
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 setMmsProxyPort(int);
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 setNetworkTypeBitmask(int);
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 setPersistent(boolean);
method @NonNull public android.telephony.data.ApnSetting.Builder setProfileId(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setProtocol(int);
method @Deprecated public android.telephony.data.ApnSetting.Builder setProxyAddress(java.net.InetAddress);
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 {
method public int describeContents();
method @NonNull public String getApn();
method public int getAuthType();
method public int getBearerBitmask();
method @Deprecated @NonNull public String getApn();
method @Nullable public android.telephony.data.ApnSetting getApnSetting();
method @Deprecated public int getAuthType();
method @Deprecated public int getBearerBitmask();
method @Deprecated public int getMtu();
method public int getMtuV4();
method public int getMtuV6();
method @Nullable public String getPassword();
method public int getProfileId();
method public int getProtocolType();
method public int getRoamingProtocolType();
method public int getSupportedApnTypesBitmask();
method @Deprecated public int getMtuV4();
method @Deprecated public int getMtuV6();
method @Deprecated @Nullable public String getPassword();
method @Deprecated public int getProfileId();
method @Deprecated public int getProtocolType();
method @Deprecated public int getRoamingProtocolType();
method @Deprecated public int getSupportedApnTypesBitmask();
method @Nullable public android.telephony.data.TrafficDescriptor getTrafficDescriptor();
method public int getType();
method @Nullable public String getUserName();
method @Deprecated @Nullable public String getUserName();
method public boolean isEnabled();
method public boolean isPersistent();
method @Deprecated public boolean isPersistent();
method public boolean isPreferred();
method public void writeToParcel(android.os.Parcel, int);
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();
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 setApn(@NonNull String);
method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
method @NonNull public android.telephony.data.DataProfile.Builder setApnSetting(@NonNull android.telephony.data.ApnSetting);
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 @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int);
method @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
method @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 setMtuV4(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
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 setProfileId(int);
method @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int);
method @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 setProfileId(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(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 setUserName(@NonNull String);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String);
}
public abstract class DataService extends android.app.Service {

View File

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

View File

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

View File

@@ -5985,6 +5985,7 @@ public class TelephonyManager {
DATA_CONNECTED,
DATA_SUSPENDED,
DATA_DISCONNECTING,
DATA_HANDOVER_IN_PROGRESS,
})
@Retention(RetentionPolicy.SOURCE)
public @interface DataState{}
@@ -6008,6 +6009,12 @@ public class TelephonyManager {
*/
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.
*/
@@ -6024,6 +6031,7 @@ public class TelephonyManager {
* @see #DATA_CONNECTED
* @see #DATA_SUSPENDED
* @see #DATA_DISCONNECTING
* @see #DATA_HANDOVER_IN_PROGRESS
*/
public int getDataState() {
try {

View File

@@ -521,11 +521,11 @@ public class ApnSetting implements Parcelable {
private final boolean mAlwaysOn;
/**
* Returns the MTU size of the IPv4 mobile interface to which the APN connected. Note this value
* is used only if MTU size is not provided in {@link DataCallResponse}.
* Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
* 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
* @hide
* @return the MTU size in bytes of the route.
*/
public int getMtuV4() {
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
* 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
* @hide
* @return the MTU size in bytes of the route.
*/
public int getMtuV6() {
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
* is used only if MTU size is not provided in {@link DataCallResponse}.
* Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
* 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
* @hide
* @param mtuV4 the MTU size in bytes of the route.
*/
public Builder setMtuV4(int mtuV4) {
public @NonNull Builder setMtuV4(int mtuV4) {
this.mMtuV4 = mtuV4;
return this;
}
/**
* Set 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}.
* Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv6 routes brought
* 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
* @hide
* @param mtuV6 the MTU size in bytes of the route.
*/
public Builder setMtuV6(int mtuV6) {
public @NonNull Builder setMtuV6(int mtuV6) {
this.mMtuV6 = mtuV6;
return this;
}
@@ -1779,14 +1779,24 @@ public class ApnSetting implements Parcelable {
/**
* Sets the profile id to which the APN saved in modem.
*
* @param profileId the profile id to set for the APN
* @hide
* @param profileId the profile id to set for the APN.
*/
public Builder setProfileId(int profileId) {
public @NonNull Builder setProfileId(int profileId) {
this.mProfileId = profileId;
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.
*

View File

@@ -38,8 +38,10 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
/**
* Description of a mobile data profile used for establishing
* data connections.
* Description of a mobile data profile used for establishing data networks. The data profile
* 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
*/
@@ -113,7 +115,9 @@ public final class DataProfile implements Parcelable {
/**
* @return Id of the data profile.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProfileId()} instead.
*/
@Deprecated
public int getProfileId() {
if (mApnSetting != null) {
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
* specifically defined by the carrier.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnName()} instead.
*/
@NonNull
public String getApn() {
@Deprecated
public @NonNull String getApn() {
if (mApnSetting != null) {
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.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProtocol()} instead.
*/
@Deprecated
public @ProtocolType int getProtocolType() {
if (mApnSetting != null) {
return mApnSetting.getProtocol();
@@ -145,7 +152,9 @@ public final class DataProfile implements Parcelable {
/**
* @return The authentication protocol used for this PDP context.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getAuthType()} instead.
*/
@Deprecated
public @AuthType int getAuthType() {
if (mApnSetting != null) {
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
public String getUserName() {
@Deprecated
public @Nullable String getUserName() {
if (mApnSetting != null) {
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
public String getPassword() {
@Deprecated
public @Nullable String getPassword() {
if (mApnSetting != null) {
return mApnSetting.getPassword();
}
@@ -232,7 +243,9 @@ public final class DataProfile implements Parcelable {
/**
* @return The supported APN types bitmask.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnTypeBitmask()} instead.
*/
@Deprecated
public @ApnType int getSupportedApnTypesBitmask() {
if (mApnSetting != null) {
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.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getRoamingProtocol()} instead.
*/
@Deprecated
public @ProtocolType int getRoamingProtocolType() {
if (mApnSetting != null) {
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.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getNetworkTypeBitmask()}
* instead.
*/
@Deprecated
public @NetworkTypeBitMask int getBearerBitmask() {
if (mApnSetting != null) {
return mApnSetting.getNetworkTypeBitmask();
@@ -262,7 +280,8 @@ public final class DataProfile implements Parcelable {
/**
* @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
public int getMtu() {
@@ -272,7 +291,9 @@ public final class DataProfile implements Parcelable {
/**
* This replaces the deprecated method getMtu.
* @return The maximum transmission unit (MTU) size in bytes, for IPv4.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV4()} instead.
*/
@Deprecated
public int getMtuV4() {
if (mApnSetting != null) {
return mApnSetting.getMtuV4();
@@ -282,7 +303,9 @@ public final class DataProfile implements Parcelable {
/**
* @return The maximum transmission unit (MTU) size in bytes, for IPv6.
* @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV6()} instead.
*/
@Deprecated
public int getMtuV6() {
if (mApnSetting != null) {
return mApnSetting.getMtuV6();
@@ -292,7 +315,9 @@ public final class DataProfile implements Parcelable {
/**
* @return {@code true} if modem must persist this data profile.
* @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#isPersistent()} instead.
*/
@Deprecated
public boolean isPersistent() {
if (mApnSetting != null) {
return mApnSetting.isPersistent();
@@ -320,16 +345,16 @@ public final class DataProfile implements Parcelable {
}
/**
* @return The APN setting
* @hide TODO: Remove before T is released.
* @return The APN setting {@link ApnSetting}, which is used to establish data network on
* 2G/3G/4G.
*/
public @Nullable ApnSetting getApnSetting() {
return mApnSetting;
}
/**
* @return The traffic descriptor
* @hide TODO: Remove before T is released.
* @return The traffic descriptor {@link TrafficDescriptor}, which can be used to establish
* data network on 5G.
*/
public @Nullable TrafficDescriptor getTrafficDescriptor() {
return mTrafficDescriptor;
@@ -539,7 +564,10 @@ public final class DataProfile implements Parcelable {
*
* @param profileId Network domain.
* @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) {
mProfileId = profileId;
return this;
@@ -551,7 +579,10 @@ public final class DataProfile implements Parcelable {
*
* @param apn Access point name
* @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) {
mApn = apn;
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.
* @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) {
mProtocolType = protocolType;
return this;
@@ -573,7 +607,10 @@ public final class DataProfile implements Parcelable {
*
* @param authType The authentication type
* @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) {
mAuthType = authType;
return this;
@@ -584,7 +621,10 @@ public final class DataProfile implements Parcelable {
*
* @param userName The user name
* @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) {
mUserName = userName;
return this;
@@ -595,7 +635,10 @@ public final class DataProfile implements Parcelable {
*
* @param password The password
* @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) {
mPassword = password;
return this;
@@ -628,7 +671,10 @@ public final class DataProfile implements Parcelable {
*
* @param supportedApnTypesBitmask The supported APN types bitmask.
* @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) {
mSupportedApnTypesBitmask = supportedApnTypesBitmask;
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.
* @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) {
mRoamingProtocolType = protocolType;
return this;
@@ -651,7 +700,10 @@ public final class DataProfile implements Parcelable {
* @param bearerBitmask The bearer bitmask indicating the applicable networks for this data
* profile.
* @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) {
mBearerBitmask = bearerBitmask;
return this;
@@ -662,7 +714,9 @@ public final class DataProfile implements Parcelable {
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @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
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.
* This replaces the deprecated method setMtu.
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @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) {
mMtuV4 = mtu;
return this;
@@ -687,7 +743,10 @@ public final class DataProfile implements Parcelable {
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @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) {
mMtuV6 = mtu;
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
* default (i.e internet) data connection successfully.
* @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) {
mPersistent = isPersistent;
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
* @return The same instance of the builder
*
* @hide // TODO: Remove before T is released.
* @param apnSetting The APN setting.
* @return The same instance of the builder.
*/
public @NonNull Builder setApnSetting(@NonNull ApnSetting 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
* @return The same instance of the builder
*
* @hide // TODO: Remove before T is released.
* @param trafficDescriptor The traffic descriptor.
* @return The same instance of the builder.
*/
public @NonNull Builder setTrafficDescriptor(@NonNull TrafficDescriptor 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() {
if (mApnSetting == null && mApn != null) {