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

Commit 93a50596 authored by Daniel Bright's avatar Daniel Bright Committed by Android (Google) Code Review
Browse files

Merge changes from topic "iwlan_pdu_session"

* changes:
  Added the allocate pdu session id to data connection
  Added calls to startHandover and cancelHandover
parents 06682d79 fb679e74
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -1831,7 +1831,7 @@ public interface CommandsInterface {
     */
    void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                       boolean allowRoaming, int reason, LinkProperties linkProperties,
                       Message result);
                       int pduSessionId, Message result);

    /**
     * Deactivate packet data connection
@@ -2543,4 +2543,39 @@ public interface CommandsInterface {
     * @param result Message will be sent back to handler and result.obj will be the AsycResult.
     */
    default void getBarringInfo(Message result) {};

    /**
     * Allocates a pdu session id
     *
     * AsyncResult.result is the allocated pdu session id
     *
     * @param result Message will be sent back to handler and result.obj will be the AsycResult.
     *
     */
    default void allocatePduSessionId(Message result) {};

    /**
     * Release the pdu session id
     *
     * @param result Message that will be sent back to handler.
     * @param pduSessionId The id that was allocated and should now be released.
     *
     */
    default void releasePduSessionId(Message result, int pduSessionId) {};

    /**
     * Indicates that a handover has started
     *
     * @param result Message that will be sent back to handler.
     * @param callId Identifier associated with the data call
     */
    default void startHandover(Message result, int callId) {};

    /**
     * Indicates that a handover has been cancelled
     *
     * @param result Message that will be sent back to handler.
     * @param callId Identifier associated with the data call
     */
    default void cancelHandover(Message result, int callId) {};
}
+124 −4
Original line number Diff line number Diff line
@@ -1894,8 +1894,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                              boolean allowRoaming, int reason, LinkProperties linkProperties,
                              Message result) {

                              int pduSessionId, Message result) {
        IRadio radioProxy = getRadioProxy(result);

        if (radioProxy != null) {
@@ -1943,11 +1942,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
                                + ",accessNetworkType="
                                + AccessNetworkType.toString(accessNetworkType) + ",isRoaming="
                                + isRoaming + ",allowRoaming=" + allowRoaming + "," + dataProfile
                                + ",addresses=" + addresses15 + ",dnses=" + dnses);
                                + ",addresses=" + addresses15 + ",dnses=" + dnses
                                + ",pduSessionId=" + pduSessionId);
                    }

                    radioProxy16.setupDataCall_1_6(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                            reason, addresses15, dnses);
                            reason, addresses15, dnses, pduSessionId);
                } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                    // IRadio V1.5
                    android.hardware.radio.V1_5.IRadio radioProxy15 =
