Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ff3f908 authored by Daniel Bright's avatar Daniel Bright
Browse files

Update pdu session and handover docs

* Added range validation and javadoc to setPduSessionId while
  building DataCallResponse
* Updated comments on cancelHandover and startHandover
* Throw exception if callback is null in either startHandover
  or cancelHandover

Bug: 181551555
Test: unit tests
Change-Id: I872a3a9240e6b1224661bae3eb9de4ae60ebed3b
parent a8ef1df9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11919,7 +11919,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 setPduSessionId(@IntRange(from=android.telephony.data.DataCallResponse.PDU_SESSION_ID_NOT_SET, to=15) 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 setSliceInfo(@Nullable android.telephony.data.SliceInfo);
+11 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package android.telephony.data;

import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -29,6 +30,7 @@ import android.telephony.DataFailCause;
import android.telephony.data.ApnSetting.ProtocolType;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.Preconditions;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -812,11 +814,19 @@ public final class DataCallResponse implements Parcelable {

        /**
         * Set pdu session id.
         * <p/>
         * The id must be between 1 and 15 when linked to a pdu session.  If no pdu session
         * exists for the current data call, the id must be set to {@link PDU_SESSION_ID_NOT_SET}.
         *
         * @param pduSessionId Pdu Session Id of the data call.
         * @return The same instance of the builder.
         */
        public @NonNull Builder setPduSessionId(int pduSessionId) {
        public @NonNull Builder setPduSessionId(
                @IntRange(from = PDU_SESSION_ID_NOT_SET, to = 15) int pduSessionId) {
            Preconditions.checkArgument(pduSessionId >= PDU_SESSION_ID_NOT_SET,
                    "pduSessionId must be greater than or equal to" + PDU_SESSION_ID_NOT_SET);
            Preconditions.checkArgument(pduSessionId <= 15,
                    "pduSessionId must be less than or equal to 15.");
            mPduSessionId = pduSessionId;
            return this;
        }
+19 −15
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Base class of data service. Services that extend DataService must register the service in
@@ -284,11 +285,11 @@ public abstract class DataService extends Service {
         *
         * Any resources being transferred cannot be released while a
         * handover is underway.
         *
         * <p/>
         * If a handover was unsuccessful, then the framework calls
         * {@link DataService#cancelHandover}.  The target transport retains ownership over any of
         * the resources being transferred.
         *
         * <p/>
         * 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.
@@ -299,21 +300,27 @@ public abstract class DataService extends Service {
         * @hide
         */
        public void startHandover(int cid, @NonNull DataServiceCallback callback) {
            Objects.requireNonNull(callback, "callback cannot be null");
            // 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.
         *
         * <p/>
         * Since the handover was unsuccessful, the source transport retains ownership over any of
         * the resources being transferred and is still responsible for releasing them.
         * <p/>
         * The handover can be cancelled up until either:
         * <ul><li>
         *     The handover was successful after receiving a successful response from
         *     {@link DataService#setupDataCall} on the target transport.
         * </li><li>
         *     The data call on the source transport was lost.
         * </li>
         * </ul>
         *
         * @param cid The identifier of the data call which is provided in {@link DataCallResponse}
         * @param callback The result callback for this request.
@@ -321,13 +328,10 @@ public abstract class DataService extends Service {
         * @hide
         */
        public void cancelHandover(int cid, @NonNull DataServiceCallback callback) {
            Objects.requireNonNull(callback, "callback cannot be null");
            // 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");
            }
        }

        /**