IWLAN API review changes
Made several API changes per API council
suggestions.
Test: Manual + unit tests
Bug: 127812471
Bug: 128607082
Change-Id: I0f93c07207b10b566e9f858361e55b18dc0881a0
diff --git a/api/system-current.txt b/api/system-current.txt
index 2fa91cf..e837d4e 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7719,19 +7719,19 @@
ctor public NetworkService();
method public android.os.IBinder onBind(android.content.Intent);
method @Nullable public abstract android.telephony.NetworkService.NetworkServiceProvider onCreateNetworkServiceProvider(int);
- field public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
+ field public static final String SERVICE_INTERFACE = "android.telephony.NetworkService";
}
public abstract class NetworkService.NetworkServiceProvider implements java.lang.AutoCloseable {
ctor public NetworkService.NetworkServiceProvider(int);
method public abstract void close();
- method public void getNetworkRegistrationInfo(int, @NonNull android.telephony.NetworkServiceCallback);
method public final int getSlotIndex();
method public final void notifyNetworkRegistrationInfoChanged();
+ method public void requestNetworkRegistrationInfo(int, @NonNull android.telephony.NetworkServiceCallback);
}
public class NetworkServiceCallback {
- method public void onGetNetworkRegistrationInfoComplete(int, @Nullable android.telephony.NetworkRegistrationInfo);
+ method public void onRequestNetworkRegistrationInfoComplete(int, @Nullable android.telephony.NetworkRegistrationInfo);
field public static final int RESULT_ERROR_BUSY = 3; // 0x3
field public static final int RESULT_ERROR_FAILED = 5; // 0x5
field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
@@ -8164,39 +8164,55 @@
package android.telephony.data {
public final class DataCallResponse implements android.os.Parcelable {
- 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);
method public int describeContents();
- method public int getActive();
method @NonNull public java.util.List<android.net.LinkAddress> getAddresses();
- method public int getCallId();
- method @NonNull public java.util.List<java.net.InetAddress> getDnses();
- method @NonNull public java.util.List<java.net.InetAddress> getGateways();
- method @NonNull public String getIfname();
+ method public int getCause();
+ method @NonNull public java.util.List<java.net.InetAddress> getDnsAddresses();
+ method @NonNull public java.util.List<java.net.InetAddress> getGatewayAddresses();
+ method public int getId();
+ method @NonNull public String getInterfaceName();
+ method public int getLinkStatus();
method public int getMtu();
- method @NonNull public java.util.List<java.lang.String> getPcscfs();
+ method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
method public int getProtocolType();
- method public int getStatus();
method public int getSuggestedRetryTime();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataCallResponse> CREATOR;
+ field public static final int LINK_STATUS_ACTIVE = 2; // 0x2
+ field public static final int LINK_STATUS_DORMANT = 1; // 0x1
+ field public static final int LINK_STATUS_INACTIVE = 0; // 0x0
+ field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff
+ }
+
+ public static final class DataCallResponse.Builder {
+ ctor public DataCallResponse.Builder();
+ method @NonNull public android.telephony.data.DataCallResponse build();
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setAddresses(@NonNull java.util.List<android.net.LinkAddress>);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setCause(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setDnsAddresses(@NonNull java.util.List<java.net.InetAddress>);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setGatewayAddresses(@NonNull java.util.List<java.net.InetAddress>);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setId(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setInterfaceName(@NonNull String);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setLinkStatus(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setMtu(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int);
+ method @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
}
public final class DataProfile implements android.os.Parcelable {
method public int describeContents();
method @NonNull public String getApn();
method public int getAuthType();
- method public int getBearerBitmap();
- method public int getMaxConns();
- method public int getMaxConnsTime();
+ method public int getBearerBitmask();
method public int getMtu();
method @Nullable public String getPassword();
method public int getProfileId();
- method public int getProtocol();
- method public int getRoamingProtocol();
- method public int getSupportedApnTypesBitmap();
+ method public int getProtocolType();
+ method public int getRoamingProtocolType();
+ method public int getSupportedApnTypesBitmask();
method public int getType();
method @Nullable public String getUserName();
- method public int getWaitTime();
method public boolean isEnabled();
method public boolean isPersistent();
method public boolean isPreferred();
@@ -8207,32 +8223,52 @@
field public static final int TYPE_COMMON = 0; // 0x0
}
+ public static final class DataProfile.Builder {
+ 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 @NonNull public android.telephony.data.DataProfile.Builder setMtu(int);
+ method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
+ method @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 @NonNull public android.telephony.data.DataProfile.Builder setType(int);
+ method @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String);
+ }
+
public abstract class DataService extends android.app.Service {
ctor public DataService();
method public android.os.IBinder onBind(android.content.Intent);
method @Nullable public abstract android.telephony.data.DataService.DataServiceProvider onCreateDataServiceProvider(int);
- field public static final String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
field public static final int REQUEST_REASON_HANDOVER = 3; // 0x3
field public static final int REQUEST_REASON_NORMAL = 1; // 0x1
field public static final int REQUEST_REASON_SHUTDOWN = 2; // 0x2
+ field public static final int REQUEST_REASON_UNKNOWN = 0; // 0x0
+ field public static final String SERVICE_INTERFACE = "android.telephony.data.DataService";
}
public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable {
ctor public DataService.DataServiceProvider(int);
method public abstract void close();
method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback);
- method public void getDataCallList(@NonNull android.telephony.data.DataServiceCallback);
method public final int getSlotIndex();
method public final void notifyDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
- method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @Nullable android.telephony.data.DataServiceCallback);
- method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @Nullable android.telephony.data.DataServiceCallback);
- method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @Nullable android.telephony.data.DataServiceCallback);
+ method public void requestDataCallList(@NonNull android.telephony.data.DataServiceCallback);
+ method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback);
+ method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback);
+ method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @NonNull android.telephony.data.DataServiceCallback);
}
public class DataServiceCallback {
method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>);
method public void onDeactivateDataCallComplete(int);
- method public void onGetDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
+ method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
method public void onSetDataProfileComplete(int);
method public void onSetInitialAttachApnComplete(int);
method public void onSetupDataCallComplete(int, @Nullable android.telephony.data.DataCallResponse);
@@ -8245,15 +8281,15 @@
public abstract class QualifiedNetworksService extends android.app.Service {
ctor public QualifiedNetworksService();
- method @NonNull public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int);
+ method @NonNull public abstract android.telephony.data.QualifiedNetworksService.NetworkAvailabilityProvider onCreateNetworkAvailabilityProvider(int);
field public static final String QUALIFIED_NETWORKS_SERVICE_INTERFACE = "android.telephony.data.QualifiedNetworksService";
}
- public abstract class QualifiedNetworksService.NetworkAvailabilityUpdater implements java.lang.AutoCloseable {
- ctor public QualifiedNetworksService.NetworkAvailabilityUpdater(int);
+ public abstract class QualifiedNetworksService.NetworkAvailabilityProvider implements java.lang.AutoCloseable {
+ ctor public QualifiedNetworksService.NetworkAvailabilityProvider(int);
method public abstract void close();
method public final int getSlotIndex();
- method public final void updateQualifiedNetworkTypes(int, @Nullable int[]);
+ method public final void updateQualifiedNetworkTypes(int, @NonNull java.util.List<java.lang.Integer>);
}
}
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 7e04469..9780d43 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -141,3 +141,11 @@
}
+package android.telephony.data {
+
+ public final class DataCallResponse implements android.os.Parcelable {
+ 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.net.InetAddress>, int);
+ }
+
+}
+
diff --git a/telephony/java/android/telephony/INetworkService.aidl b/telephony/java/android/telephony/INetworkService.aidl
index 67e5650..3a9c3a5 100644
--- a/telephony/java/android/telephony/INetworkService.aidl
+++ b/telephony/java/android/telephony/INetworkService.aidl
@@ -25,7 +25,7 @@
{
void createNetworkServiceProvider(int slotId);
void removeNetworkServiceProvider(int slotId);
- void getNetworkRegistrationInfo(int slotId, int domain, INetworkServiceCallback callback);
+ void requestNetworkRegistrationInfo(int slotId, int domain, INetworkServiceCallback callback);
void registerForNetworkRegistrationInfoChanged(int slotId, INetworkServiceCallback callback);
void unregisterForNetworkRegistrationInfoChanged(int slotId, INetworkServiceCallback callback);
}
diff --git a/telephony/java/android/telephony/INetworkServiceCallback.aidl b/telephony/java/android/telephony/INetworkServiceCallback.aidl
index 33b3ac0..c35986c 100644
--- a/telephony/java/android/telephony/INetworkServiceCallback.aidl
+++ b/telephony/java/android/telephony/INetworkServiceCallback.aidl
@@ -24,6 +24,6 @@
*/
oneway interface INetworkServiceCallback
{
- void onGetNetworkRegistrationInfoComplete(int result, in NetworkRegistrationInfo state);
+ void onRequestNetworkRegistrationInfoComplete(int result, in NetworkRegistrationInfo state);
void onNetworkStateChanged();
}
diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java
index bc989dd..8c5e107 100644
--- a/telephony/java/android/telephony/NetworkService.java
+++ b/telephony/java/android/telephony/NetworkService.java
@@ -18,6 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -54,7 +55,8 @@
private final String TAG = NetworkService.class.getSimpleName();
- public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService";
+ @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
+ public static final String SERVICE_INTERFACE = "android.telephony.NetworkService";
private static final int NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER = 1;
private static final int NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER = 2;
@@ -104,13 +106,14 @@
}
/**
- * API to get network registration info. The result will be passed to the callback.
+ * Request network registration info. The result will be passed to the callback.
+ *
* @param domain Network domain
* @param callback The callback for reporting network registration info
*/
- public void getNetworkRegistrationInfo(@Domain int domain,
- @NonNull NetworkServiceCallback callback) {
- callback.onGetNetworkRegistrationInfoComplete(
+ public void requestNetworkRegistrationInfo(@Domain int domain,
+ @NonNull NetworkServiceCallback callback) {
+ callback.onRequestNetworkRegistrationInfoComplete(
NetworkServiceCallback.RESULT_ERROR_UNSUPPORTED, null);
}
@@ -192,7 +195,7 @@
case NETWORK_SERVICE_GET_REGISTRATION_INFO:
if (serviceProvider == null) break;
int domainId = message.arg2;
- serviceProvider.getNetworkRegistrationInfo(domainId,
+ serviceProvider.requestNetworkRegistrationInfo(domainId,
new NetworkServiceCallback(callback));
break;
@@ -231,14 +234,15 @@
* will call this method after binding the network service for each active SIM slot id.
*
* @param slotIndex SIM slot id the network service associated with.
- * @return Network service object
+ * @return Network service object. Null if failed to create the provider (e.g. invalid slot
+ * index)
*/
@Nullable
public abstract NetworkServiceProvider onCreateNetworkServiceProvider(int slotIndex);
@Override
public IBinder onBind(Intent intent) {
- if (intent == null || !NETWORK_SERVICE_INTERFACE.equals(intent.getAction())) {
+ if (intent == null || !SERVICE_INTERFACE.equals(intent.getAction())) {
loge("Unexpected intent " + intent);
return null;
}
@@ -280,8 +284,8 @@
}
@Override
- public void getNetworkRegistrationInfo(
- int slotIndex, int domain, INetworkServiceCallback callback) {
+ public void requestNetworkRegistrationInfo(int slotIndex, int domain,
+ INetworkServiceCallback callback) {
mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_INFO, slotIndex,
domain, callback).sendToTarget();
}
diff --git a/telephony/java/android/telephony/NetworkServiceCallback.java b/telephony/java/android/telephony/NetworkServiceCallback.java
index cc25240..1c64bcd 100644
--- a/telephony/java/android/telephony/NetworkServiceCallback.java
+++ b/telephony/java/android/telephony/NetworkServiceCallback.java
@@ -28,9 +28,9 @@
/**
* Network service callback. Object of this class is passed to NetworkServiceProvider upon
- * calling getNetworkRegistrationInfo, to receive asynchronous feedback from NetworkServiceProvider
- * upon onGetNetworkRegistrationInfoComplete. It's like a wrapper of INetworkServiceCallback
- * because INetworkServiceCallback can't be a parameter type in public APIs.
+ * calling requestNetworkRegistrationInfo, to receive asynchronous feedback from
+ * NetworkServiceProvider upon onRequestNetworkRegistrationInfoComplete. It's like a wrapper of
+ * INetworkServiceCallback because INetworkServiceCallback can't be a parameter type in public APIs.
*
* @hide
*/
@@ -70,20 +70,20 @@
/**
* Called to indicate result of
- * {@link NetworkServiceProvider#getNetworkRegistrationInfo(int, NetworkServiceCallback)}
+ * {@link NetworkServiceProvider#requestNetworkRegistrationInfo(int, NetworkServiceCallback)}
*
* @param result Result status like {@link NetworkServiceCallback#RESULT_SUCCESS} or
- * {@link NetworkServiceCallback#RESULT_ERROR_UNSUPPORTED}
+ * {@link NetworkServiceCallback#RESULT_ERROR_UNSUPPORTED}
* @param state The state information to be returned to callback.
*/
- public void onGetNetworkRegistrationInfoComplete(int result,
- @Nullable NetworkRegistrationInfo state) {
+ public void onRequestNetworkRegistrationInfoComplete(int result,
+ @Nullable NetworkRegistrationInfo state) {
INetworkServiceCallback callback = mCallback.get();
if (callback != null) {
try {
- callback.onGetNetworkRegistrationInfoComplete(result, state);
+ callback.onRequestNetworkRegistrationInfoComplete(result, state);
} catch (RemoteException e) {
- Rlog.e(mTag, "Failed to onGetNetworkRegistrationInfoComplete on the remote");
+ Rlog.e(mTag, "Failed to onRequestNetworkRegistrationInfoComplete on the remote");
}
} else {
Rlog.e(mTag, "Weak reference of callback is null.");
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 30dcaa0..df31f50 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -1586,7 +1586,7 @@
== NetworkRegistrationInfo.REGISTRATION_STATE_HOME) {
// If the device is on IWLAN, return IWLAN as the network type. This is to simulate the
// behavior of legacy mode device. In the future caller should use
- // getNetworkRegistrationInfo() to retrieve the actual data network type on cellular
+ // requestNetworkRegistrationInfo() to retrieve the actual data network type on cellular
// or on IWLAN.
return iwlanRegState.getAccessNetworkTechnology();
}
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 0622cdd..17699d7 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -17,16 +17,21 @@
package android.telephony.data;
+import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.LinkAddress;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.DataFailCause;
+import android.telephony.DataFailCause.FailCause;
import android.telephony.data.ApnSetting.ProtocolType;
import com.android.internal.annotations.VisibleForTesting;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
@@ -39,83 +44,114 @@
*/
@SystemApi
public final class DataCallResponse implements Parcelable {
- private final int mStatus;
+
+ /** {@hide} */
+ @IntDef(prefix = "LINK_STATUS_", value = {
+ LINK_STATUS_UNKNOWN,
+ LINK_STATUS_INACTIVE,
+ LINK_STATUS_DORMANT,
+ LINK_STATUS_ACTIVE
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface LinkStatus {}
+
+ /** Unknown status */
+ public static final int LINK_STATUS_UNKNOWN = -1;
+
+ /** Indicates the data connection is inactive. */
+ public static final int LINK_STATUS_INACTIVE = 0;
+
+ /** Indicates the data connection is active with physical link dormant. */
+ public static final int LINK_STATUS_DORMANT = 1;
+
+ /** Indicates the data connection is active with physical link up. */
+ public static final int LINK_STATUS_ACTIVE = 2;
+
+ private final @FailCause int mCause;
private final int mSuggestedRetryTime;
- private final int mCid;
- private final int mActive;
- private final int mProtocolType;
- private final String mIfname;
+ private final int mId;
+ private final @LinkStatus int mLinkStatus;
+ private final @ProtocolType int mProtocolType;
+ private final String mInterfaceName;
private final List<LinkAddress> mAddresses;
- private final List<InetAddress> mDnses;
- private final List<InetAddress> mGateways;
- private final List<String> mPcscfs;
+ private final List<InetAddress> mDnsAddresses;
+ private final List<InetAddress> mGatewayAddresses;
+ private final List<InetAddress> mPcscfAddresses;
private final int mMtu;
/**
- * @param status Data call fail cause. 0 indicates no error.
+ * @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
* @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 id The unique id of the data connection.
+ * @param linkStatus Data connection link status.
* @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.
+ * TS 27.007 section 10.1.1. For example, "IP", "IPV6", "IPV4V6", or "PPP".
+ * @param interfaceName 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
- * one of each. If the prefix length is absent the addresses are assumed to be
- * point to point with IPv4 having a prefix length of 32 and IPv6 128.
- * @param dnses A list of DNS server addresses, e.g., "192.0.1.3" or
- * "192.0.1.11 2001:db8::1". Null if no dns server addresses returned.
- * @param gateways A list of default gateway addresses, e.g., "192.0.1.3" or
- * "192.0.1.11 2001:db8::1". When null, the addresses represent point to point
- * connections.
- * @param pcscfs A list of Proxy Call State Control Function address via PCO(Protocol
- * Configuration Option) for IMS client.
- * @param mtu MTU (Maximum transmission unit) received from network Value <= 0 means network has
- * either not sent a value or sent an invalid value.
+ * "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". Typically 1 IPv4 or 1 IPv6 or
+ * one of each. If the prefix length is absent the addresses are assumed to be
+ * point to point with IPv4 having a prefix length of 32 and IPv6 128.
+ * @param dnsAddresses A list of DNS server addresses, e.g., "192.0.1.3" or
+ * "192.0.1.11 2001:db8::1". Null if no dns server addresses returned.
+ * @param gatewayAddresses A list of default gateway addresses, e.g., "192.0.1.3" or
+ * "192.0.1.11 2001:db8::1". When null, the addresses represent point to point connections.
+ * @param pcscfAddresses A list of Proxy Call State Control Function address via PCO (Protocol
+ * Configuration Option) for IMS client.
+ * @param mtu MTU (maximum transmission unit) in bytes received from network. Zero or negative
+ * values means network has either not sent a value or sent an invalid value.
+ * either not sent a value or sent an invalid value.
+ *
+ * @removed Use the {@link Builder()} instead.
*/
- public DataCallResponse(int status, int suggestedRetryTime, int cid, int active,
- @ProtocolType int protocolType, @Nullable String ifname,
+ public DataCallResponse(@FailCause int cause, int suggestedRetryTime, int id,
+ @LinkStatus int linkStatus,
+ @ProtocolType int protocolType, @Nullable String interfaceName,
@Nullable List<LinkAddress> addresses,
- @Nullable List<InetAddress> dnses,
- @Nullable List<InetAddress> gateways,
- @Nullable List<String> pcscfs, int mtu) {
- mStatus = status;
+ @Nullable List<InetAddress> dnsAddresses,
+ @Nullable List<InetAddress> gatewayAddresses,
+ @Nullable List<InetAddress> pcscfAddresses, int mtu) {
+ mCause = cause;
mSuggestedRetryTime = suggestedRetryTime;
- mCid = cid;
- mActive = active;
+ mId = id;
+ mLinkStatus = linkStatus;
mProtocolType = protocolType;
- mIfname = (ifname == null) ? "" : ifname;
- mAddresses = (addresses == null) ? new ArrayList<>() : addresses;
- mDnses = (dnses == null) ? new ArrayList<>() : dnses;
- mGateways = (gateways == null) ? new ArrayList<>() : gateways;
- mPcscfs = (pcscfs == null) ? new ArrayList<>() : pcscfs;
+ mInterfaceName = (interfaceName == null) ? "" : interfaceName;
+ mAddresses = (addresses == null)
+ ? new ArrayList<>() : new ArrayList<>(addresses);
+ mDnsAddresses = (dnsAddresses == null)
+ ? new ArrayList<>() : new ArrayList<>(dnsAddresses);
+ mGatewayAddresses = (gatewayAddresses == null)
+ ? new ArrayList<>() : new ArrayList<>(gatewayAddresses);
+ mPcscfAddresses = (pcscfAddresses == null)
+ ? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
mMtu = mtu;
}
/** @hide */
@VisibleForTesting
public DataCallResponse(Parcel source) {
- mStatus = source.readInt();
+ mCause = source.readInt();
mSuggestedRetryTime = source.readInt();
- mCid = source.readInt();
- mActive = source.readInt();
+ mId = source.readInt();
+ mLinkStatus = source.readInt();
mProtocolType = source.readInt();
- mIfname = source.readString();
+ mInterfaceName = source.readString();
mAddresses = new ArrayList<>();
source.readList(mAddresses, LinkAddress.class.getClassLoader());
- mDnses = new ArrayList<>();
- source.readList(mDnses, InetAddress.class.getClassLoader());
- mGateways = new ArrayList<>();
- source.readList(mGateways, InetAddress.class.getClassLoader());
- mPcscfs = new ArrayList<>();
- source.readList(mPcscfs, InetAddress.class.getClassLoader());
+ mDnsAddresses = new ArrayList<>();
+ source.readList(mDnsAddresses, InetAddress.class.getClassLoader());
+ mGatewayAddresses = new ArrayList<>();
+ source.readList(mGatewayAddresses, InetAddress.class.getClassLoader());
+ mPcscfAddresses = new ArrayList<>();
+ source.readList(mPcscfAddresses, InetAddress.class.getClassLoader());
mMtu = source.readInt();
}
/**
- * @return Data call fail cause. 0 indicates no error.
+ * @return Data call fail cause. {@link DataFailCause#NONE} indicates no error.
*/
- public int getStatus() { return mStatus; }
+ @FailCause
+ public int getCause() { return mCause; }
/**
* @return The suggested data retry time in milliseconds.
@@ -125,12 +161,12 @@
/**
* @return The unique id of the data connection.
*/
- public int getCallId() { return mCid; }
+ public int getId() { return mId; }
/**
- * @return 0 = inactive, 1 = dormant, 2 = active.
+ * @return The link status
*/
- public int getActive() { return mActive; }
+ @LinkStatus public int getLinkStatus() { return mLinkStatus; }
/**
* @return The connection protocol type.
@@ -139,13 +175,13 @@
public int getProtocolType() { return mProtocolType; }
/**
- * @return The network interface name.
+ * @return The network interface name (e.g. "rmnet_data1").
*/
@NonNull
- public String getIfname() { return mIfname; }
+ public String getInterfaceName() { return mInterfaceName; }
/**
- * @return A list of {@link LinkAddress}
+ * @return A list of addresses of this data connection.
*/
@NonNull
public List<LinkAddress> getAddresses() { return mAddresses; }
@@ -155,25 +191,25 @@
* "192.0.1.11 2001:db8::1". Empty list if no dns server addresses returned.
*/
@NonNull
- public List<InetAddress> getDnses() { return mDnses; }
+ public List<InetAddress> getDnsAddresses() { return mDnsAddresses; }
/**
* @return A list of default gateway addresses, e.g., "192.0.1.3" or
* "192.0.1.11 2001:db8::1". Empty list if the addresses represent point to point connections.
*/
@NonNull
- public List<InetAddress> getGateways() { return mGateways; }
+ public List<InetAddress> getGatewayAddresses() { return mGatewayAddresses; }
/**
- * @return A list of Proxy Call State Control Function address via PCO(Protocol Configuration
+ * @return A list of Proxy Call State Control Function address via PCO (Protocol Configuration
* Option) for IMS client.
*/
@NonNull
- public List<String> getPcscfs() { return mPcscfs; }
+ public List<InetAddress> getPcscfAddresses() { return mPcscfAddresses; }
/**
- * @return MTU received from network Value <= 0 means network has either not sent a value or
- * sent an invalid value
+ * @return MTU (maximum transmission unit) in bytes received from network. Zero or negative
+ * values means network has either not sent a value or sent an invalid value.
*/
public int getMtu() { return mMtu; }
@@ -181,16 +217,16 @@
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("DataCallResponse: {")
- .append(" status=").append(mStatus)
+ .append(" cause=").append(mCause)
.append(" retry=").append(mSuggestedRetryTime)
- .append(" cid=").append(mCid)
- .append(" active=").append(mActive)
+ .append(" cid=").append(mId)
+ .append(" linkStatus=").append(mLinkStatus)
.append(" protocolType=").append(mProtocolType)
- .append(" ifname=").append(mIfname)
+ .append(" ifname=").append(mInterfaceName)
.append(" addresses=").append(mAddresses)
- .append(" dnses=").append(mDnses)
- .append(" gateways=").append(mGateways)
- .append(" pcscf=").append(mPcscfs)
+ .append(" dnses=").append(mDnsAddresses)
+ .append(" gateways=").append(mGatewayAddresses)
+ .append(" pcscf=").append(mPcscfAddresses)
.append(" mtu=").append(mMtu)
.append("}");
return sb.toString();
@@ -200,32 +236,33 @@
public boolean equals (Object o) {
if (this == o) return true;
- if (o == null || !(o instanceof DataCallResponse)) {
+ if (!(o instanceof DataCallResponse)) {
return false;
}
DataCallResponse other = (DataCallResponse) o;
- return this.mStatus == other.mStatus
+ return this.mCause == other.mCause
&& this.mSuggestedRetryTime == other.mSuggestedRetryTime
- && this.mCid == other.mCid
- && this.mActive == other.mActive
+ && this.mId == other.mId
+ && this.mLinkStatus == other.mLinkStatus
&& this.mProtocolType == other.mProtocolType
- && this.mIfname.equals(other.mIfname)
+ && this.mInterfaceName.equals(other.mInterfaceName)
&& mAddresses.size() == other.mAddresses.size()
&& mAddresses.containsAll(other.mAddresses)
- && mDnses.size() == other.mDnses.size()
- && mDnses.containsAll(other.mDnses)
- && mGateways.size() == other.mGateways.size()
- && mGateways.containsAll(other.mGateways)
- && mPcscfs.size() == other.mPcscfs.size()
- && mPcscfs.containsAll(other.mPcscfs)
+ && mDnsAddresses.size() == other.mDnsAddresses.size()
+ && mDnsAddresses.containsAll(other.mDnsAddresses)
+ && mGatewayAddresses.size() == other.mGatewayAddresses.size()
+ && mGatewayAddresses.containsAll(other.mGatewayAddresses)
+ && mPcscfAddresses.size() == other.mPcscfAddresses.size()
+ && mPcscfAddresses.containsAll(other.mPcscfAddresses)
&& mMtu == other.mMtu;
}
@Override
public int hashCode() {
- return Objects.hash(mStatus, mSuggestedRetryTime, mCid, mActive, mProtocolType, mIfname,
- mAddresses, mDnses, mGateways, mPcscfs, mMtu);
+ return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
+ mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
+ mMtu);
}
@Override
@@ -235,16 +272,16 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mStatus);
+ dest.writeInt(mCause);
dest.writeInt(mSuggestedRetryTime);
- dest.writeInt(mCid);
- dest.writeInt(mActive);
+ dest.writeInt(mId);
+ dest.writeInt(mLinkStatus);
dest.writeInt(mProtocolType);
- dest.writeString(mIfname);
+ dest.writeString(mInterfaceName);
dest.writeList(mAddresses);
- dest.writeList(mDnses);
- dest.writeList(mGateways);
- dest.writeList(mPcscfs);
+ dest.writeList(mDnsAddresses);
+ dest.writeList(mGatewayAddresses);
+ dest.writeList(mPcscfAddresses);
dest.writeInt(mMtu);
}
@@ -260,4 +297,183 @@
return new DataCallResponse[size];
}
};
-}
\ No newline at end of file
+
+ /**
+ * Provides a convenient way to set the fields of a {@link DataCallResponse} when creating a new
+ * instance.
+ *
+ * <p>The example below shows how you might create a new {@code DataCallResponse}:
+ *
+ * <pre><code>
+ *
+ * DataCallResponse response = new DataCallResponse.Builder()
+ * .setAddresses(Arrays.asList("192.168.1.2"))
+ * .setProtocolType(ApnSetting.PROTOCOL_IPV4V6)
+ * .build();
+ * </code></pre>
+ */
+ public static final class Builder {
+ private @FailCause int mCause;
+
+ private int mSuggestedRetryTime;
+
+ private int mId;
+
+ private @LinkStatus int mLinkStatus;
+
+ private @ProtocolType int mProtocolType;
+
+ private String mInterfaceName;
+
+ private List<LinkAddress> mAddresses;
+
+ private List<InetAddress> mDnsAddresses;
+
+ private List<InetAddress> mGatewayAddresses;
+
+ private List<InetAddress> mPcscfAddresses;
+
+ private int mMtu;
+
+ /**
+ * Default constructor for Builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Set data call fail cause.
+ *
+ * @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setCause(@FailCause int cause) {
+ mCause = cause;
+ return this;
+ }
+
+ /**
+ * Set the suggested data retry time.
+ *
+ * @param suggestedRetryTime The suggested data retry time in milliseconds.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setSuggestedRetryTime(int suggestedRetryTime) {
+ mSuggestedRetryTime = suggestedRetryTime;
+ return this;
+ }
+
+ /**
+ * Set the unique id of the data connection.
+ *
+ * @param id The unique id of the data connection.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setId(int id) {
+ mId = id;
+ return this;
+ }
+
+ /**
+ * Set the link status
+ *
+ * @param linkStatus The link status
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setLinkStatus(@LinkStatus int linkStatus) {
+ mLinkStatus = linkStatus;
+ return this;
+ }
+
+ /**
+ * Set the connection protocol type.
+ *
+ * @param protocolType The connection protocol type.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setProtocolType(@ProtocolType int protocolType) {
+ mProtocolType = protocolType;
+ return this;
+ }
+
+ /**
+ * Set the network interface name.
+ *
+ * @param interfaceName The network interface name (e.g. "rmnet_data1").
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setInterfaceName(@NonNull String interfaceName) {
+ mInterfaceName = interfaceName;
+ return this;
+ }
+
+ /**
+ * Set the addresses of this data connection.
+ *
+ * @param addresses The list of address of the data connection.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setAddresses(@NonNull List<LinkAddress> addresses) {
+ mAddresses = addresses;
+ return this;
+ }
+
+ /**
+ * Set the DNS addresses of this data connection
+ *
+ * @param dnsAddresses The list of DNS address of the data connection.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setDnsAddresses(@NonNull List<InetAddress> dnsAddresses) {
+ mDnsAddresses = dnsAddresses;
+ return this;
+ }
+
+ /**
+ * Set the gateway addresses of this data connection
+ *
+ * @param gatewayAddresses The list of gateway address of the data connection.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setGatewayAddresses(@NonNull List<InetAddress> gatewayAddresses) {
+ mGatewayAddresses = gatewayAddresses;
+ return this;
+ }
+
+ /**
+ * Set the Proxy Call State Control Function address via PCO(Protocol Configuration
+ * Option) for IMS client.
+ *
+ * @param pcscfAddresses The list of pcscf address of the data connection.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setPcscfAddresses(@NonNull List<InetAddress> pcscfAddresses) {
+ mPcscfAddresses = pcscfAddresses;
+ return this;
+ }
+
+ /**
+ * Set maximum transmission unit of the data connection.
+ *
+ * @param mtu MTU (maximum transmission unit) in bytes received from network. Zero or
+ * negative values means network has either not sent a value or sent an invalid value.
+ *
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setMtu(int mtu) {
+ mMtu = mtu;
+ return this;
+ }
+
+ /**
+ * Build the DataCallResponse.
+ *
+ * @return the DataCallResponse object.
+ */
+ public @NonNull DataCallResponse build() {
+ return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
+ mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
+ mPcscfAddresses, mMtu);
+ }
+ }
+}
diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java
index bcb47f7..c53ade1 100644
--- a/telephony/java/android/telephony/data/DataProfile.java
+++ b/telephony/java/android/telephony/data/DataProfile.java
@@ -34,6 +34,7 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
/**
* Description of a mobile data profile used for establishing
@@ -50,7 +51,7 @@
TYPE_COMMON,
TYPE_3GPP,
TYPE_3GPP2})
- public @interface DataProfileType {}
+ public @interface Type {}
/** Common data profile */
public static final int TYPE_COMMON = 0;
@@ -75,25 +76,25 @@
private final String mPassword;
- @DataProfileType
+ @Type
private final int mType;
- private final int mMaxConnsTime;
+ private final int mMaxConnectionsTime;
- private final int mMaxConns;
+ private final int mMaxConnections;
private final int mWaitTime;
private final boolean mEnabled;
@ApnType
- private final int mSupportedApnTypesBitmap;
+ private final int mSupportedApnTypesBitmask;
@ProtocolType
private final int mRoamingProtocolType;
@NetworkTypeBitMask
- private final int mBearerBitmap;
+ private final int mBearerBitmask;
private final int mMtu;
@@ -102,11 +103,13 @@
private final boolean mPreferred;
/** @hide */
- 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) {
+ private DataProfile(int profileId, String apn, @ProtocolType int protocolType, int authType,
+ String userName, String password, int type, int maxConnectionsTime,
+ int maxConnections, int waitTime, boolean enabled,
+ @ApnType int supportedApnTypesBitmask,
+ @ProtocolType int roamingProtocolType,
+ @NetworkTypeBitMask int bearerBitmask, int mtu, boolean persistent,
+ boolean preferred) {
this.mProfileId = profileId;
this.mApn = apn;
this.mProtocolType = protocolType;
@@ -118,21 +121,19 @@
this.mUserName = userName;
this.mPassword = password;
this.mType = type;
- this.mMaxConnsTime = maxConnsTime;
- this.mMaxConns = maxConns;
+ this.mMaxConnectionsTime = maxConnectionsTime;
+ this.mMaxConnections = maxConnections;
this.mWaitTime = waitTime;
this.mEnabled = enabled;
-
- this.mSupportedApnTypesBitmap = supportedApnTypesBitmap;
+ this.mSupportedApnTypesBitmask = supportedApnTypesBitmask;
this.mRoamingProtocolType = roamingProtocolType;
- this.mBearerBitmap = bearerBitmap;
+ this.mBearerBitmask = bearerBitmask;
this.mMtu = mtu;
this.mPersistent = persistent;
this.mPreferred = preferred;
}
- /** @hide */
- public DataProfile(Parcel source) {
+ private DataProfile(Parcel source) {
mProfileId = source.readInt();
mApn = source.readString();
mProtocolType = source.readInt();
@@ -140,13 +141,13 @@
mUserName = source.readString();
mPassword = source.readString();
mType = source.readInt();
- mMaxConnsTime = source.readInt();
- mMaxConns = source.readInt();
+ mMaxConnectionsTime = source.readInt();
+ mMaxConnections = source.readInt();
mWaitTime = source.readInt();
mEnabled = source.readBoolean();
- mSupportedApnTypesBitmap = source.readInt();
+ mSupportedApnTypesBitmask = source.readInt();
mRoamingProtocolType = source.readInt();
- mBearerBitmap = source.readInt();
+ mBearerBitmask = source.readInt();
mMtu = source.readInt();
mPersistent = source.readBoolean();
mPreferred = source.readBoolean();
@@ -158,7 +159,8 @@
public int getProfileId() { return mProfileId; }
/**
- * @return The APN to establish data connection.
+ * @return The APN (Access Point Name) to establish data connection. This is a string
+ * specifically defined by the carrier.
*/
@NonNull
public String getApn() { return mApn; }
@@ -166,7 +168,7 @@
/**
* @return The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
*/
- public @ProtocolType int getProtocol() { return mProtocolType; }
+ public @ProtocolType int getProtocolType() { return mProtocolType; }
/**
* @return The authentication protocol used for this PDP context.
@@ -188,22 +190,28 @@
/**
* @return The profile type.
*/
- public @DataProfileType int getType() { return mType; }
+ public @Type int getType() { return mType; }
/**
* @return The period in seconds to limit the maximum connections.
+ *
+ * @hide
*/
- public int getMaxConnsTime() { return mMaxConnsTime; }
+ public int getMaxConnectionsTime() { return mMaxConnectionsTime; }
/**
* @return The maximum connections allowed.
+ *
+ * @hide
*/
- public int getMaxConns() { return mMaxConns; }
+ public int getMaxConnections() { return mMaxConnections; }
/**
* @return 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.
+ *
+ * @hide
*/
public int getWaitTime() { return mWaitTime; }
@@ -213,19 +221,19 @@
public boolean isEnabled() { return mEnabled; }
/**
- * @return The supported APN types bitmap.
+ * @return The supported APN types bitmask.
*/
- public @ApnType int getSupportedApnTypesBitmap() { return mSupportedApnTypesBitmap; }
+ public @ApnType int getSupportedApnTypesBitmask() { return mSupportedApnTypesBitmask; }
/**
* @return The connection protocol on roaming network defined in 3GPP TS 27.007 section 10.1.1.
*/
- public @ProtocolType int getRoamingProtocol() { return mRoamingProtocolType; }
+ public @ProtocolType int getRoamingProtocolType() { return mRoamingProtocolType; }
/**
- * @return The bearer bitmap indicating the applicable networks for this data profile.
+ * @return The bearer bitmask indicating the applicable networks for this data profile.
*/
- public @NetworkTypeBitMask int getBearerBitmap() { return mBearerBitmap; }
+ public @NetworkTypeBitMask int getBearerBitmask() { return mBearerBitmask; }
/**
* @return The maximum transmission unit (MTU) size in bytes.
@@ -239,7 +247,8 @@
/**
* @return {@code true} if this data profile was used to bring up the last default
- * (i.e internet) data connection successfully.
+ * (i.e internet) data connection successfully, or the one chosen by the user in Settings'
+ * APN editor. For one carrier there can be only one profiled preferred.
*/
public boolean isPreferred() { return mPreferred; }
@@ -253,19 +262,13 @@
return "DataProfile=" + mProfileId + "/" + mProtocolType + "/" + mAuthType
+ "/" + (Build.IS_USER ? "***/***/***" :
(mApn + "/" + mUserName + "/" + mPassword)) + "/" + mType + "/"
- + mMaxConnsTime + "/" + mMaxConns + "/"
- + mWaitTime + "/" + mEnabled + "/" + mSupportedApnTypesBitmap + "/"
- + mRoamingProtocolType + "/" + mBearerBitmap + "/" + mMtu + "/" + mPersistent + "/"
+ + mMaxConnectionsTime + "/" + mMaxConnections + "/"
+ + mWaitTime + "/" + mEnabled + "/" + mSupportedApnTypesBitmask + "/"
+ + mRoamingProtocolType + "/" + mBearerBitmask + "/" + mMtu + "/" + mPersistent + "/"
+ mPreferred;
}
@Override
- public boolean equals(Object o) {
- if (o instanceof DataProfile == false) return false;
- return (o == this || toString().equals(o.toString()));
- }
-
- @Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mProfileId);
dest.writeString(mApn);
@@ -274,13 +277,13 @@
dest.writeString(mUserName);
dest.writeString(mPassword);
dest.writeInt(mType);
- dest.writeInt(mMaxConnsTime);
- dest.writeInt(mMaxConns);
+ dest.writeInt(mMaxConnectionsTime);
+ dest.writeInt(mMaxConnections);
dest.writeInt(mWaitTime);
dest.writeBoolean(mEnabled);
- dest.writeInt(mSupportedApnTypesBitmap);
+ dest.writeInt(mSupportedApnTypesBitmask);
dest.writeInt(mRoamingProtocolType);
- dest.writeInt(mBearerBitmap);
+ dest.writeInt(mBearerBitmask);
dest.writeInt(mMtu);
dest.writeBoolean(mPersistent);
dest.writeBoolean(mPreferred);
@@ -298,4 +301,312 @@
return new DataProfile[size];
}
};
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ DataProfile that = (DataProfile) o;
+ return mProfileId == that.mProfileId
+ && mProtocolType == that.mProtocolType
+ && mAuthType == that.mAuthType
+ && mType == that.mType
+ && mMaxConnectionsTime == that.mMaxConnectionsTime
+ && mMaxConnections == that.mMaxConnections
+ && mWaitTime == that.mWaitTime
+ && mEnabled == that.mEnabled
+ && mSupportedApnTypesBitmask == that.mSupportedApnTypesBitmask
+ && mRoamingProtocolType == that.mRoamingProtocolType
+ && mBearerBitmask == that.mBearerBitmask
+ && mMtu == that.mMtu
+ && mPersistent == that.mPersistent
+ && mPreferred == that.mPreferred
+ && Objects.equals(mApn, that.mApn)
+ && Objects.equals(mUserName, that.mUserName)
+ && Objects.equals(mPassword, that.mPassword);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword, mType,
+ mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
+ mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtu, mPersistent,
+ mPreferred);
+ }
+
+ /**
+ * Provides a convenient way to set the fields of a {@link DataProfile} when creating a new
+ * instance.
+ *
+ * <p>The example below shows how you might create a new {@code DataProfile}:
+ *
+ * <pre><code>
+ *
+ * DataProfile dp = new DataProfile.Builder()
+ * .setApn("apn.xyz.com")
+ * .setProtocol(ApnSetting.PROTOCOL_IPV4V6)
+ * .build();
+ * </code></pre>
+ */
+ public static final class Builder {
+ private int mProfileId;
+
+ private String mApn;
+
+ @ProtocolType
+ private int mProtocolType;
+
+ @AuthType
+ private int mAuthType;
+
+ private String mUserName;
+
+ private String mPassword;
+
+ @Type
+ private int mType;
+
+ private int mMaxConnectionsTime;
+
+ private int mMaxConnections;
+
+ private int mWaitTime;
+
+ private boolean mEnabled;
+
+ @ApnType
+ private int mSupportedApnTypesBitmask;
+
+ @ProtocolType
+ private int mRoamingProtocolType;
+
+ @NetworkTypeBitMask
+ private int mBearerBitmask;
+
+ private int mMtu;
+
+ private boolean mPersistent;
+
+ private boolean mPreferred;
+
+ /**
+ * Default constructor for Builder.
+ */
+ public Builder() {
+ }
+
+ /**
+ * Set profile id. Note that this is not a global unique id of the data profile. This id
+ * is only used by certain CDMA carriers to identify the type of data profile.
+ *
+ * @param profileId Network domain.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setProfileId(int profileId) {
+ mProfileId = profileId;
+ return this;
+ }
+
+ /**
+ * Set the APN (Access Point Name) to establish data connection. This is a string
+ * specifically defined by the carrier.
+ *
+ * @param apn Access point name
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setApn(@NonNull String apn) {
+ mApn = apn;
+ return this;
+ }
+
+ /**
+ * Set the connection protocol type.
+ *
+ * @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setProtocolType(@ProtocolType int protocolType) {
+ mProtocolType = protocolType;
+ return this;
+ }
+
+ /**
+ * Set the authentication type.
+ *
+ * @param authType The authentication type
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setAuthType(@AuthType int authType) {
+ mAuthType = authType;
+ return this;
+ }
+
+ /**
+ * Set the user name
+ *
+ * @param userName The user name
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setUserName(@NonNull String userName) {
+ mUserName = userName;
+ return this;
+ }
+
+ /**
+ * Set the password
+ *
+ * @param password The password
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setPassword(@NonNull String password) {
+ mPassword = password;
+ return this;
+ }
+
+ /**
+ * Set the type
+ *
+ * @param type The profile type
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setType(@Type int type) {
+ mType = type;
+ return this;
+ }
+
+ /**
+ * Set the period in seconds to limit the maximum connections.
+ *
+ * @param maxConnectionsTime The profile type
+ * @return The same instance of the builder.
+ *
+ * @hide
+ */
+ public @NonNull Builder setMaxConnectionsTime(int maxConnectionsTime) {
+ mMaxConnectionsTime = maxConnectionsTime;
+ return this;
+ }
+
+ /**
+ * Set the maximum connections allowed.
+ *
+ * @param maxConnections The maximum connections allowed.
+ * @return The same instance of the builder.
+ *
+ * @hide
+ */
+ public @NonNull Builder setMaxConnections(int maxConnections) {
+ mMaxConnections = maxConnections;
+ return this;
+ }
+
+ /**
+ * Set the period in seconds to limit the maximum connections.
+ *
+ * @param waitTime 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.
+ *
+ * @return The same instance of the builder.
+ *
+ * @hide
+ */
+ public @NonNull Builder setWaitTime(int waitTime) {
+ mWaitTime = waitTime;
+ return this;
+ }
+
+ /**
+ * Enable the data profile
+ *
+ * @param isEnabled {@code true} to enable the data profile, otherwise disable.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder enable(boolean isEnabled) {
+ mEnabled = isEnabled;
+ return this;
+ }
+
+ /**
+ * Set the supported APN types bitmask.
+ *
+ * @param supportedApnTypesBitmask The supported APN types bitmask.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setSupportedApnTypesBitmask(@ApnType int supportedApnTypesBitmask) {
+ mSupportedApnTypesBitmask = supportedApnTypesBitmask;
+ return this;
+ }
+
+ /**
+ * Set the connection protocol type for roaming.
+ *
+ * @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setRoamingProtocolType(@ProtocolType int protocolType) {
+ mRoamingProtocolType = protocolType;
+ return this;
+ }
+
+ /**
+ * Set the bearer bitmask indicating the applicable networks for this data profile.
+ *
+ * @param bearerBitmask The bearer bitmask indicating the applicable networks for this data
+ * profile.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setBearerBitmask(@NetworkTypeBitMask int bearerBitmask) {
+ mBearerBitmask = bearerBitmask;
+ return this;
+ }
+
+ /**
+ * Set 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.
+ */
+ public @NonNull Builder setMtu(int mtu) {
+ mMtu = mtu;
+ return this;
+ }
+
+ /**
+ * Set data profile as preferred/non-preferred.
+ *
+ * @param isPreferred {@code true} if this data profile was used to bring up the last
+ * default (i.e internet) data connection successfully, or the one chosen by the user in
+ * Settings' APN editor. For one carrier there can be only one profiled preferred.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setPreferred(boolean isPreferred) {
+ mPreferred = isPreferred;
+ return this;
+ }
+
+ /**
+ * Set data profile as persistent/non-persistent
+ *
+ * @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.
+ */
+ public @NonNull Builder setPersistent(boolean isPersistent) {
+ mPersistent = isPersistent;
+ return this;
+ }
+
+ /**
+ * Build the DataProfile object
+ *
+ * @return The data profile object
+ */
+ public @NonNull DataProfile build() {
+ return new DataProfile(mProfileId, mApn, mProtocolType, mAuthType, mUserName, mPassword,
+ mType, mMaxConnectionsTime, mMaxConnections, mWaitTime, mEnabled,
+ mSupportedApnTypesBitmask, mRoamingProtocolType, mBearerBitmask, mMtu,
+ mPersistent, mPreferred);
+ }
+ }
}
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 59d1e1e..372bdf1 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -19,6 +19,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SdkConstant;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -58,10 +59,12 @@
public abstract class DataService extends Service {
private static final String TAG = DataService.class.getSimpleName();
- public static final String DATA_SERVICE_INTERFACE = "android.telephony.data.DataService";
+ @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
+ public static final String SERVICE_INTERFACE = "android.telephony.data.DataService";
/** {@hide} */
@IntDef(prefix = "REQUEST_REASON_", value = {
+ REQUEST_REASON_UNKNOWN,
REQUEST_REASON_NORMAL,
REQUEST_REASON_HANDOVER,
})
@@ -70,6 +73,7 @@
/** {@hide} */
@IntDef(prefix = "REQUEST_REASON_", value = {
+ REQUEST_REASON_UNKNOWN,
REQUEST_REASON_NORMAL,
REQUEST_REASON_SHUTDOWN,
REQUEST_REASON_HANDOVER,
@@ -77,6 +81,8 @@
@Retention(RetentionPolicy.SOURCE)
public @interface DeactivateDataReason {}
+ /** The reason of the data request is unknown */
+ public static final int REQUEST_REASON_UNKNOWN = 0;
/** The reason of the data request is normal */
public static final int REQUEST_REASON_NORMAL = 1;
@@ -94,7 +100,7 @@
private static final int DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL = 5;
private static final int DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN = 6;
private static final int DATA_SERVICE_REQUEST_SET_DATA_PROFILE = 7;
- private static final int DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST = 8;
+ private static final int DATA_SERVICE_REQUEST_REQUEST_DATA_CALL_LIST = 8;
private static final int DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED = 9;
private static final int DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED = 10;
private static final int DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED = 11;
@@ -149,14 +155,13 @@
* {@link #REQUEST_REASON_HANDOVER}.
* @param linkProperties If {@code reason} is {@link #REQUEST_REASON_HANDOVER}, this is the
* link properties of the existing data connection, otherwise null.
- * @param callback The result callback for this request. Null if the client does not care
- * about the result.
+ * @param callback The result callback for this request.
*/
public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
boolean isRoaming, boolean allowRoaming,
@SetupDataReason int reason,
@Nullable LinkProperties linkProperties,
- @Nullable DataServiceCallback callback) {
+ @NonNull DataServiceCallback callback) {
// The default implementation is to return unsupported.
if (callback != null) {
callback.onSetupDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED,
@@ -190,11 +195,10 @@
*
* @param dataProfile Data profile used for data call setup. See {@link DataProfile}.
* @param isRoaming True if the device is data roaming.
- * @param callback The result callback for this request. Null if the client does not care
- * about the result.
+ * @param callback The result callback for this request.
*/
public void setInitialAttachApn(@NonNull DataProfile dataProfile, boolean isRoaming,
- @Nullable DataServiceCallback callback) {
+ @NonNull DataServiceCallback callback) {
// The default implementation is to return unsupported.
if (callback != null) {
callback.onSetInitialAttachApnComplete(
@@ -209,11 +213,10 @@
*
* @param dps A list of data profiles.
* @param isRoaming True if the device is data roaming.
- * @param callback The result callback for this request. Null if the client does not care
- * about the result.
+ * @param callback The result callback for this request.
*/
public void setDataProfile(@NonNull List<DataProfile> dps, boolean isRoaming,
- @Nullable DataServiceCallback callback) {
+ @NonNull DataServiceCallback callback) {
// The default implementation is to return unsupported.
if (callback != null) {
callback.onSetDataProfileComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED);
@@ -225,9 +228,10 @@
*
* @param callback The result callback for this request.
*/
- public void getDataCallList(@NonNull DataServiceCallback callback) {
+ public void requestDataCallList(@NonNull DataServiceCallback callback) {
// The default implementation is to return unsupported.
- callback.onGetDataCallListComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED, null);
+ callback.onRequestDataCallListComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED,
+ null);
}
private void registerForDataCallListChanged(IDataServiceCallback callback) {
@@ -409,10 +413,10 @@
? new DataServiceCallback(setDataProfileRequest.callback)
: null);
break;
- case DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST:
+ case DATA_SERVICE_REQUEST_REQUEST_DATA_CALL_LIST:
if (serviceProvider == null) break;
- serviceProvider.getDataCallList(new DataServiceCallback(
+ serviceProvider.requestDataCallList(new DataServiceCallback(
(IDataServiceCallback) message.obj));
break;
case DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED:
@@ -455,14 +459,14 @@
* will call this method after binding the data service for each active SIM slot id.
*
* @param slotIndex SIM slot id the data service associated with.
- * @return Data service object
+ * @return Data service object. Null if failed to create the provider (e.g. invalid slot index)
*/
@Nullable
public abstract DataServiceProvider onCreateDataServiceProvider(int slotIndex);
@Override
public IBinder onBind(Intent intent) {
- if (intent == null || !DATA_SERVICE_INTERFACE.equals(intent.getAction())) {
+ if (intent == null || !SERVICE_INTERFACE.equals(intent.getAction())) {
loge("Unexpected intent " + intent);
return null;
}
@@ -531,12 +535,12 @@
}
@Override
- public void getDataCallList(int slotIndex, IDataServiceCallback callback) {
+ public void requestDataCallList(int slotIndex, IDataServiceCallback callback) {
if (callback == null) {
- loge("getDataCallList: callback is null");
+ loge("requestDataCallList: callback is null");
return;
}
- mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotIndex, 0,
+ mHandler.obtainMessage(DATA_SERVICE_REQUEST_REQUEST_DATA_CALL_LIST, slotIndex, 0,
callback).sendToTarget();
}
diff --git a/telephony/java/android/telephony/data/DataServiceCallback.java b/telephony/java/android/telephony/data/DataServiceCallback.java
index 2d0cfe8..5d8d793 100644
--- a/telephony/java/android/telephony/data/DataServiceCallback.java
+++ b/telephony/java/android/telephony/data/DataServiceCallback.java
@@ -140,21 +140,21 @@
}
/**
- * Called to indicate result for the request {@link DataServiceProvider#getDataCallList(
+ * Called to indicate result for the request {@link DataServiceProvider#requestDataCallList(
* DataServiceCallback)}.
*
* @param result The result code. Must be one of the {@link ResultCode}.
* @param dataCallList List of the current active data connection. If no data call is presented,
* set it to an empty list.
*/
- public void onGetDataCallListComplete(@ResultCode int result,
- @NonNull List<DataCallResponse> dataCallList) {
+ public void onRequestDataCallListComplete(@ResultCode int result,
+ @NonNull List<DataCallResponse> dataCallList) {
IDataServiceCallback callback = mCallback.get();
if (callback != null) {
try {
- callback.onGetDataCallListComplete(result, dataCallList);
+ callback.onRequestDataCallListComplete(result, dataCallList);
} catch (RemoteException e) {
- Rlog.e(TAG, "Failed to onGetDataCallListComplete on the remote");
+ Rlog.e(TAG, "Failed to onRequestDataCallListComplete on the remote");
}
}
}
diff --git a/telephony/java/android/telephony/data/IDataService.aidl b/telephony/java/android/telephony/data/IDataService.aidl
index d4d9be8..9c74dcc 100644
--- a/telephony/java/android/telephony/data/IDataService.aidl
+++ b/telephony/java/android/telephony/data/IDataService.aidl
@@ -35,7 +35,7 @@
IDataServiceCallback callback);
void setDataProfile(int slotId, in List<DataProfile> dps, boolean isRoaming,
IDataServiceCallback callback);
- void getDataCallList(int slotId, IDataServiceCallback callback);
+ void requestDataCallList(int slotId, IDataServiceCallback callback);
void registerForDataCallListChanged(int slotId, IDataServiceCallback callback);
void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback);
}
diff --git a/telephony/java/android/telephony/data/IDataServiceCallback.aidl b/telephony/java/android/telephony/data/IDataServiceCallback.aidl
index 856185b..cec757d 100644
--- a/telephony/java/android/telephony/data/IDataServiceCallback.aidl
+++ b/telephony/java/android/telephony/data/IDataServiceCallback.aidl
@@ -28,6 +28,6 @@
void onDeactivateDataCallComplete(int result);
void onSetInitialAttachApnComplete(int result);
void onSetDataProfileComplete(int result);
- void onGetDataCallListComplete(int result, in List<DataCallResponse> dataCallList);
+ void onRequestDataCallListComplete(int result, in List<DataCallResponse> dataCallList);
void onDataCallListChanged(in List<DataCallResponse> dataCallList);
}
diff --git a/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl b/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
index 9c80cb7..3bf09bc 100644
--- a/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
+++ b/telephony/java/android/telephony/data/IQualifiedNetworksService.aidl
@@ -23,6 +23,6 @@
*/
interface IQualifiedNetworksService
{
- oneway void createNetworkAvailabilityUpdater(int slotId, IQualifiedNetworksServiceCallback callback);
- oneway void removeNetworkAvailabilityUpdater(int slotId);
+ oneway void createNetworkAvailabilityProvider(int slotId, IQualifiedNetworksServiceCallback callback);
+ oneway void removeNetworkAvailabilityProvider(int slotId);
}
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index c38f278..0e1751d 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -17,7 +17,6 @@
package android.telephony.data;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
@@ -34,14 +33,21 @@
import com.android.internal.annotations.VisibleForTesting;
+import java.util.List;
+
/**
- * Base class of the qualified networks service. Services that extend QualifiedNetworksService must
- * register the service in their AndroidManifest to be detected by the framework. They must be
- * protected by the permission "android.permission.BIND_TELEPHONY_QUALIFIED_NETWORKS_SERVICE".
- * The qualified networks service definition in the manifest must follow the following format:
+ * Base class of the qualified networks service, which is a vendor service providing up-to-date
+ * qualified network information to the frameworks for data handover control. A qualified network
+ * is defined as an access network that is ready for bringing up data connection for given APN
+ * types.
+ *
+ * Services that extend QualifiedNetworksService must register the service in their AndroidManifest
+ * to be detected by the framework. They must be protected by the permission
+ * "android.permission.BIND_TELEPHONY_DATA_SERVICE". The qualified networks service definition in
+ * the manifest must follow the following format:
* ...
* <service android:name=".xxxQualifiedNetworksService"
- * android:permission="android.permission.BIND_TELEPHONY_QUALIFIED_NETWORKS_SERVICE" >
+ * android:permission="android.permission.BIND_TELEPHONY_DATA_SERVICE" >
* <intent-filter>
* <action android:name="android.telephony.data.QualifiedNetworksService" />
* </intent-filter>
@@ -55,28 +61,28 @@
public static final String QUALIFIED_NETWORKS_SERVICE_INTERFACE =
"android.telephony.data.QualifiedNetworksService";
- private static final int QNS_CREATE_NETWORK_AVAILABILITY_UPDATER = 1;
- private static final int QNS_REMOVE_NETWORK_AVAILABILITY_UPDATER = 2;
- private static final int QNS_REMOVE_ALL_NETWORK_AVAILABILITY_UPDATERS = 3;
+ private static final int QNS_CREATE_NETWORK_AVAILABILITY_PROVIDER = 1;
+ private static final int QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER = 2;
+ private static final int QNS_REMOVE_ALL_NETWORK_AVAILABILITY_PROVIDERS = 3;
private static final int QNS_UPDATE_QUALIFIED_NETWORKS = 4;
private final HandlerThread mHandlerThread;
private final QualifiedNetworksServiceHandler mHandler;
- private final SparseArray<NetworkAvailabilityUpdater> mUpdaters = new SparseArray<>();
+ private final SparseArray<NetworkAvailabilityProvider> mProviders = new SparseArray<>();
/** @hide */
@VisibleForTesting
public final IQualifiedNetworksServiceWrapper mBinder = new IQualifiedNetworksServiceWrapper();
/**
- * The abstract class of the network availability updater implementation. The vendor qualified
+ * The abstract class of the network availability provider implementation. The vendor qualified
* network service must extend this class to report the available networks for data
- * connection setup. Note that each instance of network availability updater is associated with
+ * connection setup. Note that each instance of network availability provider is associated with
* one physical SIM slot.
*/
- public abstract class NetworkAvailabilityUpdater implements AutoCloseable {
+ public abstract class NetworkAvailabilityProvider implements AutoCloseable {
private final int mSlotIndex;
private IQualifiedNetworksServiceCallback mCallback;
@@ -89,14 +95,14 @@
/**
* Constructor
- * @param slotIndex SIM slot index the network availability updater associated with.
+ * @param slotIndex SIM slot index the network availability provider associated with.
*/
- public NetworkAvailabilityUpdater(int slotIndex) {
+ public NetworkAvailabilityProvider(int slotIndex) {
mSlotIndex = slotIndex;
}
/**
- * @return SIM slot index the network availability updater associated with.
+ * @return SIM slot index the network availability provider associated with.
*/
public final int getSlotIndex() {
return mSlotIndex;
@@ -121,7 +127,7 @@
}
/**
- * Update the qualified networks list. Network availability updater must invoke this method
+ * Update the qualified networks list. Network availability provider must invoke this method
* whenever the qualified networks changes. If this method is never invoked for certain
* APN types, then frameworks will always use the default (i.e. cellular) data and network
* service.
@@ -129,14 +135,16 @@
* @param apnTypes APN types of the qualified networks. This must be a bitmask combination
* of {@link ApnSetting.ApnType}.
* @param qualifiedNetworkTypes List of network types which are qualified for data
- * connection setup for {@link @apnType} in the preferred order. Each element in the array
- * is a {@link AccessNetworkType}. An empty list or null indicates no networks are qualified
+ * connection setup for {@link @apnType} in the preferred order. Each element in the list
+ * is a {@link AccessNetworkType}. An empty list indicates no networks are qualified
* for data setup.
*/
- public final void updateQualifiedNetworkTypes(@ApnType int apnTypes,
- @Nullable int[] qualifiedNetworkTypes) {
+ public final void updateQualifiedNetworkTypes(
+ @ApnType int apnTypes, @NonNull List<Integer> qualifiedNetworkTypes) {
+ int[] qualifiedNetworkTypesArray =
+ qualifiedNetworkTypes.stream().mapToInt(i->i).toArray();
mHandler.obtainMessage(QNS_UPDATE_QUALIFIED_NETWORKS, mSlotIndex, apnTypes,
- qualifiedNetworkTypes).sendToTarget();
+ qualifiedNetworkTypesArray).sendToTarget();
}
private void onUpdateQualifiedNetworkTypes(@ApnType int apnTypes,
@@ -152,7 +160,7 @@
}
/**
- * Called when the qualified networks updater is removed. The extended class should
+ * Called when the qualified networks provider is removed. The extended class should
* implement this method to perform cleanup works.
*/
@Override
@@ -168,48 +176,48 @@
public void handleMessage(Message message) {
IQualifiedNetworksServiceCallback callback;
final int slotIndex = message.arg1;
- NetworkAvailabilityUpdater updater = mUpdaters.get(slotIndex);
+ NetworkAvailabilityProvider provider = mProviders.get(slotIndex);
switch (message.what) {
- case QNS_CREATE_NETWORK_AVAILABILITY_UPDATER:
- if (mUpdaters.get(slotIndex) != null) {
- loge("Network availability updater for slot " + slotIndex
+ case QNS_CREATE_NETWORK_AVAILABILITY_PROVIDER:
+ if (mProviders.get(slotIndex) != null) {
+ loge("Network availability provider for slot " + slotIndex
+ " already existed.");
return;
}
- updater = createNetworkAvailabilityUpdater(slotIndex);
- if (updater != null) {
- mUpdaters.put(slotIndex, updater);
+ provider = onCreateNetworkAvailabilityProvider(slotIndex);
+ if (provider != null) {
+ mProviders.put(slotIndex, provider);
callback = (IQualifiedNetworksServiceCallback) message.obj;
- updater.registerForQualifiedNetworkTypesChanged(callback);
+ provider.registerForQualifiedNetworkTypesChanged(callback);
} else {
- loge("Failed to create network availability updater. slot index = "
+ loge("Failed to create network availability provider. slot index = "
+ slotIndex);
}
break;
- case QNS_REMOVE_NETWORK_AVAILABILITY_UPDATER:
- if (updater != null) {
- updater.close();
- mUpdaters.remove(slotIndex);
+ case QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER:
+ if (provider != null) {
+ provider.close();
+ mProviders.remove(slotIndex);
}
break;
- case QNS_REMOVE_ALL_NETWORK_AVAILABILITY_UPDATERS:
- for (int i = 0; i < mUpdaters.size(); i++) {
- updater = mUpdaters.get(i);
- if (updater != null) {
- updater.close();
+ case QNS_REMOVE_ALL_NETWORK_AVAILABILITY_PROVIDERS:
+ for (int i = 0; i < mProviders.size(); i++) {
+ provider = mProviders.get(i);
+ if (provider != null) {
+ provider.close();
}
}
- mUpdaters.clear();
+ mProviders.clear();
break;
case QNS_UPDATE_QUALIFIED_NETWORKS:
- if (updater == null) break;
- updater.onUpdateQualifiedNetworkTypes(message.arg2, (int[]) message.obj);
+ if (provider == null) break;
+ provider.onUpdateQualifiedNetworkTypes(message.arg2, (int[]) message.obj);
break;
}
}
@@ -227,8 +235,8 @@
}
/**
- * Create the instance of {@link NetworkAvailabilityUpdater}. Vendor qualified network service
- * must override this method to facilitate the creation of {@link NetworkAvailabilityUpdater}
+ * Create the instance of {@link NetworkAvailabilityProvider}. Vendor qualified network service
+ * must override this method to facilitate the creation of {@link NetworkAvailabilityProvider}
* instances. The system will call this method after binding the qualified networks service for
* each active SIM slot index.
*
@@ -236,7 +244,7 @@
* @return Qualified networks service instance
*/
@NonNull
- public abstract NetworkAvailabilityUpdater createNetworkAvailabilityUpdater(int slotIndex);
+ public abstract NetworkAvailabilityProvider onCreateNetworkAvailabilityProvider(int slotIndex);
/** @hide */
@Override
@@ -251,7 +259,7 @@
/** @hide */
@Override
public boolean onUnbind(Intent intent) {
- mHandler.obtainMessage(QNS_REMOVE_ALL_NETWORK_AVAILABILITY_UPDATERS).sendToTarget();
+ mHandler.obtainMessage(QNS_REMOVE_ALL_NETWORK_AVAILABILITY_PROVIDERS).sendToTarget();
return false;
}
@@ -267,15 +275,15 @@
*/
private class IQualifiedNetworksServiceWrapper extends IQualifiedNetworksService.Stub {
@Override
- public void createNetworkAvailabilityUpdater(int slotIndex,
- IQualifiedNetworksServiceCallback callback) {
- mHandler.obtainMessage(QNS_CREATE_NETWORK_AVAILABILITY_UPDATER, slotIndex, 0,
+ public void createNetworkAvailabilityProvider(int slotIndex,
+ IQualifiedNetworksServiceCallback callback) {
+ mHandler.obtainMessage(QNS_CREATE_NETWORK_AVAILABILITY_PROVIDER, slotIndex, 0,
callback).sendToTarget();
}
@Override
- public void removeNetworkAvailabilityUpdater(int slotIndex) {
- mHandler.obtainMessage(QNS_REMOVE_NETWORK_AVAILABILITY_UPDATER, slotIndex, 0)
+ public void removeNetworkAvailabilityProvider(int slotIndex) {
+ mHandler.obtainMessage(QNS_REMOVE_NETWORK_AVAILABILITY_PROVIDER, slotIndex, 0)
.sendToTarget();
}
}