Loading telephony/java/android/telephony/data/DataService.java +40 −21 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.telephony.data; import android.annotation.CallSuper; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; Loading @@ -30,7 +32,6 @@ import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants; import android.telephony.Rlog; import android.telephony.SubscriptionManager; import android.util.SparseArray; import java.lang.annotation.Retention; Loading Loading @@ -146,11 +147,13 @@ public abstract class DataService extends Service { * {@link #REQUEST_REASON_HANDOVER}. * @param linkProperties If {@code reason} is {@link #REQUEST_REASON_HANDOVER}, this is the * link properties of the existing data connection, otherwise null. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, LinkProperties linkProperties, DataServiceCallback callback) { @Nullable LinkProperties linkProperties, @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetupDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED, null); } Loading @@ -164,10 +167,12 @@ public abstract class DataService extends Service { * int, DataProfile, boolean, boolean, int, LinkProperties, DataServiceCallback)}. * @param reason The reason for data deactivation. Must be {@link #REQUEST_REASON_NORMAL}, * {@link #REQUEST_REASON_SHUTDOWN} or {@link #REQUEST_REASON_HANDOVER}. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. * */ public void deactivateDataCall(int cid, @DeactivateDataReason int reason, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onDeactivateDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -177,10 +182,11 @@ public abstract class DataService extends Service { * * @param dataProfile Data profile used for data call setup. See {@link DataProfile}. * @param isRoaming True if the device is data roaming. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetInitialAttachApnComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -192,10 +198,11 @@ public abstract class DataService extends Service { * * @param dps A list of data profiles. * @param isRoaming True if the device is data roaming. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setDataProfile(List<DataProfile> dps, boolean isRoaming, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetDataProfileComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -205,7 +212,7 @@ public abstract class DataService extends Service { * * @param callback The result callback for this request. */ public void getDataCallList(DataServiceCallback callback) { public void getDataCallList(@NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onGetDataCallListComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED, null); } Loading Loading @@ -354,7 +361,9 @@ public abstract class DataService extends Service { setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming, setupDataCallRequest.allowRoaming, setupDataCallRequest.reason, setupDataCallRequest.linkProperties, new DataServiceCallback(setupDataCallRequest.callback)); (setupDataCallRequest.callback != null) ? new DataServiceCallback(setupDataCallRequest.callback) : null); break; case DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL: Loading @@ -363,7 +372,9 @@ public abstract class DataService extends Service { (DeactivateDataCallRequest) message.obj; serviceProvider.deactivateDataCall(deactivateDataCallRequest.cid, deactivateDataCallRequest.reason, new DataServiceCallback(deactivateDataCallRequest.callback)); (deactivateDataCallRequest.callback != null) ? new DataServiceCallback(deactivateDataCallRequest.callback) : null); break; case DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN: if (serviceProvider == null) break; Loading @@ -371,7 +382,9 @@ public abstract class DataService extends Service { (SetInitialAttachApnRequest) message.obj; serviceProvider.setInitialAttachApn(setInitialAttachApnRequest.dataProfile, setInitialAttachApnRequest.isRoaming, new DataServiceCallback(setInitialAttachApnRequest.callback)); (setInitialAttachApnRequest.callback != null) ? new DataServiceCallback(setInitialAttachApnRequest.callback) : null); break; case DATA_SERVICE_REQUEST_SET_DATA_PROFILE: if (serviceProvider == null) break; Loading @@ -379,7 +392,9 @@ public abstract class DataService extends Service { (SetDataProfileRequest) message.obj; serviceProvider.setDataProfile(setDataProfileRequest.dps, setDataProfileRequest.isRoaming, new DataServiceCallback(setDataProfileRequest.callback)); (setDataProfileRequest.callback != null) ? new DataServiceCallback(setDataProfileRequest.callback) : null); break; case DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST: if (serviceProvider == null) break; Loading Loading @@ -503,6 +518,10 @@ public abstract class DataService extends Service { @Override public void getDataCallList(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("getDataCallList: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotId, 0, callback).sendToTarget(); } Loading @@ -510,7 +529,7 @@ public abstract class DataService extends Service { @Override public void registerForDataCallListChanged(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("Callback is null"); loge("registerForDataCallListChanged: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotId, Loading @@ -520,7 +539,7 @@ public abstract class DataService extends Service { @Override public void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("Callback is null"); loge("unregisterForDataCallListChanged: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotId, Loading telephony/java/android/telephony/data/DataServiceCallback.java +7 −7 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import java.util.List; @SystemApi public class DataServiceCallback { private static final String mTag = DataServiceCallback.class.getSimpleName(); private static final String TAG = DataServiceCallback.class.getSimpleName(); /** * Result of data requests Loading Loading @@ -80,7 +80,7 @@ public class DataServiceCallback { try { callback.onSetupDataCallComplete(result, response); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetupDataCallComplete on the remote"); Rlog.e(TAG, "Failed to onSetupDataCallComplete on the remote"); } } } Loading @@ -97,7 +97,7 @@ public class DataServiceCallback { try { callback.onDeactivateDataCallComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onDeactivateDataCallComplete on the remote"); Rlog.e(TAG, "Failed to onDeactivateDataCallComplete on the remote"); } } } Loading @@ -114,7 +114,7 @@ public class DataServiceCallback { try { callback.onSetInitialAttachApnComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetInitialAttachApnComplete on the remote"); Rlog.e(TAG, "Failed to onSetInitialAttachApnComplete on the remote"); } } } Loading @@ -132,7 +132,7 @@ public class DataServiceCallback { try { callback.onSetDataProfileComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetDataProfileComplete on the remote"); Rlog.e(TAG, "Failed to onSetDataProfileComplete on the remote"); } } } Loading @@ -151,7 +151,7 @@ public class DataServiceCallback { try { callback.onGetDataCallListComplete(result, dataCallList); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onGetDataCallListComplete on the remote"); Rlog.e(TAG, "Failed to onGetDataCallListComplete on the remote"); } } } Loading @@ -167,7 +167,7 @@ public class DataServiceCallback { try { callback.onDataCallListChanged(dataCallList); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onDataCallListChanged on the remote"); Rlog.e(TAG, "Failed to onDataCallListChanged on the remote"); } } } Loading Loading
telephony/java/android/telephony/data/DataService.java +40 −21 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package android.telephony.data; import android.annotation.CallSuper; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; Loading @@ -30,7 +32,6 @@ import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants; import android.telephony.Rlog; import android.telephony.SubscriptionManager; import android.util.SparseArray; import java.lang.annotation.Retention; Loading Loading @@ -146,11 +147,13 @@ public abstract class DataService extends Service { * {@link #REQUEST_REASON_HANDOVER}. * @param linkProperties If {@code reason} is {@link #REQUEST_REASON_HANDOVER}, this is the * link properties of the existing data connection, otherwise null. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, LinkProperties linkProperties, DataServiceCallback callback) { @Nullable LinkProperties linkProperties, @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetupDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED, null); } Loading @@ -164,10 +167,12 @@ public abstract class DataService extends Service { * int, DataProfile, boolean, boolean, int, LinkProperties, DataServiceCallback)}. * @param reason The reason for data deactivation. Must be {@link #REQUEST_REASON_NORMAL}, * {@link #REQUEST_REASON_SHUTDOWN} or {@link #REQUEST_REASON_HANDOVER}. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. * */ public void deactivateDataCall(int cid, @DeactivateDataReason int reason, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onDeactivateDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -177,10 +182,11 @@ public abstract class DataService extends Service { * * @param dataProfile Data profile used for data call setup. See {@link DataProfile}. * @param isRoaming True if the device is data roaming. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetInitialAttachApnComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -192,10 +198,11 @@ public abstract class DataService extends Service { * * @param dps A list of data profiles. * @param isRoaming True if the device is data roaming. * @param callback The result callback for this request. * @param callback The result callback for this request. Null if the client does not care * about the result. */ public void setDataProfile(List<DataProfile> dps, boolean isRoaming, DataServiceCallback callback) { @Nullable DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onSetDataProfileComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } Loading @@ -205,7 +212,7 @@ public abstract class DataService extends Service { * * @param callback The result callback for this request. */ public void getDataCallList(DataServiceCallback callback) { public void getDataCallList(@NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. callback.onGetDataCallListComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED, null); } Loading Loading @@ -354,7 +361,9 @@ public abstract class DataService extends Service { setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming, setupDataCallRequest.allowRoaming, setupDataCallRequest.reason, setupDataCallRequest.linkProperties, new DataServiceCallback(setupDataCallRequest.callback)); (setupDataCallRequest.callback != null) ? new DataServiceCallback(setupDataCallRequest.callback) : null); break; case DATA_SERVICE_REQUEST_DEACTIVATE_DATA_CALL: Loading @@ -363,7 +372,9 @@ public abstract class DataService extends Service { (DeactivateDataCallRequest) message.obj; serviceProvider.deactivateDataCall(deactivateDataCallRequest.cid, deactivateDataCallRequest.reason, new DataServiceCallback(deactivateDataCallRequest.callback)); (deactivateDataCallRequest.callback != null) ? new DataServiceCallback(deactivateDataCallRequest.callback) : null); break; case DATA_SERVICE_REQUEST_SET_INITIAL_ATTACH_APN: if (serviceProvider == null) break; Loading @@ -371,7 +382,9 @@ public abstract class DataService extends Service { (SetInitialAttachApnRequest) message.obj; serviceProvider.setInitialAttachApn(setInitialAttachApnRequest.dataProfile, setInitialAttachApnRequest.isRoaming, new DataServiceCallback(setInitialAttachApnRequest.callback)); (setInitialAttachApnRequest.callback != null) ? new DataServiceCallback(setInitialAttachApnRequest.callback) : null); break; case DATA_SERVICE_REQUEST_SET_DATA_PROFILE: if (serviceProvider == null) break; Loading @@ -379,7 +392,9 @@ public abstract class DataService extends Service { (SetDataProfileRequest) message.obj; serviceProvider.setDataProfile(setDataProfileRequest.dps, setDataProfileRequest.isRoaming, new DataServiceCallback(setDataProfileRequest.callback)); (setDataProfileRequest.callback != null) ? new DataServiceCallback(setDataProfileRequest.callback) : null); break; case DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST: if (serviceProvider == null) break; Loading Loading @@ -503,6 +518,10 @@ public abstract class DataService extends Service { @Override public void getDataCallList(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("getDataCallList: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_GET_DATA_CALL_LIST, slotId, 0, callback).sendToTarget(); } Loading @@ -510,7 +529,7 @@ public abstract class DataService extends Service { @Override public void registerForDataCallListChanged(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("Callback is null"); loge("registerForDataCallListChanged: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED, slotId, Loading @@ -520,7 +539,7 @@ public abstract class DataService extends Service { @Override public void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback) { if (callback == null) { loge("Callback is null"); loge("unregisterForDataCallListChanged: callback is null"); return; } mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotId, Loading
telephony/java/android/telephony/data/DataServiceCallback.java +7 −7 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ import java.util.List; @SystemApi public class DataServiceCallback { private static final String mTag = DataServiceCallback.class.getSimpleName(); private static final String TAG = DataServiceCallback.class.getSimpleName(); /** * Result of data requests Loading Loading @@ -80,7 +80,7 @@ public class DataServiceCallback { try { callback.onSetupDataCallComplete(result, response); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetupDataCallComplete on the remote"); Rlog.e(TAG, "Failed to onSetupDataCallComplete on the remote"); } } } Loading @@ -97,7 +97,7 @@ public class DataServiceCallback { try { callback.onDeactivateDataCallComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onDeactivateDataCallComplete on the remote"); Rlog.e(TAG, "Failed to onDeactivateDataCallComplete on the remote"); } } } Loading @@ -114,7 +114,7 @@ public class DataServiceCallback { try { callback.onSetInitialAttachApnComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetInitialAttachApnComplete on the remote"); Rlog.e(TAG, "Failed to onSetInitialAttachApnComplete on the remote"); } } } Loading @@ -132,7 +132,7 @@ public class DataServiceCallback { try { callback.onSetDataProfileComplete(result); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onSetDataProfileComplete on the remote"); Rlog.e(TAG, "Failed to onSetDataProfileComplete on the remote"); } } } Loading @@ -151,7 +151,7 @@ public class DataServiceCallback { try { callback.onGetDataCallListComplete(result, dataCallList); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onGetDataCallListComplete on the remote"); Rlog.e(TAG, "Failed to onGetDataCallListComplete on the remote"); } } } Loading @@ -167,7 +167,7 @@ public class DataServiceCallback { try { callback.onDataCallListChanged(dataCallList); } catch (RemoteException e) { Rlog.e(mTag, "Failed to onDataCallListChanged on the remote"); Rlog.e(TAG, "Failed to onDataCallListChanged on the remote"); } } } Loading