@@ -5597,7 +5597,115 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void allocatePduSessionId(Message result) {
        android.hardware.radio.V1_6.IRadio radioProxy16 = getRadioV16(result);

        if (radioProxy16 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_ALLOCATE_PDU_SESSION_ID, result,
                    mRILDefaultWorkSource);
            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            try {
                radioProxy16.allocatePduSessionId(rr.mSerial);
            } catch (RemoteException e) {
                handleRadioProxyExceptionForRR(rr, "allocatePduSessionId", e);
            }
        } else {
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void releasePduSessionId(Message result, int pduSessionId) {
        android.hardware.radio.V1_6.IRadio radioProxy16 = getRadioV16(result);

        if (radioProxy16 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_RELEASE_PDU_SESSION_ID, result,
                    mRILDefaultWorkSource);
            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            try {
                radioProxy16.releasePduSessionId(rr.mSerial, pduSessionId);
            } catch (RemoteException e) {
                handleRadioProxyExceptionForRR(rr, "releasePduSessionId", e);
            }
        } else {
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void startHandover(Message result, int callId) {
        android.hardware.radio.V1_6.IRadio radioProxy16 = getRadioV16(result);

        if (radioProxy16 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_START_HANDOVER, result,
                    mRILDefaultWorkSource);
            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            try {
                radioProxy16.startHandover(rr.mSerial, callId);
            } catch (RemoteException e) {
                handleRadioProxyExceptionForRR(rr, "startHandover", e);
            }
        } else {
            if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "startHandover: REQUEST_NOT_SUPPORTED");
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void cancelHandover(Message result, int callId) {
        android.hardware.radio.V1_6.IRadio radioProxy16 = getRadioV16(result);

        if (radioProxy16 != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_CANCEL_HANDOVER, result,
                    mRILDefaultWorkSource);
            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            try {
                radioProxy16.cancelHandover(rr.mSerial, callId);
            } catch (RemoteException e) {
                handleRadioProxyExceptionForRR(rr, "cancelHandover", e);
            }
        } else {
            if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "cancelHandover: REQUEST_NOT_SUPPORTED");
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    //***** Private Methods
    /** Helper that gets V1.6 of the radio interface OR sends back REQUEST_NOT_SUPPORTED */
    @Nullable private android.hardware.radio.V1_6.IRadio getRadioV16(Message msg) {
        IRadio radioProxy = getRadioProxy(msg);
        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
            return (android.hardware.radio.V1_6.IRadio) radioProxy;
        } else {
            return (android.hardware.radio.V1_6.IRadio) null;
        }
    }


    /**
     * This is a helper function to be called when a RadioIndication callback is called.
@@ -6550,6 +6658,14 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_ENABLE_NR_DUAL_CONNECTIVITY";
            case RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED:
                return "RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED";
            case RIL_REQUEST_ALLOCATE_PDU_SESSION_ID:
                return "RIL_REQUEST_ALLOCATE_PDU_SESSION_ID";
            case RIL_REQUEST_RELEASE_PDU_SESSION_ID:
                return "RIL_REQUEST_RELEASE_PDU_SESSION_ID";
            case RIL_REQUEST_START_HANDOVER:
                return "RIL_REQUEST_START_HANDOVER";
            case RIL_REQUEST_CANCEL_HANDOVER:
                return "RIL_REQUEST_CANCEL_HANDOVER";
            default: return "<unknown request>";
        }
    }
@@ -7050,6 +7166,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
        @HandoverFailureMode
        int handoverFailureMode = DataCallResponse.HANDOVER_FAILURE_MODE_LEGACY;

        int pduSessionId = DataCallResponse.PDU_SESSION_ID_NOT_SET;

        List<LinkAddress> laList = new ArrayList<>();

        if (dcResult instanceof android.hardware.radio.V1_0.SetupDataCallResult) {
@@ -7137,6 +7255,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            mtuV4 = result.mtuV4;
            mtuV6 = result.mtuV6;
            handoverFailureMode = result.handoverFailureMode;
            pduSessionId = result.pduSessionId;
        } else {
            Rlog.e(RILJ_LOG_TAG, "Unsupported SetupDataCallResult " + dcResult);
            return null;
@@ -7202,6 +7321,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                .setMtuV4(mtuV4)
                .setMtuV6(mtuV6)
                .setHandoverFailureMode(handoverFailureMode)
                .setPduSessionId(pduSessionId)
                .build();
    }

+164 −144
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.hardware.radio.V1_0.VoiceRegStateResult;
import android.hardware.radio.V1_4.CarrierRestrictionsWithPriority;
import android.hardware.radio.V1_4.SimLockMultiSimPolicy;
import android.hardware.radio.V1_6.IRadioResponse;
import android.hardware.radio.V1_6.SetupDataCallResult;
import android.os.AsyncResult;
import android.os.Message;
import android.os.SystemClock;
@@ -559,6 +560,37 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseSetupDataCall(responseInfo, setupDataCallResult);
    }


    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param setupDataCallResult Response to data call setup as defined by setupDataCallResult in
     *                            1.6/types.hal
     */
    public void setupDataCallResponse_1_6(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo,
            android.hardware.radio.V1_6.SetupDataCallResult setupDataCallResult) {
        responseSetupDataCall_1_6(responseInfo, setupDataCallResult);
    }

    @Override
    public void getDataCallListResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info,
            ArrayList<SetupDataCallResult> dcResponse) {
        responseDataCallList(info, dcResponse);
    }

    @Override
    public void setSimCardPowerResponse_1_6(android.hardware.radio.V1_6.RadioResponseInfo info) {
        /* This method was missing a response, will let the owner know */
        responseVoid_1_6(info);
    }

    @Override
    public void setAllowedNetworkTypeBitmapResponse(
            android.hardware.radio.V1_6.RadioResponseInfo info) {
        /* This method was missing a response, will let the owner know */
        responseVoid_1_6(info);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param iccIo ICC io operation response as defined by IccIoResult in types.hal
@@ -1578,87 +1610,11 @@ public class RadioResponse extends IRadioResponse.Stub {

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param info Response info struct containing response type, serial no. and error
     */
    public void setNrDualConnectivityStateResponse(
            android.hardware.radio.V1_6.RadioResponseInfo  responseInfo) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param dcResponse SetupDataCallResult
     */
    public void setupDataCallResponse_1_6(
            android.hardware.radio.V1_6.RadioResponseInfo  responseInfo,
            android.hardware.radio.V1_6.SetupDataCallResult dcResponse) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param dcResponse List of SetupDataCallResult
     */
    public void getDataCallListResponse_1_6(
            android.hardware.radio.V1_6.RadioResponseInfo  responseInfo,
            ArrayList<android.hardware.radio.V1_6.SetupDataCallResult> dcResponse) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param id The allocated id. On an error, this is set to -1     */
    public void allocatePduSessionIdResponse(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo, int id) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void releasePduSessionIdResponse(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void beginHandoverResponse(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void cancelHandoverResponse(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setAllowedNetworkTypeBitmapResponse(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo) {
        responseVoid_1_6(responseInfo);
    }

    /**
     *
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setSimCardPowerResponse_1_6(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo) {
        responseVoid_1_6(responseInfo);
            android.hardware.radio.V1_6.RadioResponseInfo info) {
        responseVoid_1_6(info);
    }

    /**
@@ -2367,6 +2323,20 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    private void responseSetupDataCall_1_6(
            android.hardware.radio.V1_6.RadioResponseInfo responseInfo,
            Object setupDataCallResult) {
        RILRequest rr = mRil.processResponse_1_6(responseInfo);

        if (rr != null) {
            DataCallResponse response = RIL.convertDataCallResult(setupDataCallResult);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone_1_6(rr, responseInfo, response);
        }
    }

    private void responseIccIo(RadioResponseInfo responseInfo,
            android.hardware.radio.V1_0.IccIoResult result) {
        RILRequest rr = mRil.processResponse(responseInfo);
@@ -2482,6 +2452,20 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    private void responseDataCallList(android.hardware.radio.V1_6.RadioResponseInfo responseInfo,
            List<? extends Object> dataCallResultList) {
        RILRequest rr = mRil.processResponse_1_6(responseInfo);

        if (rr != null) {
            ArrayList<DataCallResponse> response =
                    RIL.convertDataCallResultList(dataCallResultList);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone_1_6(rr, responseInfo, response);
        }
    }

    private void responseCellList(RadioResponseInfo responseInfo,
            ArrayList<NeighboringCell> cells) {
        RILRequest rr = mRil.processResponse(responseInfo);
@@ -2867,4 +2851,40 @@ public class RadioResponse extends IRadioResponse.Stub {
            mRil.processResponseDone(rr, responseInfo, bi);
        }
    }

    /**
     * @param info Response info struct containing response type, serial no. and error
     * @param id The pdu session id allocated
     */
    public void allocatePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info,
            int id) {
        RILRequest rr = mRil.processResponse_1_6(info);
        if (rr != null) {
            if (info.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, id);
            }
            mRil.processResponseDone_1_6(rr, info, id);
        }
    }

    /**
     * @param info Response info struct containing response type, serial no. and error
     */
    public void releasePduSessionIdResponse(android.hardware.radio.V1_6.RadioResponseInfo info) {
        responseVoid_1_6(info);
    }

    /**
     * @param info Response info struct containing response type, serial no. and error
     */
    public void startHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info) {
        responseVoid_1_6(info);
    }

    /**
     * @param info Response info struct containing response type, serial no. and error
     */
    public void cancelHandoverResponse(android.hardware.radio.V1_6.RadioResponseInfo info) {
        responseVoid_1_6(info);
    }
}
 No newline at end of file
+67 −10
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.internal.telephony.dataconnection;

import static android.telephony.data.DataServiceCallback.RESULT_SUCCESS;

import android.annotation.Nullable;
import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Handler;
@@ -27,6 +30,7 @@ import android.telephony.data.DataProfile;
import android.telephony.data.DataService;
import android.telephony.data.DataServiceCallback;

import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.telephony.Rlog;
@@ -50,6 +54,8 @@ public class CellularDataService extends DataService {
    private static final int SET_DATA_PROFILE_COMPLETE              = 4;
    private static final int REQUEST_DATA_CALL_LIST_COMPLETE        = 5;
    private static final int DATA_CALL_LIST_CHANGED                 = 6;
    private static final int START_HANDOVER                         = 7;
    private static final int CANCEL_HANDOVER                        = 8;

    private class CellularDataServiceProvider extends DataService.DataServiceProvider {

@@ -75,29 +81,29 @@ public class CellularDataService extends DataService {
                            DataCallResponse response = (DataCallResponse) ar.result;
                            callback.onSetupDataCallComplete(ar.exception != null
                                    ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                    : DataServiceCallback.RESULT_SUCCESS,
                                    : RESULT_SUCCESS,
                                    response);
                            break;
                        case DEACTIVATE_DATA_ALL_COMPLETE:
                            callback.onDeactivateDataCallComplete(ar.exception != null
                                    ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                    : DataServiceCallback.RESULT_SUCCESS);
                                    : RESULT_SUCCESS);
                            break;
                        case SET_INITIAL_ATTACH_APN_COMPLETE:
                            callback.onSetInitialAttachApnComplete(ar.exception != null
                                    ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                    : DataServiceCallback.RESULT_SUCCESS);
                                    : RESULT_SUCCESS);
                            break;
                        case SET_DATA_PROFILE_COMPLETE:
                            callback.onSetDataProfileComplete(ar.exception != null
                                    ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                    : DataServiceCallback.RESULT_SUCCESS);
                                    : RESULT_SUCCESS);
                            break;
                        case REQUEST_DATA_CALL_LIST_COMPLETE:
                            callback.onRequestDataCallListComplete(
                                    ar.exception != null
                                            ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                            : DataServiceCallback.RESULT_SUCCESS,
                                            : RESULT_SUCCESS,
                                    ar.exception != null
                                            ? null : (List<DataCallResponse>) ar.result
                                    );
@@ -105,9 +111,14 @@ public class CellularDataService extends DataService {
                        case DATA_CALL_LIST_CHANGED:
                            notifyDataCallListChanged((List<DataCallResponse>) ar.result);
                            break;
                        case START_HANDOVER:
                            callback.onHandoverStarted(toResultCode(ar.exception));
                            break;
                        case CANCEL_HANDOVER:
                            callback.onHandoverCancelled(toResultCode(ar.exception));
                            break;
                        default:
                            loge("Unexpected event: " + message.what);
                            return;
                    }
                }
            };
