Loading core/api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -11048,6 +11048,7 @@ package android.telephony.data { method public int getMtuV4(); method public int getMtuV6(); method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses(); method public int getPduSessionId(); method public int getProtocolType(); method public long getRetryDurationMillis(); method @Deprecated public int getSuggestedRetryTime(); Loading @@ -11062,6 +11063,7 @@ package android.telephony.data { field public static final int LINK_STATUS_DORMANT = 1; // 0x1 field public static final int LINK_STATUS_INACTIVE = 0; // 0x0 field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff field public static final int PDU_SESSION_ID_NOT_SET = 0; // 0x0 field public static final int RETRY_DURATION_UNDEFINED = -1; // 0xffffffff } Loading @@ -11080,6 +11082,7 @@ package android.telephony.data { method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV4(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>); method @NonNull public android.telephony.data.DataCallResponse.Builder setPduSessionId(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryDurationMillis(long); method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int); Loading Loading @@ -11144,6 +11147,7 @@ package android.telephony.data { public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable { ctor public DataService.DataServiceProvider(int); method public void cancelHandover(int, @NonNull android.telephony.data.DataServiceCallback); method public abstract void close(); method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback); method public final int getSlotIndex(); Loading @@ -11152,11 +11156,15 @@ package android.telephony.data { method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback); method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback); method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @NonNull android.telephony.data.DataServiceCallback); method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @IntRange(from=0, to=15) int, @NonNull android.telephony.data.DataServiceCallback); method public void startHandover(int, @NonNull android.telephony.data.DataServiceCallback); } public class DataServiceCallback { method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onDeactivateDataCallComplete(int); method public void onHandoverCancelled(int); method public void onHandoverStarted(int); method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onSetDataProfileComplete(int); method public void onSetInitialAttachApnComplete(int); telephony/java/android/telephony/data/DataCallResponse.java +36 −4 Original line number Diff line number Diff line Loading @@ -115,6 +115,11 @@ public final class DataCallResponse implements Parcelable { */ public static final int RETRY_DURATION_UNDEFINED = -1; /** * Indicates that the pdu session id is not set. */ public static final int PDU_SESSION_ID_NOT_SET = 0; private final @DataFailureCause int mCause; private final long mSuggestedRetryTime; private final int mId; Loading @@ -129,6 +134,7 @@ public final class DataCallResponse implements Parcelable { private final int mMtuV4; private final int mMtuV6; private final @HandoverFailureMode int mHandoverFailureMode; private final int mPduSessionId; /** * @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error. Loading Loading @@ -176,6 +182,7 @@ public final class DataCallResponse implements Parcelable { ? new ArrayList<>() : new ArrayList<>(pcscfAddresses); mMtu = mMtuV4 = mMtuV6 = mtu; mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY; mPduSessionId = PDU_SESSION_ID_NOT_SET; } private DataCallResponse(@DataFailureCause int cause, long suggestedRetryTime, int id, Loading @@ -183,7 +190,7 @@ public final class DataCallResponse implements Parcelable { @Nullable String interfaceName, @Nullable List<LinkAddress> addresses, @Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses, @Nullable List<InetAddress> pcscfAddresses, int mtu, int mtuV4, int mtuV6, @HandoverFailureMode int handoverFailureMode) { @HandoverFailureMode int handoverFailureMode, int pduSessionId) { mCause = cause; mSuggestedRetryTime = suggestedRetryTime; mId = id; Loading @@ -202,6 +209,7 @@ public final class DataCallResponse implements Parcelable { mMtuV4 = mtuV4; mMtuV6 = mtuV6; mHandoverFailureMode = handoverFailureMode; mPduSessionId = pduSessionId; } /** @hide */ Loading @@ -225,6 +233,7 @@ public final class DataCallResponse implements Parcelable { mMtuV4 = source.readInt(); mMtuV6 = source.readInt(); mHandoverFailureMode = source.readInt(); mPduSessionId = source.readInt(); } /** Loading Loading @@ -341,6 +350,13 @@ public final class DataCallResponse implements Parcelable { return mHandoverFailureMode; } /** * @return The pdu session id */ public int getPduSessionId() { return mPduSessionId; } @NonNull @Override public String toString() { Loading @@ -360,6 +376,7 @@ public final class DataCallResponse implements Parcelable { .append(" mtuV4=").append(getMtuV4()) .append(" mtuV6=").append(getMtuV6()) .append(" handoverFailureMode=").append(getHandoverFailureMode()) .append(" pduSessionId=").append(getPduSessionId()) .append("}"); return sb.toString(); } Loading Loading @@ -390,14 +407,15 @@ public final class DataCallResponse implements Parcelable { && mMtu == other.mMtu && mMtuV4 == other.mMtuV4 && mMtuV6 == other.mMtuV6 && mHandoverFailureMode == other.mHandoverFailureMode; && mHandoverFailureMode == other.mHandoverFailureMode && mPduSessionId == other.mPduSessionId; } @Override public int hashCode() { return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode); mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId); } @Override Loading @@ -421,6 +439,7 @@ public final class DataCallResponse implements Parcelable { dest.writeInt(mMtuV4); dest.writeInt(mMtuV6); dest.writeInt(mHandoverFailureMode); dest.writeInt(mPduSessionId); } public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR = Loading Loading @@ -498,6 +517,8 @@ public final class DataCallResponse implements Parcelable { private @HandoverFailureMode int mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY; private int mPduSessionId = PDU_SESSION_ID_NOT_SET; /** * Default constructor for Builder. */ Loading Loading @@ -680,6 +701,17 @@ public final class DataCallResponse implements Parcelable { return this; } /** * Set pdu session id. * * @param pduSessionId Pdu Session Id of the data call. * @return The same instance of the builder. */ public @NonNull Builder setPduSessionId(int pduSessionId) { mPduSessionId = pduSessionId; return this; } /** * Build the DataCallResponse. * Loading @@ -688,7 +720,7 @@ public final class DataCallResponse implements Parcelable { public @NonNull DataCallResponse build() { return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode); mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId); } } } telephony/java/android/telephony/data/DataService.java +140 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.telephony.data; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; Loading @@ -30,7 +31,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants; import android.util.Log; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -104,6 +105,8 @@ public abstract class DataService extends Service { private static final int DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED = 9; private static final int DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED = 10; private static final int DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED = 11; private static final int DATA_SERVICE_REQUEST_START_HANDOVER = 12; private static final int DATA_SERVICE_REQUEST_CANCEL_HANDOVER = 13; private final HandlerThread mHandlerThread; Loading Loading @@ -147,7 +150,7 @@ public abstract class DataService extends Service { * the provided callback to notify the platform. * * @param accessNetworkType Access network type that the data call will be established on. * Must be one of {@link AccessNetworkConstants.AccessNetworkType}. * Must be one of {@link android.telephony.AccessNetworkConstants.AccessNetworkType}. * @param dataProfile Data profile used for data call setup. See {@link DataProfile} * @param isRoaming True if the device is data roaming. * @param allowRoaming True if data roaming is allowed by the user. Loading @@ -159,8 +162,7 @@ public abstract class DataService extends Service { */ public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Loading @@ -169,6 +171,37 @@ public abstract class DataService extends Service { } } /** * Setup a data connection. The data service provider must implement this method to support * establishing a packet data connection. When completed or error, the service must invoke * the provided callback to notify the platform. * * @param accessNetworkType Access network type that the data call will be established on. * Must be one of {@link android.telephony.AccessNetworkConstants.AccessNetworkType}. * @param dataProfile Data profile used for data call setup. See {@link DataProfile} * @param isRoaming True if the device is data roaming. * @param allowRoaming True if data roaming is allowed by the user. * @param reason The reason for data setup. Must be {@link #REQUEST_REASON_NORMAL} or * {@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 pduSessionId The pdu session id to be used for this data call. * The standard range of values are 1-15 while 0 means no pdu session id * was attached to this call. Reference: 3GPP TS 24.007 section * 11.2.3.1b. * @param callback The result callback for this request. */ public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @IntRange(from = 0, to = 15) int pduSessionId, @NonNull DataServiceCallback callback) { /* Call the old version since the new version isn't supported */ setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming, reason, linkProperties, callback); } /** * Deactivate a data connection. The data service provider must implement this method to * support data connection tear down. When completed or error, the service must invoke the Loading Loading @@ -223,6 +256,53 @@ public abstract class DataService extends Service { } } /** * Indicates that a handover has begun. This is called on the source transport. * * Any resources being transferred cannot be released while a * handover is underway. * * If a handover was unsuccessful, then the framework calls * {@link DataService#cancelHandover}. The target transport retains ownership over any of * the resources being transferred. * * If a handover was successful, the framework calls {@link DataService#deactivateDataCall} * with reason {@link DataService.REQUEST_REASON_HANDOVER}. The target transport now owns * the transferred resources and is responsible for releasing them. * * @param cid The identifier of the data call which is provided in {@link DataCallResponse} * @param callback The result callback for this request. */ public void startHandover(int cid, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Log.d(TAG, "startHandover: " + cid); callback.onHandoverStarted(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } else { Log.e(TAG, "startHandover: " + cid + ", callback is null"); } } /** * Indicates that a handover was cancelled after a call to * {@link DataService#startHandover}. This is called on the source transport. * * Since the handover was unsuccessful, the source transport retains ownership over any of * the resources being transferred and is still responsible for releasing them. * * @param cid The identifier of the data call which is provided in {@link DataCallResponse} * @param callback The result callback for this request. */ public void cancelHandover(int cid, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Log.d(TAG, "cancelHandover: " + cid); callback.onHandoverCancelled(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } else { Log.e(TAG, "cancelHandover: " + cid + ", callback is null"); } } /** * Get the active data call list. * Loading Loading @@ -278,16 +358,18 @@ public abstract class DataService extends Service { public final boolean allowRoaming; public final int reason; public final LinkProperties linkProperties; public final int pduSessionId; public final IDataServiceCallback callback; SetupDataCallRequest(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, IDataServiceCallback callback) { int pduSessionId, IDataServiceCallback callback) { this.accessNetworkType = accessNetworkType; this.dataProfile = dataProfile; this.isRoaming = isRoaming; this.allowRoaming = allowRoaming; this.linkProperties = linkProperties; this.reason = reason; this.pduSessionId = pduSessionId; this.callback = callback; } } Loading Loading @@ -327,6 +409,16 @@ public abstract class DataService extends Service { } } private static final class BeginCancelHandoverRequest { public final int cid; public final IDataServiceCallback callback; BeginCancelHandoverRequest(int cid, IDataServiceCallback callback) { this.cid = cid; this.callback = callback; } } private static final class DataCallListChangedIndication { public final List<DataCallResponse> dataCallList; public final IDataServiceCallback callback; Loading Loading @@ -377,7 +469,7 @@ public abstract class DataService extends Service { serviceProvider.setupDataCall(setupDataCallRequest.accessNetworkType, setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming, setupDataCallRequest.allowRoaming, setupDataCallRequest.reason, setupDataCallRequest.linkProperties, setupDataCallRequest.linkProperties, setupDataCallRequest.pduSessionId, (setupDataCallRequest.callback != null) ? new DataServiceCallback(setupDataCallRequest.callback) : null); Loading Loading @@ -438,6 +530,20 @@ public abstract class DataService extends Service { loge("Failed to call onDataCallListChanged. " + e); } break; case DATA_SERVICE_REQUEST_START_HANDOVER: if (serviceProvider == null) break; BeginCancelHandoverRequest bReq = (BeginCancelHandoverRequest) message.obj; serviceProvider.startHandover(bReq.cid, (bReq.callback != null) ? new DataServiceCallback(bReq.callback) : null); break; case DATA_SERVICE_REQUEST_CANCEL_HANDOVER: if (serviceProvider == null) break; BeginCancelHandoverRequest cReq = (BeginCancelHandoverRequest) message.obj; serviceProvider.cancelHandover(cReq.cid, (cReq.callback != null) ? new DataServiceCallback(cReq.callback) : null); break; } } } Loading Loading @@ -507,10 +613,10 @@ public abstract class DataService extends Service { @Override public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, IDataServiceCallback callback) { LinkProperties linkProperties, int pduSessionId, IDataServiceCallback callback) { mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0, new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming, allowRoaming, reason, linkProperties, callback)) allowRoaming, reason, linkProperties, pduSessionId, callback)) .sendToTarget(); } Loading Loading @@ -566,6 +672,29 @@ public abstract class DataService extends Service { mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotIndex, 0, callback).sendToTarget(); } @Override public void startHandover(int slotIndex, int cid, IDataServiceCallback callback) { if (callback == null) { loge("startHandover: callback is null"); return; } BeginCancelHandoverRequest req = new BeginCancelHandoverRequest(cid, callback); mHandler.obtainMessage(DATA_SERVICE_REQUEST_START_HANDOVER, slotIndex, 0, req) .sendToTarget(); } @Override public void cancelHandover(int slotIndex, int cid, IDataServiceCallback callback) { if (callback == null) { loge("cancelHandover: callback is null"); return; } BeginCancelHandoverRequest req = new BeginCancelHandoverRequest(cid, callback); mHandler.obtainMessage(DATA_SERVICE_REQUEST_CANCEL_HANDOVER, slotIndex, 0, req).sendToTarget(); } } private void log(String s) { Loading telephony/java/android/telephony/data/DataServiceCallback.java +64 −2 Original line number Diff line number Diff line Loading @@ -186,4 +186,66 @@ public class DataServiceCallback { Rlog.e(TAG, "onDataCallListChanged: callback is null!"); } } /** * Called to indicate result for the request {@link DataService#startHandover}. * * @param result The result code. Must be one of the {@link ResultCode} */ public void onHandoverStarted(@ResultCode int result) { if (mCallback != null) { try { if (DBG) Rlog.d(TAG, "onHandoverStarted"); mCallback.onHandoverStarted(result); } catch (RemoteException e) { Rlog.e(TAG, "Failed to onHandoverStarted on the remote"); } } else { Rlog.e(TAG, "onHandoverStarted: callback is null!"); } } /** * Called to indicate result for the request {@link DataService#cancelHandover}. * * @param result The result code. Must be one of the {@link ResultCode} */ public void onHandoverCancelled(@ResultCode int result) { if (mCallback != null) { try { if (DBG) Rlog.d(TAG, "onHandoverCancelled"); mCallback.onHandoverCancelled(result); } catch (RemoteException e) { Rlog.e(TAG, "Failed to onHandoverCancelled on the remote"); } } else { Rlog.e(TAG, "onHandoverCancelled: callback is null!"); } } /** * Get the result code as a string * * @param resultCode The result code. Must be one of the {@link ResultCode} * @return the string representation * * @hide */ @NonNull public static String resultCodeToString(@DataServiceCallback.ResultCode int resultCode) { switch(resultCode) { case RESULT_SUCCESS: return "RESULT_SUCCESS"; case RESULT_ERROR_UNSUPPORTED: return "RESULT_ERROR_UNSUPPORTED"; case RESULT_ERROR_INVALID_ARG: return "RESULT_ERROR_INVALID_ARG"; case RESULT_ERROR_BUSY: return "RESULT_ERROR_BUSY"; case RESULT_ERROR_ILLEGAL_STATE: return "RESULT_ERROR_ILLEGAL_STATE"; default: return "Missing case for result code=" + resultCode; } } } telephony/java/android/telephony/data/IDataService.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ oneway interface IDataService void removeDataServiceProvider(int slotId); void setupDataCall(int slotId, int accessNetwork, in DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, in LinkProperties linkProperties, IDataServiceCallback callback); int pduSessionId, IDataServiceCallback callback); void deactivateDataCall(int slotId, int cid, int reason, IDataServiceCallback callback); void setInitialAttachApn(int slotId, in DataProfile dataProfile, boolean isRoaming, IDataServiceCallback callback); Loading @@ -38,4 +38,6 @@ oneway interface IDataService void requestDataCallList(int slotId, IDataServiceCallback callback); void registerForDataCallListChanged(int slotId, IDataServiceCallback callback); void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback); void startHandover(int slotId, int cid, IDataServiceCallback callback); void cancelHandover(int slotId, int cid, IDataServiceCallback callback); } Loading
core/api/system-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -11048,6 +11048,7 @@ package android.telephony.data { method public int getMtuV4(); method public int getMtuV6(); method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses(); method public int getPduSessionId(); method public int getProtocolType(); method public long getRetryDurationMillis(); method @Deprecated public int getSuggestedRetryTime(); Loading @@ -11062,6 +11063,7 @@ package android.telephony.data { field public static final int LINK_STATUS_DORMANT = 1; // 0x1 field public static final int LINK_STATUS_INACTIVE = 0; // 0x0 field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff field public static final int PDU_SESSION_ID_NOT_SET = 0; // 0x0 field public static final int RETRY_DURATION_UNDEFINED = -1; // 0xffffffff } Loading @@ -11080,6 +11082,7 @@ package android.telephony.data { method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV4(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV6(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setPcscfAddresses(@NonNull java.util.List<java.net.InetAddress>); method @NonNull public android.telephony.data.DataCallResponse.Builder setPduSessionId(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setProtocolType(int); method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryDurationMillis(long); method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int); Loading Loading @@ -11144,6 +11147,7 @@ package android.telephony.data { public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable { ctor public DataService.DataServiceProvider(int); method public void cancelHandover(int, @NonNull android.telephony.data.DataServiceCallback); method public abstract void close(); method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback); method public final int getSlotIndex(); Loading @@ -11152,11 +11156,15 @@ package android.telephony.data { method public void setDataProfile(@NonNull java.util.List<android.telephony.data.DataProfile>, boolean, @NonNull android.telephony.data.DataServiceCallback); method public void setInitialAttachApn(@NonNull android.telephony.data.DataProfile, boolean, @NonNull android.telephony.data.DataServiceCallback); method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @NonNull android.telephony.data.DataServiceCallback); method public void setupDataCall(int, @NonNull android.telephony.data.DataProfile, boolean, boolean, int, @Nullable android.net.LinkProperties, @IntRange(from=0, to=15) int, @NonNull android.telephony.data.DataServiceCallback); method public void startHandover(int, @NonNull android.telephony.data.DataServiceCallback); } public class DataServiceCallback { method public void onDataCallListChanged(@NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onDeactivateDataCallComplete(int); method public void onHandoverCancelled(int); method public void onHandoverStarted(int); method public void onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>); method public void onSetDataProfileComplete(int); method public void onSetInitialAttachApnComplete(int);
telephony/java/android/telephony/data/DataCallResponse.java +36 −4 Original line number Diff line number Diff line Loading @@ -115,6 +115,11 @@ public final class DataCallResponse implements Parcelable { */ public static final int RETRY_DURATION_UNDEFINED = -1; /** * Indicates that the pdu session id is not set. */ public static final int PDU_SESSION_ID_NOT_SET = 0; private final @DataFailureCause int mCause; private final long mSuggestedRetryTime; private final int mId; Loading @@ -129,6 +134,7 @@ public final class DataCallResponse implements Parcelable { private final int mMtuV4; private final int mMtuV6; private final @HandoverFailureMode int mHandoverFailureMode; private final int mPduSessionId; /** * @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error. Loading Loading @@ -176,6 +182,7 @@ public final class DataCallResponse implements Parcelable { ? new ArrayList<>() : new ArrayList<>(pcscfAddresses); mMtu = mMtuV4 = mMtuV6 = mtu; mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY; mPduSessionId = PDU_SESSION_ID_NOT_SET; } private DataCallResponse(@DataFailureCause int cause, long suggestedRetryTime, int id, Loading @@ -183,7 +190,7 @@ public final class DataCallResponse implements Parcelable { @Nullable String interfaceName, @Nullable List<LinkAddress> addresses, @Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses, @Nullable List<InetAddress> pcscfAddresses, int mtu, int mtuV4, int mtuV6, @HandoverFailureMode int handoverFailureMode) { @HandoverFailureMode int handoverFailureMode, int pduSessionId) { mCause = cause; mSuggestedRetryTime = suggestedRetryTime; mId = id; Loading @@ -202,6 +209,7 @@ public final class DataCallResponse implements Parcelable { mMtuV4 = mtuV4; mMtuV6 = mtuV6; mHandoverFailureMode = handoverFailureMode; mPduSessionId = pduSessionId; } /** @hide */ Loading @@ -225,6 +233,7 @@ public final class DataCallResponse implements Parcelable { mMtuV4 = source.readInt(); mMtuV6 = source.readInt(); mHandoverFailureMode = source.readInt(); mPduSessionId = source.readInt(); } /** Loading Loading @@ -341,6 +350,13 @@ public final class DataCallResponse implements Parcelable { return mHandoverFailureMode; } /** * @return The pdu session id */ public int getPduSessionId() { return mPduSessionId; } @NonNull @Override public String toString() { Loading @@ -360,6 +376,7 @@ public final class DataCallResponse implements Parcelable { .append(" mtuV4=").append(getMtuV4()) .append(" mtuV6=").append(getMtuV6()) .append(" handoverFailureMode=").append(getHandoverFailureMode()) .append(" pduSessionId=").append(getPduSessionId()) .append("}"); return sb.toString(); } Loading Loading @@ -390,14 +407,15 @@ public final class DataCallResponse implements Parcelable { && mMtu == other.mMtu && mMtuV4 == other.mMtuV4 && mMtuV6 == other.mMtuV6 && mHandoverFailureMode == other.mHandoverFailureMode; && mHandoverFailureMode == other.mHandoverFailureMode && mPduSessionId == other.mPduSessionId; } @Override public int hashCode() { return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode); mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId); } @Override Loading @@ -421,6 +439,7 @@ public final class DataCallResponse implements Parcelable { dest.writeInt(mMtuV4); dest.writeInt(mMtuV6); dest.writeInt(mHandoverFailureMode); dest.writeInt(mPduSessionId); } public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR = Loading Loading @@ -498,6 +517,8 @@ public final class DataCallResponse implements Parcelable { private @HandoverFailureMode int mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY; private int mPduSessionId = PDU_SESSION_ID_NOT_SET; /** * Default constructor for Builder. */ Loading Loading @@ -680,6 +701,17 @@ public final class DataCallResponse implements Parcelable { return this; } /** * Set pdu session id. * * @param pduSessionId Pdu Session Id of the data call. * @return The same instance of the builder. */ public @NonNull Builder setPduSessionId(int pduSessionId) { mPduSessionId = pduSessionId; return this; } /** * Build the DataCallResponse. * Loading @@ -688,7 +720,7 @@ public final class DataCallResponse implements Parcelable { public @NonNull DataCallResponse build() { return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode); mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId); } } }
telephony/java/android/telephony/data/DataService.java +140 −11 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.telephony.data; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SdkConstant; Loading @@ -30,7 +31,7 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.telephony.AccessNetworkConstants; import android.util.Log; import android.util.SparseArray; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -104,6 +105,8 @@ public abstract class DataService extends Service { private static final int DATA_SERVICE_REQUEST_REGISTER_DATA_CALL_LIST_CHANGED = 9; private static final int DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED = 10; private static final int DATA_SERVICE_INDICATION_DATA_CALL_LIST_CHANGED = 11; private static final int DATA_SERVICE_REQUEST_START_HANDOVER = 12; private static final int DATA_SERVICE_REQUEST_CANCEL_HANDOVER = 13; private final HandlerThread mHandlerThread; Loading Loading @@ -147,7 +150,7 @@ public abstract class DataService extends Service { * the provided callback to notify the platform. * * @param accessNetworkType Access network type that the data call will be established on. * Must be one of {@link AccessNetworkConstants.AccessNetworkType}. * Must be one of {@link android.telephony.AccessNetworkConstants.AccessNetworkType}. * @param dataProfile Data profile used for data call setup. See {@link DataProfile} * @param isRoaming True if the device is data roaming. * @param allowRoaming True if data roaming is allowed by the user. Loading @@ -159,8 +162,7 @@ public abstract class DataService extends Service { */ public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Loading @@ -169,6 +171,37 @@ public abstract class DataService extends Service { } } /** * Setup a data connection. The data service provider must implement this method to support * establishing a packet data connection. When completed or error, the service must invoke * the provided callback to notify the platform. * * @param accessNetworkType Access network type that the data call will be established on. * Must be one of {@link android.telephony.AccessNetworkConstants.AccessNetworkType}. * @param dataProfile Data profile used for data call setup. See {@link DataProfile} * @param isRoaming True if the device is data roaming. * @param allowRoaming True if data roaming is allowed by the user. * @param reason The reason for data setup. Must be {@link #REQUEST_REASON_NORMAL} or * {@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 pduSessionId The pdu session id to be used for this data call. * The standard range of values are 1-15 while 0 means no pdu session id * was attached to this call. Reference: 3GPP TS 24.007 section * 11.2.3.1b. * @param callback The result callback for this request. */ public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, @SetupDataReason int reason, @Nullable LinkProperties linkProperties, @IntRange(from = 0, to = 15) int pduSessionId, @NonNull DataServiceCallback callback) { /* Call the old version since the new version isn't supported */ setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming, reason, linkProperties, callback); } /** * Deactivate a data connection. The data service provider must implement this method to * support data connection tear down. When completed or error, the service must invoke the Loading Loading @@ -223,6 +256,53 @@ public abstract class DataService extends Service { } } /** * Indicates that a handover has begun. This is called on the source transport. * * Any resources being transferred cannot be released while a * handover is underway. * * If a handover was unsuccessful, then the framework calls * {@link DataService#cancelHandover}. The target transport retains ownership over any of * the resources being transferred. * * If a handover was successful, the framework calls {@link DataService#deactivateDataCall} * with reason {@link DataService.REQUEST_REASON_HANDOVER}. The target transport now owns * the transferred resources and is responsible for releasing them. * * @param cid The identifier of the data call which is provided in {@link DataCallResponse} * @param callback The result callback for this request. */ public void startHandover(int cid, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Log.d(TAG, "startHandover: " + cid); callback.onHandoverStarted(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } else { Log.e(TAG, "startHandover: " + cid + ", callback is null"); } } /** * Indicates that a handover was cancelled after a call to * {@link DataService#startHandover}. This is called on the source transport. * * Since the handover was unsuccessful, the source transport retains ownership over any of * the resources being transferred and is still responsible for releasing them. * * @param cid The identifier of the data call which is provided in {@link DataCallResponse} * @param callback The result callback for this request. */ public void cancelHandover(int cid, @NonNull DataServiceCallback callback) { // The default implementation is to return unsupported. if (callback != null) { Log.d(TAG, "cancelHandover: " + cid); callback.onHandoverCancelled(DataServiceCallback.RESULT_ERROR_UNSUPPORTED); } else { Log.e(TAG, "cancelHandover: " + cid + ", callback is null"); } } /** * Get the active data call list. * Loading Loading @@ -278,16 +358,18 @@ public abstract class DataService extends Service { public final boolean allowRoaming; public final int reason; public final LinkProperties linkProperties; public final int pduSessionId; public final IDataServiceCallback callback; SetupDataCallRequest(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, IDataServiceCallback callback) { int pduSessionId, IDataServiceCallback callback) { this.accessNetworkType = accessNetworkType; this.dataProfile = dataProfile; this.isRoaming = isRoaming; this.allowRoaming = allowRoaming; this.linkProperties = linkProperties; this.reason = reason; this.pduSessionId = pduSessionId; this.callback = callback; } } Loading Loading @@ -327,6 +409,16 @@ public abstract class DataService extends Service { } } private static final class BeginCancelHandoverRequest { public final int cid; public final IDataServiceCallback callback; BeginCancelHandoverRequest(int cid, IDataServiceCallback callback) { this.cid = cid; this.callback = callback; } } private static final class DataCallListChangedIndication { public final List<DataCallResponse> dataCallList; public final IDataServiceCallback callback; Loading Loading @@ -377,7 +469,7 @@ public abstract class DataService extends Service { serviceProvider.setupDataCall(setupDataCallRequest.accessNetworkType, setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming, setupDataCallRequest.allowRoaming, setupDataCallRequest.reason, setupDataCallRequest.linkProperties, setupDataCallRequest.linkProperties, setupDataCallRequest.pduSessionId, (setupDataCallRequest.callback != null) ? new DataServiceCallback(setupDataCallRequest.callback) : null); Loading Loading @@ -438,6 +530,20 @@ public abstract class DataService extends Service { loge("Failed to call onDataCallListChanged. " + e); } break; case DATA_SERVICE_REQUEST_START_HANDOVER: if (serviceProvider == null) break; BeginCancelHandoverRequest bReq = (BeginCancelHandoverRequest) message.obj; serviceProvider.startHandover(bReq.cid, (bReq.callback != null) ? new DataServiceCallback(bReq.callback) : null); break; case DATA_SERVICE_REQUEST_CANCEL_HANDOVER: if (serviceProvider == null) break; BeginCancelHandoverRequest cReq = (BeginCancelHandoverRequest) message.obj; serviceProvider.cancelHandover(cReq.cid, (cReq.callback != null) ? new DataServiceCallback(cReq.callback) : null); break; } } } Loading Loading @@ -507,10 +613,10 @@ public abstract class DataService extends Service { @Override public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, IDataServiceCallback callback) { LinkProperties linkProperties, int pduSessionId, IDataServiceCallback callback) { mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0, new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming, allowRoaming, reason, linkProperties, callback)) allowRoaming, reason, linkProperties, pduSessionId, callback)) .sendToTarget(); } Loading Loading @@ -566,6 +672,29 @@ public abstract class DataService extends Service { mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED, slotIndex, 0, callback).sendToTarget(); } @Override public void startHandover(int slotIndex, int cid, IDataServiceCallback callback) { if (callback == null) { loge("startHandover: callback is null"); return; } BeginCancelHandoverRequest req = new BeginCancelHandoverRequest(cid, callback); mHandler.obtainMessage(DATA_SERVICE_REQUEST_START_HANDOVER, slotIndex, 0, req) .sendToTarget(); } @Override public void cancelHandover(int slotIndex, int cid, IDataServiceCallback callback) { if (callback == null) { loge("cancelHandover: callback is null"); return; } BeginCancelHandoverRequest req = new BeginCancelHandoverRequest(cid, callback); mHandler.obtainMessage(DATA_SERVICE_REQUEST_CANCEL_HANDOVER, slotIndex, 0, req).sendToTarget(); } } private void log(String s) { Loading
telephony/java/android/telephony/data/DataServiceCallback.java +64 −2 Original line number Diff line number Diff line Loading @@ -186,4 +186,66 @@ public class DataServiceCallback { Rlog.e(TAG, "onDataCallListChanged: callback is null!"); } } /** * Called to indicate result for the request {@link DataService#startHandover}. * * @param result The result code. Must be one of the {@link ResultCode} */ public void onHandoverStarted(@ResultCode int result) { if (mCallback != null) { try { if (DBG) Rlog.d(TAG, "onHandoverStarted"); mCallback.onHandoverStarted(result); } catch (RemoteException e) { Rlog.e(TAG, "Failed to onHandoverStarted on the remote"); } } else { Rlog.e(TAG, "onHandoverStarted: callback is null!"); } } /** * Called to indicate result for the request {@link DataService#cancelHandover}. * * @param result The result code. Must be one of the {@link ResultCode} */ public void onHandoverCancelled(@ResultCode int result) { if (mCallback != null) { try { if (DBG) Rlog.d(TAG, "onHandoverCancelled"); mCallback.onHandoverCancelled(result); } catch (RemoteException e) { Rlog.e(TAG, "Failed to onHandoverCancelled on the remote"); } } else { Rlog.e(TAG, "onHandoverCancelled: callback is null!"); } } /** * Get the result code as a string * * @param resultCode The result code. Must be one of the {@link ResultCode} * @return the string representation * * @hide */ @NonNull public static String resultCodeToString(@DataServiceCallback.ResultCode int resultCode) { switch(resultCode) { case RESULT_SUCCESS: return "RESULT_SUCCESS"; case RESULT_ERROR_UNSUPPORTED: return "RESULT_ERROR_UNSUPPORTED"; case RESULT_ERROR_INVALID_ARG: return "RESULT_ERROR_INVALID_ARG"; case RESULT_ERROR_BUSY: return "RESULT_ERROR_BUSY"; case RESULT_ERROR_ILLEGAL_STATE: return "RESULT_ERROR_ILLEGAL_STATE"; default: return "Missing case for result code=" + resultCode; } } }
telephony/java/android/telephony/data/IDataService.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ oneway interface IDataService void removeDataServiceProvider(int slotId); void setupDataCall(int slotId, int accessNetwork, in DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, in LinkProperties linkProperties, IDataServiceCallback callback); int pduSessionId, IDataServiceCallback callback); void deactivateDataCall(int slotId, int cid, int reason, IDataServiceCallback callback); void setInitialAttachApn(int slotId, in DataProfile dataProfile, boolean isRoaming, IDataServiceCallback callback); Loading @@ -38,4 +38,6 @@ oneway interface IDataService void requestDataCallList(int slotId, IDataServiceCallback callback); void registerForDataCallListChanged(int slotId, IDataServiceCallback callback); void unregisterForDataCallListChanged(int slotId, IDataServiceCallback callback); void startHandover(int slotId, int cid, IDataServiceCallback callback); void cancelHandover(int slotId, int cid, IDataServiceCallback callback); }