Add support for pdu session id
Added startHandover and cancelHandover to DataService and DataServiceManager so that it can be called by data connection Test: Tested that handover still worked with logs. IWlan -> Cell + Cell -> IWlan Bug: 155176305 Change-Id: Ia59d7e9bf9a450da4b51a2884166d3b0fa93a7c9
This commit is contained in:
@@ -11043,6 +11043,7 @@ package android.telephony.data {
|
|||||||
method public int getMtuV4();
|
method public int getMtuV4();
|
||||||
method public int getMtuV6();
|
method public int getMtuV6();
|
||||||
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
|
method @NonNull public java.util.List<java.net.InetAddress> getPcscfAddresses();
|
||||||
|
method public int getPduSessionId();
|
||||||
method public int getProtocolType();
|
method public int getProtocolType();
|
||||||
method public long getRetryDurationMillis();
|
method public long getRetryDurationMillis();
|
||||||
method @Deprecated public int getSuggestedRetryTime();
|
method @Deprecated public int getSuggestedRetryTime();
|
||||||
@@ -11057,6 +11058,7 @@ package android.telephony.data {
|
|||||||
field public static final int LINK_STATUS_DORMANT = 1; // 0x1
|
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_INACTIVE = 0; // 0x0
|
||||||
field public static final int LINK_STATUS_UNKNOWN = -1; // 0xffffffff
|
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
|
field public static final int RETRY_DURATION_UNDEFINED = -1; // 0xffffffff
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11075,6 +11077,7 @@ package android.telephony.data {
|
|||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setMtuV4(int);
|
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 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 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 setProtocolType(int);
|
||||||
method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryDurationMillis(long);
|
method @NonNull public android.telephony.data.DataCallResponse.Builder setRetryDurationMillis(long);
|
||||||
method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
|
method @Deprecated @NonNull public android.telephony.data.DataCallResponse.Builder setSuggestedRetryTime(int);
|
||||||
@@ -11139,6 +11142,7 @@ package android.telephony.data {
|
|||||||
|
|
||||||
public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable {
|
public abstract class DataService.DataServiceProvider implements java.lang.AutoCloseable {
|
||||||
ctor public DataService.DataServiceProvider(int);
|
ctor public DataService.DataServiceProvider(int);
|
||||||
|
method public void cancelHandover(int, @NonNull android.telephony.data.DataServiceCallback);
|
||||||
method public abstract void close();
|
method public abstract void close();
|
||||||
method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback);
|
method public void deactivateDataCall(int, int, @Nullable android.telephony.data.DataServiceCallback);
|
||||||
method public final int getSlotIndex();
|
method public final int getSlotIndex();
|
||||||
@@ -11147,11 +11151,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 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 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, @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 {
|
public class DataServiceCallback {
|
||||||
method public void onDataCallListChanged(@NonNull 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 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 onRequestDataCallListComplete(int, @NonNull java.util.List<android.telephony.data.DataCallResponse>);
|
||||||
method public void onSetDataProfileComplete(int);
|
method public void onSetDataProfileComplete(int);
|
||||||
method public void onSetInitialAttachApnComplete(int);
|
method public void onSetInitialAttachApnComplete(int);
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final int RETRY_DURATION_UNDEFINED = -1;
|
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 @DataFailureCause int mCause;
|
||||||
private final long mSuggestedRetryTime;
|
private final long mSuggestedRetryTime;
|
||||||
private final int mId;
|
private final int mId;
|
||||||
@@ -129,6 +134,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
private final int mMtuV4;
|
private final int mMtuV4;
|
||||||
private final int mMtuV6;
|
private final int mMtuV6;
|
||||||
private final @HandoverFailureMode int mHandoverFailureMode;
|
private final @HandoverFailureMode int mHandoverFailureMode;
|
||||||
|
private final int mPduSessionId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
|
* @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
|
||||||
@@ -176,6 +182,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
|
? new ArrayList<>() : new ArrayList<>(pcscfAddresses);
|
||||||
mMtu = mMtuV4 = mMtuV6 = mtu;
|
mMtu = mMtuV4 = mMtuV6 = mtu;
|
||||||
mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY;
|
mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY;
|
||||||
|
mPduSessionId = PDU_SESSION_ID_NOT_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataCallResponse(@DataFailureCause int cause, long suggestedRetryTime, int id,
|
private DataCallResponse(@DataFailureCause int cause, long suggestedRetryTime, int id,
|
||||||
@@ -183,7 +190,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
@Nullable String interfaceName, @Nullable List<LinkAddress> addresses,
|
@Nullable String interfaceName, @Nullable List<LinkAddress> addresses,
|
||||||
@Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses,
|
@Nullable List<InetAddress> dnsAddresses, @Nullable List<InetAddress> gatewayAddresses,
|
||||||
@Nullable List<InetAddress> pcscfAddresses, int mtu, int mtuV4, int mtuV6,
|
@Nullable List<InetAddress> pcscfAddresses, int mtu, int mtuV4, int mtuV6,
|
||||||
@HandoverFailureMode int handoverFailureMode) {
|
@HandoverFailureMode int handoverFailureMode, int pduSessionId) {
|
||||||
mCause = cause;
|
mCause = cause;
|
||||||
mSuggestedRetryTime = suggestedRetryTime;
|
mSuggestedRetryTime = suggestedRetryTime;
|
||||||
mId = id;
|
mId = id;
|
||||||
@@ -202,6 +209,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
mMtuV4 = mtuV4;
|
mMtuV4 = mtuV4;
|
||||||
mMtuV6 = mtuV6;
|
mMtuV6 = mtuV6;
|
||||||
mHandoverFailureMode = handoverFailureMode;
|
mHandoverFailureMode = handoverFailureMode;
|
||||||
|
mPduSessionId = pduSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -225,6 +233,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
mMtuV4 = source.readInt();
|
mMtuV4 = source.readInt();
|
||||||
mMtuV6 = source.readInt();
|
mMtuV6 = source.readInt();
|
||||||
mHandoverFailureMode = source.readInt();
|
mHandoverFailureMode = source.readInt();
|
||||||
|
mPduSessionId = source.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,6 +350,13 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
return mHandoverFailureMode;
|
return mHandoverFailureMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The pdu session id
|
||||||
|
*/
|
||||||
|
public int getPduSessionId() {
|
||||||
|
return mPduSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -360,6 +376,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
.append(" mtuV4=").append(getMtuV4())
|
.append(" mtuV4=").append(getMtuV4())
|
||||||
.append(" mtuV6=").append(getMtuV6())
|
.append(" mtuV6=").append(getMtuV6())
|
||||||
.append(" handoverFailureMode=").append(getHandoverFailureMode())
|
.append(" handoverFailureMode=").append(getHandoverFailureMode())
|
||||||
|
.append(" pduSessionId=").append(getPduSessionId())
|
||||||
.append("}");
|
.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
@@ -390,14 +407,15 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
&& mMtu == other.mMtu
|
&& mMtu == other.mMtu
|
||||||
&& mMtuV4 == other.mMtuV4
|
&& mMtuV4 == other.mMtuV4
|
||||||
&& mMtuV6 == other.mMtuV6
|
&& mMtuV6 == other.mMtuV6
|
||||||
&& mHandoverFailureMode == other.mHandoverFailureMode;
|
&& mHandoverFailureMode == other.mHandoverFailureMode
|
||||||
|
&& mPduSessionId == other.mPduSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
|
return Objects.hash(mCause, mSuggestedRetryTime, mId, mLinkStatus, mProtocolType,
|
||||||
mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
|
mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses, mPcscfAddresses,
|
||||||
mMtu, mMtuV4, mMtuV6, mHandoverFailureMode);
|
mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -421,6 +439,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
dest.writeInt(mMtuV4);
|
dest.writeInt(mMtuV4);
|
||||||
dest.writeInt(mMtuV6);
|
dest.writeInt(mMtuV6);
|
||||||
dest.writeInt(mHandoverFailureMode);
|
dest.writeInt(mHandoverFailureMode);
|
||||||
|
dest.writeInt(mPduSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR =
|
public static final @android.annotation.NonNull Parcelable.Creator<DataCallResponse> CREATOR =
|
||||||
@@ -498,6 +517,8 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
|
|
||||||
private @HandoverFailureMode int mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY;
|
private @HandoverFailureMode int mHandoverFailureMode = HANDOVER_FAILURE_MODE_LEGACY;
|
||||||
|
|
||||||
|
private int mPduSessionId = PDU_SESSION_ID_NOT_SET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for Builder.
|
* Default constructor for Builder.
|
||||||
*/
|
*/
|
||||||
@@ -680,6 +701,17 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
return this;
|
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.
|
* Build the DataCallResponse.
|
||||||
*
|
*
|
||||||
@@ -688,7 +720,7 @@ public final class DataCallResponse implements Parcelable {
|
|||||||
public @NonNull DataCallResponse build() {
|
public @NonNull DataCallResponse build() {
|
||||||
return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
|
return new DataCallResponse(mCause, mSuggestedRetryTime, mId, mLinkStatus,
|
||||||
mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
|
mProtocolType, mInterfaceName, mAddresses, mDnsAddresses, mGatewayAddresses,
|
||||||
mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode);
|
mPcscfAddresses, mMtu, mMtuV4, mMtuV6, mHandoverFailureMode, mPduSessionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.telephony.data;
|
package android.telephony.data;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
|
import android.annotation.IntRange;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SdkConstant;
|
import android.annotation.SdkConstant;
|
||||||
@@ -30,7 +31,7 @@ import android.os.IBinder;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.telephony.AccessNetworkConstants;
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
@@ -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_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_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_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;
|
private final HandlerThread mHandlerThread;
|
||||||
|
|
||||||
@@ -147,7 +150,7 @@ public abstract class DataService extends Service {
|
|||||||
* the provided callback to notify the platform.
|
* the provided callback to notify the platform.
|
||||||
*
|
*
|
||||||
* @param accessNetworkType Access network type that the data call will be established on.
|
* @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 dataProfile Data profile used for data call setup. See {@link DataProfile}
|
||||||
* @param isRoaming True if the device is data roaming.
|
* @param isRoaming True if the device is data roaming.
|
||||||
* @param allowRoaming True if data roaming is allowed by the user.
|
* @param allowRoaming True if data roaming is allowed by the user.
|
||||||
@@ -158,10 +161,9 @@ public abstract class DataService extends Service {
|
|||||||
* @param callback The result callback for this request.
|
* @param callback The result callback for this request.
|
||||||
*/
|
*/
|
||||||
public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
|
public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
|
||||||
boolean isRoaming, boolean allowRoaming,
|
boolean isRoaming, boolean allowRoaming,
|
||||||
@SetupDataReason int reason,
|
@SetupDataReason int reason, @Nullable LinkProperties linkProperties,
|
||||||
@Nullable LinkProperties linkProperties,
|
@NonNull DataServiceCallback callback) {
|
||||||
@NonNull DataServiceCallback callback) {
|
|
||||||
// The default implementation is to return unsupported.
|
// The default implementation is to return unsupported.
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onSetupDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED,
|
callback.onSetupDataCallComplete(DataServiceCallback.RESULT_ERROR_UNSUPPORTED,
|
||||||
@@ -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
|
* 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
|
* support data connection tear down. When completed or error, the service must invoke the
|
||||||
@@ -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.
|
* Get the active data call list.
|
||||||
*
|
*
|
||||||
@@ -278,16 +358,18 @@ public abstract class DataService extends Service {
|
|||||||
public final boolean allowRoaming;
|
public final boolean allowRoaming;
|
||||||
public final int reason;
|
public final int reason;
|
||||||
public final LinkProperties linkProperties;
|
public final LinkProperties linkProperties;
|
||||||
|
public final int pduSessionId;
|
||||||
public final IDataServiceCallback callback;
|
public final IDataServiceCallback callback;
|
||||||
SetupDataCallRequest(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
|
SetupDataCallRequest(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
|
||||||
boolean allowRoaming, int reason, LinkProperties linkProperties,
|
boolean allowRoaming, int reason, LinkProperties linkProperties,
|
||||||
IDataServiceCallback callback) {
|
int pduSessionId, IDataServiceCallback callback) {
|
||||||
this.accessNetworkType = accessNetworkType;
|
this.accessNetworkType = accessNetworkType;
|
||||||
this.dataProfile = dataProfile;
|
this.dataProfile = dataProfile;
|
||||||
this.isRoaming = isRoaming;
|
this.isRoaming = isRoaming;
|
||||||
this.allowRoaming = allowRoaming;
|
this.allowRoaming = allowRoaming;
|
||||||
this.linkProperties = linkProperties;
|
this.linkProperties = linkProperties;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
|
this.pduSessionId = pduSessionId;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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 {
|
private static final class DataCallListChangedIndication {
|
||||||
public final List<DataCallResponse> dataCallList;
|
public final List<DataCallResponse> dataCallList;
|
||||||
public final IDataServiceCallback callback;
|
public final IDataServiceCallback callback;
|
||||||
@@ -377,7 +469,7 @@ public abstract class DataService extends Service {
|
|||||||
serviceProvider.setupDataCall(setupDataCallRequest.accessNetworkType,
|
serviceProvider.setupDataCall(setupDataCallRequest.accessNetworkType,
|
||||||
setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming,
|
setupDataCallRequest.dataProfile, setupDataCallRequest.isRoaming,
|
||||||
setupDataCallRequest.allowRoaming, setupDataCallRequest.reason,
|
setupDataCallRequest.allowRoaming, setupDataCallRequest.reason,
|
||||||
setupDataCallRequest.linkProperties,
|
setupDataCallRequest.linkProperties, setupDataCallRequest.pduSessionId,
|
||||||
(setupDataCallRequest.callback != null)
|
(setupDataCallRequest.callback != null)
|
||||||
? new DataServiceCallback(setupDataCallRequest.callback)
|
? new DataServiceCallback(setupDataCallRequest.callback)
|
||||||
: null);
|
: null);
|
||||||
@@ -438,6 +530,20 @@ public abstract class DataService extends Service {
|
|||||||
loge("Failed to call onDataCallListChanged. " + e);
|
loge("Failed to call onDataCallListChanged. " + e);
|
||||||
}
|
}
|
||||||
break;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -506,11 +612,11 @@ public abstract class DataService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile,
|
public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile,
|
||||||
boolean isRoaming, boolean allowRoaming, int reason,
|
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,
|
mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0,
|
||||||
new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming,
|
new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming,
|
||||||
allowRoaming, reason, linkProperties, callback))
|
allowRoaming, reason, linkProperties, pduSessionId, callback))
|
||||||
.sendToTarget();
|
.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,6 +672,29 @@ public abstract class DataService extends Service {
|
|||||||
mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED,
|
mHandler.obtainMessage(DATA_SERVICE_REQUEST_UNREGISTER_DATA_CALL_LIST_CHANGED,
|
||||||
slotIndex, 0, callback).sendToTarget();
|
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) {
|
private void log(String s) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class DataServiceCallback {
|
|||||||
* @param response Setup data call response.
|
* @param response Setup data call response.
|
||||||
*/
|
*/
|
||||||
public void onSetupDataCallComplete(@ResultCode int result,
|
public void onSetupDataCallComplete(@ResultCode int result,
|
||||||
@Nullable DataCallResponse response) {
|
@Nullable DataCallResponse response) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
try {
|
try {
|
||||||
if (DBG) Rlog.d(TAG, "onSetupDataCallComplete");
|
if (DBG) Rlog.d(TAG, "onSetupDataCallComplete");
|
||||||
@@ -156,7 +156,7 @@ public class DataServiceCallback {
|
|||||||
* set it to an empty list.
|
* set it to an empty list.
|
||||||
*/
|
*/
|
||||||
public void onRequestDataCallListComplete(@ResultCode int result,
|
public void onRequestDataCallListComplete(@ResultCode int result,
|
||||||
@NonNull List<DataCallResponse> dataCallList) {
|
@NonNull List<DataCallResponse> dataCallList) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
try {
|
try {
|
||||||
mCallback.onRequestDataCallListComplete(result, dataCallList);
|
mCallback.onRequestDataCallListComplete(result, dataCallList);
|
||||||
@@ -186,4 +186,66 @@ public class DataServiceCallback {
|
|||||||
Rlog.e(TAG, "onDataCallListChanged: callback is null!");
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ oneway interface IDataService
|
|||||||
void removeDataServiceProvider(int slotId);
|
void removeDataServiceProvider(int slotId);
|
||||||
void setupDataCall(int slotId, int accessNetwork, in DataProfile dataProfile, boolean isRoaming,
|
void setupDataCall(int slotId, int accessNetwork, in DataProfile dataProfile, boolean isRoaming,
|
||||||
boolean allowRoaming, int reason, in LinkProperties linkProperties,
|
boolean allowRoaming, int reason, in LinkProperties linkProperties,
|
||||||
IDataServiceCallback callback);
|
int pduSessionId, IDataServiceCallback callback);
|
||||||
void deactivateDataCall(int slotId, int cid, int reason, IDataServiceCallback callback);
|
void deactivateDataCall(int slotId, int cid, int reason, IDataServiceCallback callback);
|
||||||
void setInitialAttachApn(int slotId, in DataProfile dataProfile, boolean isRoaming,
|
void setInitialAttachApn(int slotId, in DataProfile dataProfile, boolean isRoaming,
|
||||||
IDataServiceCallback callback);
|
IDataServiceCallback callback);
|
||||||
@@ -38,4 +38,6 @@ oneway interface IDataService
|
|||||||
void requestDataCallList(int slotId, IDataServiceCallback callback);
|
void requestDataCallList(int slotId, IDataServiceCallback callback);
|
||||||
void registerForDataCallListChanged(int slotId, IDataServiceCallback callback);
|
void registerForDataCallListChanged(int slotId, IDataServiceCallback callback);
|
||||||
void unregisterForDataCallListChanged(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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,6 @@ oneway interface IDataServiceCallback
|
|||||||
void onSetDataProfileComplete(int result);
|
void onSetDataProfileComplete(int result);
|
||||||
void onRequestDataCallListComplete(int result, in List<DataCallResponse> dataCallList);
|
void onRequestDataCallListComplete(int result, in List<DataCallResponse> dataCallList);
|
||||||
void onDataCallListChanged(in List<DataCallResponse> dataCallList);
|
void onDataCallListChanged(in List<DataCallResponse> dataCallList);
|
||||||
|
void onHandoverStarted(int result);
|
||||||
|
void onHandoverCancelled(int result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ public interface RILConstants {
|
|||||||
int RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED = 214;
|
int RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED = 214;
|
||||||
int RIL_REQUEST_ALLOCATE_PDU_SESSION_ID = 215;
|
int RIL_REQUEST_ALLOCATE_PDU_SESSION_ID = 215;
|
||||||
int RIL_REQUEST_RELEASE_PDU_SESSION_ID = 216;
|
int RIL_REQUEST_RELEASE_PDU_SESSION_ID = 216;
|
||||||
int RIL_REQUEST_BEGIN_HANDOVER = 217;
|
int RIL_REQUEST_START_HANDOVER = 217;
|
||||||
int RIL_REQUEST_CANCEL_HANDOVER = 218;
|
int RIL_REQUEST_CANCEL_HANDOVER = 218;
|
||||||
|
|
||||||
/* Responses begin */
|
/* Responses begin */
|
||||||
|
|||||||
Reference in New Issue
Block a user