Merge changes from topic "iwlan_api"
* changes: Added annotations to the APIs Fixed IWLAN related APIs issue
This commit is contained in:
@@ -42728,7 +42728,7 @@ package android.telephony {
|
||||
public class ServiceState implements android.os.Parcelable {
|
||||
ctor public ServiceState();
|
||||
ctor public ServiceState(android.telephony.ServiceState);
|
||||
ctor public ServiceState(android.os.Parcel);
|
||||
ctor @Deprecated public ServiceState(android.os.Parcel);
|
||||
method protected void copyFrom(android.telephony.ServiceState);
|
||||
method public int describeContents();
|
||||
method public int getCdmaNetworkId();
|
||||
|
||||
@@ -6026,12 +6026,11 @@ package android.telephony {
|
||||
}
|
||||
|
||||
public class NetworkRegistrationState implements android.os.Parcelable {
|
||||
ctor public NetworkRegistrationState(int, int, int, int, int, boolean, int[], @Nullable android.telephony.CellIdentity);
|
||||
ctor protected NetworkRegistrationState(android.os.Parcel);
|
||||
ctor public NetworkRegistrationState(int, int, int, int, int, boolean, @NonNull int[], @Nullable android.telephony.CellIdentity);
|
||||
method public int describeContents();
|
||||
method public int getAccessNetworkTechnology();
|
||||
method public int[] getAvailableServices();
|
||||
method public android.telephony.CellIdentity getCellIdentity();
|
||||
method @NonNull public int[] getAvailableServices();
|
||||
method @Nullable public android.telephony.CellIdentity getCellIdentity();
|
||||
method @Nullable public android.telephony.DataSpecificRegistrationStates getDataSpecificStates();
|
||||
method public int getDomain();
|
||||
method public int getRegState();
|
||||
@@ -6057,9 +6056,25 @@ package android.telephony {
|
||||
field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
|
||||
}
|
||||
|
||||
public static class NetworkRegistrationState.Builder {
|
||||
ctor public NetworkRegistrationState.Builder();
|
||||
method @NonNull public android.telephony.NetworkRegistrationState build();
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setAccessNetworkTechnology(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setAvailableServices(@NonNull int[]);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setCellIdentity(@Nullable android.telephony.CellIdentity);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setDomain(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setEmergencyOnly(boolean);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setNrStatus(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setRegState(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setRejectCause(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setRoamingType(int);
|
||||
method @NonNull public android.telephony.NetworkRegistrationState.Builder setTransportType(int);
|
||||
}
|
||||
|
||||
public abstract class NetworkService extends android.app.Service {
|
||||
ctor public NetworkService();
|
||||
method protected abstract android.telephony.NetworkService.NetworkServiceProvider createNetworkServiceProvider(int);
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -6067,12 +6082,12 @@ package android.telephony {
|
||||
ctor public NetworkService.NetworkServiceProvider(int);
|
||||
method public abstract void close();
|
||||
method public void getNetworkRegistrationState(int, @NonNull android.telephony.NetworkServiceCallback);
|
||||
method public final int getSlotId();
|
||||
method public final int getSlotIndex();
|
||||
method public final void notifyNetworkRegistrationStateChanged();
|
||||
}
|
||||
|
||||
public class NetworkServiceCallback {
|
||||
method public void onGetNetworkRegistrationStateComplete(int, android.telephony.NetworkRegistrationState);
|
||||
method public void onGetNetworkRegistrationStateComplete(int, @Nullable android.telephony.NetworkRegistrationState);
|
||||
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
|
||||
@@ -6503,7 +6518,6 @@ 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);
|
||||
ctor public DataCallResponse(android.os.Parcel);
|
||||
method public int describeContents();
|
||||
method public int getActive();
|
||||
method @NonNull public java.util.List<android.net.LinkAddress> getAddresses();
|
||||
@@ -6545,7 +6559,8 @@ package android.telephony.data {
|
||||
|
||||
public abstract class DataService extends android.app.Service {
|
||||
ctor public DataService();
|
||||
method public abstract android.telephony.data.DataService.DataServiceProvider createDataServiceProvider(int);
|
||||
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
|
||||
@@ -6557,7 +6572,7 @@ package android.telephony.data {
|
||||
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 getSlotId();
|
||||
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);
|
||||
@@ -6565,12 +6580,12 @@ package android.telephony.data {
|
||||
}
|
||||
|
||||
public class DataServiceCallback {
|
||||
method public void onDataCallListChanged(java.util.List<android.telephony.data.DataCallResponse>);
|
||||
method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>);
|
||||
method public void onDeactivateDataCallComplete(int);
|
||||
method public void onGetDataCallListComplete(int, java.util.List<android.telephony.data.DataCallResponse>);
|
||||
method public void onGetDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
|
||||
method public void onSetDataProfileComplete(int);
|
||||
method public void onSetInitialAttachApnComplete(int);
|
||||
method public void onSetupDataCallComplete(int, android.telephony.data.DataCallResponse);
|
||||
method public void onSetupDataCallComplete(int, @Nullable android.telephony.data.DataCallResponse);
|
||||
field public static final int RESULT_ERROR_BUSY = 3; // 0x3
|
||||
field public static final int RESULT_ERROR_ILLEGAL_STATE = 4; // 0x4
|
||||
field public static final int RESULT_ERROR_INVALID_ARG = 2; // 0x2
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.AccessNetworkConstants.TransportType;
|
||||
import android.telephony.TelephonyManager.NetworkType;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -140,6 +142,7 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
@ServiceState.RoamingType
|
||||
private int mRoamingType;
|
||||
|
||||
@NetworkType
|
||||
private int mAccessNetworkTechnology;
|
||||
|
||||
@NRStatus
|
||||
@@ -149,6 +152,7 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
|
||||
private final boolean mEmergencyOnly;
|
||||
|
||||
@ServiceType
|
||||
private final int[] mAvailableServices;
|
||||
|
||||
@Nullable
|
||||
@@ -167,9 +171,8 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
* @param regState Network registration state. Must be one of the {@link RegState}. For
|
||||
* {@link TransportType#WLAN} transport, only {@link #REG_STATE_HOME} and
|
||||
* {@link #REG_STATE_NOT_REG_NOT_SEARCHING} are valid states.
|
||||
* @param accessNetworkTechnology Access network technology. Must be one of TelephonyManager
|
||||
* NETWORK_TYPE_XXXX. For {@link TransportType#WLAN} transport, set to
|
||||
* {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
|
||||
* @param accessNetworkTechnology Access network technology.For {@link TransportType#WLAN}
|
||||
* transport, set to {@link TelephonyManager#NETWORK_TYPE_IWLAN}.
|
||||
* @param rejectCause Reason for denial if the registration state is {@link #REG_STATE_DENIED}.
|
||||
* Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
|
||||
* 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA. If
|
||||
@@ -182,8 +185,9 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
* information is not available.
|
||||
*/
|
||||
public NetworkRegistrationState(@Domain int domain, int transportType, @RegState int regState,
|
||||
int accessNetworkTechnology, int rejectCause,
|
||||
boolean emergencyOnly, int[] availableServices,
|
||||
@NetworkType int accessNetworkTechnology, int rejectCause,
|
||||
boolean emergencyOnly,
|
||||
@NonNull @ServiceType int[] availableServices,
|
||||
@Nullable CellIdentity cellIdentity) {
|
||||
mDomain = domain;
|
||||
mTransportType = transportType;
|
||||
@@ -230,7 +234,7 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
updateNrStatus(mDataSpecificStates);
|
||||
}
|
||||
|
||||
protected NetworkRegistrationState(Parcel source) {
|
||||
private NetworkRegistrationState(Parcel source) {
|
||||
mDomain = source.readInt();
|
||||
mTransportType = source.readInt();
|
||||
mRegState = source.readInt();
|
||||
@@ -317,25 +321,29 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
/**
|
||||
* @return List of available service types.
|
||||
*/
|
||||
@NonNull
|
||||
@ServiceType
|
||||
public int[] getAvailableServices() { return mAvailableServices; }
|
||||
|
||||
/**
|
||||
* @return The access network technology {@link TelephonyManager.NetworkType}.
|
||||
* @return The access network technology {@link NetworkType}.
|
||||
*/
|
||||
public @TelephonyManager.NetworkType int getAccessNetworkTechnology() {
|
||||
public @NetworkType int getAccessNetworkTechnology() {
|
||||
return mAccessNetworkTechnology;
|
||||
}
|
||||
|
||||
/**
|
||||
* override the access network technology {@link TelephonyManager.NetworkType} e.g, rat ratchet.
|
||||
* override the access network technology {@link NetworkType} e.g, rat ratchet.
|
||||
* @hide
|
||||
*/
|
||||
public void setAccessNetworkTechnology(@TelephonyManager.NetworkType int tech) {
|
||||
public void setAccessNetworkTechnology(@NetworkType int tech) {
|
||||
mAccessNetworkTechnology = tech;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Network reject cause
|
||||
* @return Reason for denial if the registration state is {@link #REG_STATE_DENIED}.
|
||||
* Depending on {@code accessNetworkTechnology}, the values are defined in 3GPP TS 24.008
|
||||
* 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2 A.S0001 6.2.2.44 for CDMA
|
||||
*/
|
||||
public int getRejectCause() {
|
||||
return mRejectCause;
|
||||
@@ -344,6 +352,7 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
/**
|
||||
* @return The cell information.
|
||||
*/
|
||||
@Nullable
|
||||
public CellIdentity getCellIdentity() {
|
||||
return mCellIdentity;
|
||||
}
|
||||
@@ -547,4 +556,192 @@ public class NetworkRegistrationState implements Parcelable {
|
||||
p.recycle();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a convenient way to set the fields of a {@link NetworkRegistrationState} when
|
||||
* creating a new instance.
|
||||
*
|
||||
* <p>The example below shows how you might create a new {@code NetworkRegistrationState}:
|
||||
*
|
||||
* <pre><code>
|
||||
*
|
||||
* NetworkRegistrationState nrs = new NetworkRegistrationState.Builder()
|
||||
* .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_MMS)
|
||||
* .setApnName("apn.example.com")
|
||||
* .setEntryName("Example Carrier APN")
|
||||
* .setMmsc(Uri.parse("http://mms.example.com:8002"))
|
||||
* .setMmsProxyAddress(mmsProxy)
|
||||
* .setMmsProxyPort(8799)
|
||||
* .build();
|
||||
* </code></pre>
|
||||
*/
|
||||
public static class Builder{
|
||||
@Domain
|
||||
private int mDomain;
|
||||
|
||||
private int mTransportType;
|
||||
|
||||
@RegState
|
||||
private int mRegState;
|
||||
|
||||
@ServiceState.RoamingType
|
||||
private int mRoamingType;
|
||||
|
||||
@NetworkType
|
||||
private int mAccessNetworkTechnology;
|
||||
|
||||
@NRStatus
|
||||
private int mNrStatus;
|
||||
|
||||
private int mRejectCause;
|
||||
|
||||
private boolean mEmergencyOnly;
|
||||
|
||||
@ServiceType
|
||||
private int[] mAvailableServices;
|
||||
|
||||
@Nullable
|
||||
private CellIdentity mCellIdentity;
|
||||
|
||||
/**
|
||||
* Default constructor for Builder.
|
||||
*/
|
||||
public Builder() {}
|
||||
|
||||
/**
|
||||
* Set the network domain.
|
||||
*
|
||||
* @param domain Network domain.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setDomain(@Domain int domain) {
|
||||
mDomain = domain;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transport type.
|
||||
*
|
||||
* @param transportType Transport type.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setTransportType(int transportType) {
|
||||
mTransportType = transportType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the registration state.
|
||||
*
|
||||
* @param regState The registration state.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setRegState(@RegState int regState) {
|
||||
mRegState = regState;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the roaming type.
|
||||
*
|
||||
* @param roamingType Roaming type.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setRoamingType(@ServiceState.RoamingType int roamingType) {
|
||||
mRoamingType = roamingType;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tne access network technology.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*
|
||||
* @param accessNetworkTechnology The access network technology
|
||||
*/
|
||||
public @NonNull Builder setAccessNetworkTechnology(
|
||||
@NetworkType int accessNetworkTechnology) {
|
||||
mAccessNetworkTechnology = accessNetworkTechnology;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 5G NR connection status.
|
||||
*
|
||||
* @param nrStatus 5G NR connection status.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setNrStatus(@NRStatus int nrStatus) {
|
||||
mNrStatus = nrStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the network reject cause.
|
||||
*
|
||||
* @param rejectCause Reason for denial if the registration state is
|
||||
* {@link #REG_STATE_DENIED}.Depending on {@code accessNetworkTechnology}, the values are
|
||||
* defined in 3GPP TS 24.008 10.5.3.6 for UMTS, 3GPP TS 24.301 9.9.3.9 for LTE, and 3GPP2
|
||||
* A.S0001 6.2.2.44 for CDMA. If the reject cause is not supported or unknown, set it to 0.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setRejectCause(int rejectCause) {
|
||||
mRejectCause = rejectCause;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set emergency only.
|
||||
*
|
||||
* @param emergencyOnly True if this network registration is for emergency use only.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setEmergencyOnly(boolean emergencyOnly) {
|
||||
mEmergencyOnly = emergencyOnly;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the available services.
|
||||
*
|
||||
* @param availableServices Available services.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setAvailableServices(
|
||||
@NonNull @ServiceType int[] availableServices) {
|
||||
mAvailableServices = availableServices;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cell identity.
|
||||
*
|
||||
* @param cellIdentity The cell identity.
|
||||
*
|
||||
* @return The same instance of the builder.
|
||||
*/
|
||||
public @NonNull Builder setCellIdentity(@Nullable CellIdentity cellIdentity) {
|
||||
mCellIdentity = cellIdentity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the NetworkRegistrationState.
|
||||
*
|
||||
* @return the NetworkRegistrationState object.
|
||||
*/
|
||||
public @NonNull NetworkRegistrationState build() {
|
||||
return new NetworkRegistrationState(mDomain, mTransportType, mRegState,
|
||||
mAccessNetworkTechnology, mRejectCause, mEmergencyOnly, mAvailableServices,
|
||||
mCellIdentity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
@@ -82,27 +83,30 @@ public abstract class NetworkService extends Service {
|
||||
* service is associated with one physical SIM slot.
|
||||
*/
|
||||
public abstract class NetworkServiceProvider implements AutoCloseable {
|
||||
private final int mSlotId;
|
||||
private final int mSlotIndex;
|
||||
|
||||
private final List<INetworkServiceCallback>
|
||||
mNetworkRegistrationStateChangedCallbacks = new ArrayList<>();
|
||||
|
||||
public NetworkServiceProvider(int slotId) {
|
||||
mSlotId = slotId;
|
||||
/**
|
||||
* Constructor
|
||||
* @param slotIndex SIM slot id the data service provider associated with.
|
||||
*/
|
||||
public NetworkServiceProvider(int slotIndex) {
|
||||
mSlotIndex = slotIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SIM slot id the network service associated with.
|
||||
* @return SIM slot index the network service associated with.
|
||||
*/
|
||||
public final int getSlotId() {
|
||||
return mSlotId;
|
||||
public final int getSlotIndex() {
|
||||
return mSlotIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* API to get network registration state. The result will be passed to the callback.
|
||||
* @param domain Network domain
|
||||
* @param callback The callback for reporting network registration state
|
||||
* @return SIM slot id the network service associated with.
|
||||
*/
|
||||
public void getNetworkRegistrationState(@Domain int domain,
|
||||
@NonNull NetworkServiceCallback callback) {
|
||||
@@ -110,9 +114,12 @@ public abstract class NetworkService extends Service {
|
||||
NetworkServiceCallback.RESULT_ERROR_UNSUPPORTED, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the system that network registration state is changed.
|
||||
*/
|
||||
public final void notifyNetworkRegistrationStateChanged() {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_INDICATION_NETWORK_STATE_CHANGED,
|
||||
mSlotId, 0, null).sendToTarget();
|
||||
mSlotIndex, 0, null).sendToTarget();
|
||||
}
|
||||
|
||||
private void registerForStateChanged(@NonNull INetworkServiceCallback callback) {
|
||||
@@ -154,23 +161,23 @@ public abstract class NetworkService extends Service {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
final int slotId = message.arg1;
|
||||
final int slotIndex = message.arg1;
|
||||
final INetworkServiceCallback callback = (INetworkServiceCallback) message.obj;
|
||||
|
||||
NetworkServiceProvider serviceProvider = mServiceMap.get(slotId);
|
||||
NetworkServiceProvider serviceProvider = mServiceMap.get(slotIndex);
|
||||
|
||||
switch (message.what) {
|
||||
case NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER:
|
||||
// If the service provider doesn't exist yet, we try to create it.
|
||||
if (serviceProvider == null) {
|
||||
mServiceMap.put(slotId, createNetworkServiceProvider(slotId));
|
||||
mServiceMap.put(slotIndex, onCreateNetworkServiceProvider(slotIndex));
|
||||
}
|
||||
break;
|
||||
case NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER:
|
||||
// If the service provider doesn't exist yet, we try to create it.
|
||||
if (serviceProvider != null) {
|
||||
serviceProvider.close();
|
||||
mServiceMap.remove(slotId);
|
||||
mServiceMap.remove(slotIndex);
|
||||
}
|
||||
break;
|
||||
case NETWORK_SERVICE_REMOVE_ALL_NETWORK_SERVICE_PROVIDERS:
|
||||
@@ -223,12 +230,12 @@ public abstract class NetworkService extends Service {
|
||||
* this method to facilitate the creation of {@link NetworkServiceProvider} instances. The system
|
||||
* will call this method after binding the network service for each active SIM slot id.
|
||||
*
|
||||
* @param slotId SIM slot id the network service associated with.
|
||||
* @param slotIndex SIM slot id the network service associated with.
|
||||
* @return Network service object
|
||||
*/
|
||||
protected abstract NetworkServiceProvider createNetworkServiceProvider(int slotId);
|
||||
@Nullable
|
||||
public abstract NetworkServiceProvider onCreateNetworkServiceProvider(int slotIndex);
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (intent == null || !NETWORK_SERVICE_INTERFACE.equals(intent.getAction())) {
|
||||
@@ -239,7 +246,6 @@ public abstract class NetworkService extends Service {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_ALL_NETWORK_SERVICE_PROVIDERS, 0,
|
||||
@@ -252,6 +258,7 @@ public abstract class NetworkService extends Service {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mHandlerThread.quit();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,35 +268,35 @@ public abstract class NetworkService extends Service {
|
||||
private class INetworkServiceWrapper extends INetworkService.Stub {
|
||||
|
||||
@Override
|
||||
public void createNetworkServiceProvider(int slotId) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER, slotId,
|
||||
public void createNetworkServiceProvider(int slotIndex) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_CREATE_NETWORK_SERVICE_PROVIDER, slotIndex,
|
||||
0, null).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNetworkServiceProvider(int slotId) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER, slotId,
|
||||
public void removeNetworkServiceProvider(int slotIndex) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_REMOVE_NETWORK_SERVICE_PROVIDER, slotIndex,
|
||||
0, null).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNetworkRegistrationState(
|
||||
int slotId, int domain, INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_STATE, slotId,
|
||||
int slotIndex, int domain, INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_GET_REGISTRATION_STATE, slotIndex,
|
||||
domain, callback).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerForNetworkRegistrationStateChanged(
|
||||
int slotId, INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE, slotId,
|
||||
int slotIndex, INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_REGISTER_FOR_STATE_CHANGE, slotIndex,
|
||||
0, callback).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterForNetworkRegistrationStateChanged(
|
||||
int slotId,INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE, slotId,
|
||||
int slotIndex, INetworkServiceCallback callback) {
|
||||
mHandler.obtainMessage(NETWORK_SERVICE_UNREGISTER_FOR_STATE_CHANGE, slotIndex,
|
||||
0, callback).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.telephony;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.os.RemoteException;
|
||||
import android.telephony.NetworkService.NetworkServiceProvider;
|
||||
@@ -75,7 +76,8 @@ public class NetworkServiceCallback {
|
||||
* {@link NetworkServiceCallback#RESULT_ERROR_UNSUPPORTED}
|
||||
* @param state The state information to be returned to callback.
|
||||
*/
|
||||
public void onGetNetworkRegistrationStateComplete(int result, NetworkRegistrationState state) {
|
||||
public void onGetNetworkRegistrationStateComplete(int result,
|
||||
@Nullable NetworkRegistrationState state) {
|
||||
INetworkServiceCallback callback = mCallback.get();
|
||||
if (callback != null) {
|
||||
try {
|
||||
|
||||
@@ -438,7 +438,11 @@ public class ServiceState implements Parcelable {
|
||||
|
||||
/**
|
||||
* Construct a ServiceState object from the given parcel.
|
||||
*
|
||||
* @deprecated The constructor takes parcel should not be public at the beginning. Use
|
||||
* {@link #ServiceState()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ServiceState(Parcel in) {
|
||||
mVoiceRegState = in.readInt();
|
||||
mDataRegState = in.readInt();
|
||||
|
||||
@@ -25,6 +25,8 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.telephony.data.ApnSetting.ProtocolType;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -90,6 +92,8 @@ public final class DataCallResponse implements Parcelable {
|
||||
mMtu = mtu;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@VisibleForTesting
|
||||
public DataCallResponse(Parcel source) {
|
||||
mStatus = source.readInt();
|
||||
mSuggestedRetryTime = source.readInt();
|
||||
|
||||
@@ -116,23 +116,23 @@ public abstract class DataService extends Service {
|
||||
*/
|
||||
public abstract class DataServiceProvider implements AutoCloseable {
|
||||
|
||||
private final int mSlotId;
|
||||
private final int mSlotIndex;
|
||||
|
||||
private final List<IDataServiceCallback> mDataCallListChangedCallbacks = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param slotId SIM slot id the data service provider associated with.
|
||||
* @param slotIndex SIM slot index the data service provider associated with.
|
||||
*/
|
||||
public DataServiceProvider(int slotId) {
|
||||
mSlotId = slotId;
|
||||
public DataServiceProvider(int slotIndex) {
|
||||
mSlotIndex = slotIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SIM slot id the data service provider associated with.
|
||||
* @return SIM slot index the data service provider associated with.
|
||||
*/
|
||||
public final int getSlotId() {
|
||||
return mSlotId;
|
||||
public final int getSlotIndex() {
|
||||
return mSlotIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,9 +251,9 @@ public abstract class DataService extends Service {
|
||||
public final void notifyDataCallListChanged(List<DataCallResponse> dataCallList) {
|
||||
synchronized (mDataCallListChangedCallbacks) {
|
||||
for (IDataServiceCallback callback : mDataCallListChangedCallbacks) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED, mSlotId,
|
||||
0, new DataCallListChangedIndication(dataCallList, callback))
|
||||
.sendToTarget();
|
||||
mHandler.obtainMessage(DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED,
|
||||
mSlotIndex, 0, new DataCallListChangedIndication(dataCallList,
|
||||
callback)).sendToTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,20 +342,20 @@ public abstract class DataService extends Service {
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
IDataServiceCallback callback;
|
||||
final int slotId = message.arg1;
|
||||
DataServiceProvider serviceProvider = mServiceMap.get(slotId);
|
||||
final int slotIndex = message.arg1;
|
||||
DataServiceProvider serviceProvider = mServiceMap.get(slotIndex);
|
||||
|
||||
switch (message.what) {
|
||||
case DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER:
|
||||
serviceProvider = createDataServiceProvider(message.arg1);
|
||||
serviceProvider = onCreateDataServiceProvider(message.arg1);
|
||||
if (serviceProvider != null) {
|
||||
mServiceMap.put(slotId, serviceProvider);
|
||||
mServiceMap.put(slotIndex, serviceProvider);
|
||||
}
|
||||
break;
|
||||
case DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER:
|
||||
if (serviceProvider != null) {
|
||||
serviceProvider.close();
|
||||
mServiceMap.remove(slotId);
|
||||
mServiceMap.remove(slotIndex);
|
||||
}
|
||||
break;
|
||||
case DATA_SERVICE_REMOVE_ALL_DATA_SERVICE_PROVIDERS:
|
||||
@@ -454,12 +454,12 @@ public abstract class DataService extends Service {
|
||||
* this method to facilitate the creation of {@link DataServiceProvider} instances. The system
|
||||
* will call this method after binding the data service for each active SIM slot id.
|
||||
*
|
||||
* @param slotId SIM slot id the data service associated with.
|
||||
* @param slotIndex SIM slot id the data service associated with.
|
||||
* @return Data service object
|
||||
*/
|
||||
public abstract DataServiceProvider createDataServiceProvider(int slotId);
|
||||
@Nullable
|
||||
public abstract DataServiceProvider onCreateDataServiceProvider(int slotIndex);
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (intent == null || !DATA_SERVICE_INTERFACE.equals(intent.getAction())) {
|
||||
@@ -469,17 +469,16 @@ public abstract class DataService extends Service {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REMOVE_ALL_DATA_SERVICE_PROVIDERS).sendToTarget();
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mHandlerThread.quit();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,78 +486,78 @@ public abstract class DataService extends Service {
|
||||
*/
|
||||
private class IDataServiceWrapper extends IDataService.Stub {
|
||||
@Override
|
||||
public void createDataServiceProvider(int slotId) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER, slotId, 0)
|
||||
public void createDataServiceProvider(int slotIndex) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_CREATE_DATA_SERVICE_PROVIDER, slotIndex, 0)
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataServiceProvider(int slotId) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER, slotId, 0)
|
||||
public void removeDataServiceProvider(int slotIndex) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REMOVE_DATA_SERVICE_PROVIDER, slotIndex, 0)
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupDataCall(int slotId, int accessNetworkType, DataProfile dataProfile,
|
||||
public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile,
|
||||
boolean isRoaming, boolean allowRoaming, int reason,
|
||||
LinkProperties linkProperties, IDataServiceCallback callback) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotId, 0,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0,
|
||||
new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming,
|
||||
allowRoaming, reason, linkProperties, callback))
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivateDataCall(int slotId, int cid, int reason,
|
||||
public void deactivateDataCall(int slotIndex, int cid, int reason,
|
||||
IDataServiceCallback callback) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL, slotId, 0,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL, slotIndex, 0,
|
||||
new DeactivateDataCallRequest(cid, reason, callback))
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInitialAttachApn(int slotId, DataProfile dataProfile, boolean isRoaming,
|
||||
public void setInitialAttachApn(int slotIndex, DataProfile dataProfile, boolean isRoaming,
|
||||
IDataServiceCallback callback) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN, slotId, 0,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN, slotIndex, 0,
|
||||
new SetInitialAttachApnRequest(dataProfile, isRoaming, callback))
|
||||
.sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataProfile(int slotId, List<DataProfile> dps, boolean isRoaming,
|
||||
public void setDataProfile(int slotIndex, List<DataProfile> dps, boolean isRoaming,
|
||||
IDataServiceCallback callback) {
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_DATA_PROFILE, slotId, 0,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SET_DATA_PROFILE, slotIndex, 0,
|
||||
new SetDataProfileRequest(dps, isRoaming, callback)).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDataCallList(int slotId, IDataServiceCallback callback) {
|
||||
public void getDataCallList(int slotIndex, IDataServiceCallback callback) {
|
||||
if (callback == null) {
|
||||
loge("getDataCallList: callback is null");
|
||||
return;
|
||||
}
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotId, 0,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotIndex, 0,
|
||||
callback).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerForDataCallListChanged(int slotId, IDataServiceCallback callback) {
|
||||
public void registerForDataCallListChanged(int slotIndex, IDataServiceCallback callback) {
|
||||
if (callback == null) {
|
||||
loge("registerForDataCallListChanged: callback is null");
|
||||
return;
|
||||
}
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotId,
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotIndex,
|
||||
0, callback).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback) {
|
||||
public void unregisterForDataCallListChanged(int slotIndex, IDataServiceCallback callback) {
|
||||
if (callback == null) {
|
||||
loge("unregisterForDataCallListChanged: callback is null");
|
||||
return;
|
||||
}
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotId,
|
||||
0, callback).sendToTarget();
|
||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED,
|
||||
slotIndex, 0, callback).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package android.telephony.data;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.net.LinkProperties;
|
||||
import android.os.RemoteException;
|
||||
@@ -74,7 +76,8 @@ public class DataServiceCallback {
|
||||
* @param result The result code. Must be one of the {@link ResultCode}.
|
||||
* @param response Setup data call response.
|
||||
*/
|
||||
public void onSetupDataCallComplete(@ResultCode int result, DataCallResponse response) {
|
||||
public void onSetupDataCallComplete(@ResultCode int result,
|
||||
@Nullable DataCallResponse response) {
|
||||
IDataServiceCallback callback = mCallback.get();
|
||||
if (callback != null) {
|
||||
try {
|
||||
@@ -141,10 +144,11 @@ public class DataServiceCallback {
|
||||
* DataServiceCallback)}.
|
||||
*
|
||||
* @param result The result code. Must be one of the {@link ResultCode}.
|
||||
* @param dataCallList List of the current active data connection.
|
||||
* @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,
|
||||
List<DataCallResponse> dataCallList) {
|
||||
@NonNull List<DataCallResponse> dataCallList) {
|
||||
IDataServiceCallback callback = mCallback.get();
|
||||
if (callback != null) {
|
||||
try {
|
||||
@@ -156,11 +160,12 @@ public class DataServiceCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to indicate that data connection list changed.
|
||||
* Called to indicate that data connection list changed. If no data call is presented, set it to
|
||||
* an empty list.
|
||||
*
|
||||
* @param dataCallList List of the current active data connection.
|
||||
*/
|
||||
public void onDataCallListChanged(List<DataCallResponse> dataCallList) {
|
||||
public void onDataCallListChanged(@NonNull List<DataCallResponse> dataCallList) {
|
||||
IDataServiceCallback callback = mCallback.get();
|
||||
if (callback != null) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user