@@ -116,10 +127,31 @@ public class CellularDataService extends DataService {
            mPhone.mCi.registerForDataCallListChanged(mHandler, DATA_CALL_LIST_CHANGED, null);
        }


        /* Converts the result code for start handover and cancel handover */
        @DataServiceCallback.ResultCode private int toResultCode(@Nullable Throwable t) {
            if (t == null) {
                return RESULT_SUCCESS;
            } else {
                if (t instanceof CommandException) {
                    CommandException ce = (CommandException) t;
                    if (ce.getCommandError() == CommandException.Error.REQUEST_NOT_SUPPORTED) {
                        return DataServiceCallback.RESULT_ERROR_UNSUPPORTED;
                    } else {
                        return DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE;
                    }
                } else {
                    loge("Throwable is of type " + t.getClass().getSimpleName()
                            + " but should be CommandException");
                    return DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE;
                }
            }
        }

        @Override
        public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
                                  boolean allowRoaming, int reason, LinkProperties linkProperties,
                                  DataServiceCallback callback) {
        public void setupDataCall(int accessNetworkType, DataProfile dataProfile,
                boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties,
                int pduSessionId, DataServiceCallback callback) {
            if (DBG) log("setupDataCall " + getSlotIndex());

            Message message = null;
@@ -131,7 +163,7 @@ public class CellularDataService extends DataService {
            }

            mPhone.mCi.setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming,
                    reason, linkProperties, message);
                    reason, linkProperties, pduSessionId, message);
        }

        @Override
@@ -195,6 +227,31 @@ public class CellularDataService extends DataService {
            mPhone.mCi.getDataCallList(message);
        }

        @Override
        public void startHandover(int cid, DataServiceCallback callback) {
            if (DBG) log("startHandover " + getSlotIndex());
            Message message = null;
            // Only obtain the message when the caller wants a callback. If the caller doesn't care
            // the request completed or results, then no need to pass the message down.
            if (callback != null) {
                message = Message.obtain(mHandler, START_HANDOVER);
                mCallbackMap.put(message, callback);
            }
            mPhone.mCi.startHandover(message, cid);
        }

        @Override
        public void cancelHandover(int cid, DataServiceCallback callback) {
            Message message = null;
            // Only obtain the message when the caller wants a callback. If the caller doesn't care
            // the request completed or results, then no need to pass the message down.
            if (callback != null) {
                message = Message.obtain(mHandler, CANCEL_HANDOVER);
                mCallbackMap.put(message, callback);
            }
            mPhone.mCi.cancelHandover(message, cid);
        }

        @Override
        public void close() {
            mPhone.mCi.unregisterForDataCallListChanged(mHandler);
+330 −35

File changed.

Preview size limit exceeded, changes collapsed.

Loading