diff options
| -rwxr-xr-x | api/current.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 30 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkRegistrationState.java | 218 | ||||
| -rw-r--r-- | telephony/java/android/telephony/NetworkService.java | 57 | ||||
| -rw-r--r-- | telephony/java/android/telephony/ServiceState.java | 4 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/DataService.java | 76 |
6 files changed, 303 insertions, 84 deletions
diff --git a/api/current.txt b/api/current.txt index 9ebd4b4f18be..463d0fb88df8 100755 --- a/api/current.txt +++ b/api/current.txt @@ -42727,7 +42727,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(); diff --git a/api/system-current.txt b/api/system-current.txt index fd6a37c135a0..b25f02b4edfe 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6030,11 +6030,10 @@ 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 @NonNull public int[] getAvailableServices(); method public android.telephony.CellIdentity getCellIdentity(); method @Nullable public android.telephony.DataSpecificRegistrationStates getDataSpecificStates(); method public int getDomain(); @@ -6061,9 +6060,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 public abstract android.telephony.NetworkService.NetworkServiceProvider onCreateNetworkServiceProvider(int); field public static final String NETWORK_SERVICE_INTERFACE = "android.telephony.NetworkService"; } @@ -6071,7 +6086,7 @@ 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(); } @@ -6549,7 +6564,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 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 @@ -6561,7 +6577,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); diff --git a/telephony/java/android/telephony/NetworkRegistrationState.java b/telephony/java/android/telephony/NetworkRegistrationState.java index 84d6628d47d2..aeaa04d6d0b3 100644 --- a/telephony/java/android/telephony/NetworkRegistrationState.java +++ b/telephony/java/android/telephony/NetworkRegistrationState.java @@ -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(); @@ -309,25 +313,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; @@ -539,4 +547,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); + } + } } diff --git a/telephony/java/android/telephony/NetworkService.java b/telephony/java/android/telephony/NetworkService.java index bec949406b6c..31b4d17e2002 100644 --- a/telephony/java/android/telephony/NetworkService.java +++ b/telephony/java/android/telephony/NetworkService.java @@ -82,27 +82,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 +113,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 +160,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 +229,11 @@ 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); + public abstract NetworkServiceProvider onCreateNetworkServiceProvider(int slotIndex); - /** @hide */ @Override public IBinder onBind(Intent intent) { if (intent == null || !NETWORK_SERVICE_INTERFACE.equals(intent.getAction())) { @@ -239,7 +244,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 +256,7 @@ public abstract class NetworkService extends Service { @Override public void onDestroy() { mHandlerThread.quit(); + super.onDestroy(); } /** @@ -261,35 +266,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(); } } diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index f2daace24050..611812996b28 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -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(); diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java index a3fa77bd9b47..08b81a57541e 100644 --- a/telephony/java/android/telephony/data/DataService.java +++ b/telephony/java/android/telephony/data/DataService.java @@ -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,11 @@ 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); + public abstract DataServiceProvider onCreateDataServiceProvider(int slotIndex); - /** @hide */ @Override public IBinder onBind(Intent intent) { if (intent == null || !DATA_SERVICE_INTERFACE.equals(intent.getAction())) { @@ -469,17 +468,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 +485,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(); } } |