Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -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(); api/system-current.txt +28 −13 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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"; } Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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 Loading @@ -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); Loading @@ -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 Loading telephony/java/android/telephony/NetworkRegistrationState.java +208 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -140,6 +142,7 @@ public class NetworkRegistrationState implements Parcelable { @ServiceState.RoamingType private int mRoamingType; @NetworkType private int mAccessNetworkTechnology; @NRStatus Loading @@ -149,6 +152,7 @@ public class NetworkRegistrationState implements Parcelable { private final boolean mEmergencyOnly; @ServiceType private final int[] mAvailableServices; @Nullable Loading @@ -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 Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; Loading @@ -344,6 +352,7 @@ public class NetworkRegistrationState implements Parcelable { /** * @return The cell information. */ @Nullable public CellIdentity getCellIdentity() { return mCellIdentity; } Loading Loading @@ -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); } } } telephony/java/android/telephony/NetworkService.java +33 −26 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading @@ -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) { Loading Loading @@ -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: Loading Loading @@ -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())) { Loading @@ -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, Loading @@ -252,6 +258,7 @@ public abstract class NetworkService extends Service { @Override public void onDestroy() { mHandlerThread.quit(); super.onDestroy(); } /** Loading @@ -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(); } } Loading telephony/java/android/telephony/NetworkServiceCallback.java +3 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -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();
api/system-current.txt +28 −13 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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"; } Loading @@ -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 Loading Loading @@ -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(); Loading Loading @@ -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 Loading @@ -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); Loading @@ -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 Loading
telephony/java/android/telephony/NetworkRegistrationState.java +208 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -140,6 +142,7 @@ public class NetworkRegistrationState implements Parcelable { @ServiceState.RoamingType private int mRoamingType; @NetworkType private int mAccessNetworkTechnology; @NRStatus Loading @@ -149,6 +152,7 @@ public class NetworkRegistrationState implements Parcelable { private final boolean mEmergencyOnly; @ServiceType private final int[] mAvailableServices; @Nullable Loading @@ -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 Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; Loading @@ -344,6 +352,7 @@ public class NetworkRegistrationState implements Parcelable { /** * @return The cell information. */ @Nullable public CellIdentity getCellIdentity() { return mCellIdentity; } Loading Loading @@ -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); } } }
telephony/java/android/telephony/NetworkService.java +33 −26 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading @@ -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) { Loading Loading @@ -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: Loading Loading @@ -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())) { Loading @@ -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, Loading @@ -252,6 +258,7 @@ public abstract class NetworkService extends Service { @Override public void onDestroy() { mHandlerThread.quit(); super.onDestroy(); } /** Loading @@ -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(); } } Loading
telephony/java/android/telephony/NetworkServiceCallback.java +3 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading