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

Commit 55143651 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Add request/response for voice/data Reg 1.5" into rvc-dev am: cf050b2b am: 8a346e65

Change-Id: I1435499efc37d963da2078109822d356d72d25d4
parents 27d92a27 8a346e65
Loading
Loading
Loading
Loading
+105 −3
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ public class CellularNetworkService extends NetworkService {
    private static final int GET_PS_REGISTRATION_STATE_DONE = 2;
    private static final int NETWORK_REGISTRATION_STATE_CHANGED = 3;

    // From 24.008 6.1.3.0 and 10.5.6.2 the maximum number of PDP Contexts is 16.
    private static final int MAX_DATA_CALLS = 16;

    private class CellularNetworkServiceProvider extends NetworkServiceProvider {

        private final ConcurrentHashMap<Message, NetworkServiceCallback> mCallbackMap =
@@ -222,7 +225,13 @@ public class CellularNetworkService extends NetworkService {
            int transportType = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
            int domain = NetworkRegistrationInfo.DOMAIN_CS;

            if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) {
            // 1.5 at the top so that we can do an "early exit" from the method
            if (result instanceof android.hardware.radio.V1_5.RegStateResult) {
                return getNetworkRegistrationInfo(
                        NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                        (android.hardware.radio.V1_5.RegStateResult) result);
            } else if (result instanceof android.hardware.radio.V1_0.VoiceRegStateResult) {
                android.hardware.radio.V1_0.VoiceRegStateResult voiceRegState =
                        (android.hardware.radio.V1_0.VoiceRegStateResult) result;
                int regState = getRegStateFromHalRegState(voiceRegState.regState);
@@ -291,7 +300,13 @@ public class CellularNetworkService extends NetworkService {
                    new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE,
                            LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);

            if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) {
            // 1.5 at the top so that we can do an "early exit" from the method
            if (result instanceof android.hardware.radio.V1_5.RegStateResult) {
                return getNetworkRegistrationInfo(
                        NetworkRegistrationInfo.DOMAIN_PS,
                        AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                        (android.hardware.radio.V1_5.RegStateResult) result);
            } else if (result instanceof android.hardware.radio.V1_0.DataRegStateResult) {
                android.hardware.radio.V1_0.DataRegStateResult dataRegState =
                        (android.hardware.radio.V1_0.DataRegStateResult) result;
                regState = getRegStateFromHalRegState(dataRegState.regState);
@@ -347,8 +362,14 @@ public class CellularNetworkService extends NetworkService {
            List<Integer> availableServices = getAvailableServices(
                    regState, domain, emergencyOnly);

            // In earlier versions of the HAL, LTE_CA was allowed to indicate that the device
            // is on CA; however, that has been superseded by the PHYSICAL_CHANNEL_CONFIG signal.
            // Because some vendors provide both NETWORK_TYPE_LTE_CA *and* PHYSICAL_CHANNEL_CONFIG,
            // this tweak is left for compatibility; however, the network type is no longer allowed
            // to be used to declare that carrier aggregation is in effect, because the other
            // signal provides a much richer information set, and we want to mitigate confusion in
            // how CA information is being provided.
            if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                isUsingCarrierAggregation = true;
                networkType = TelephonyManager.NETWORK_TYPE_LTE;
            }

@@ -358,6 +379,87 @@ public class CellularNetworkService extends NetworkService {
                    lteVopsSupportInfo, isUsingCarrierAggregation);
        }

        private @NonNull NetworkRegistrationInfo getNetworkRegistrationInfo(
                int domain, int transportType,
                android.hardware.radio.V1_5.RegStateResult regResult) {

            // Perform common conversions that aren't domain specific
            final int regState = getRegStateFromHalRegState(regResult.regState);
            final boolean isEmergencyOnly = isEmergencyOnly(regResult.regState);
            final List<Integer> availableServices = getAvailableServices(
                    regState, domain, isEmergencyOnly);
            final int rejectCause = regResult.reasonForDenial;
            final CellIdentity cellIdentity = CellIdentity.create(regResult.cellIdentity);
            final String rplmn = regResult.registeredPlmn;
            final int reasonForDenial = regResult.reasonForDenial;

            // Network Type fixup for carrier aggregation
            int networkType = ServiceState.rilRadioTechnologyToNetworkType(regResult.rat);
            boolean isUsingCarrierAggregation = false;
            if (networkType == TelephonyManager.NETWORK_TYPE_LTE_CA) {
                isUsingCarrierAggregation = true;
                networkType = TelephonyManager.NETWORK_TYPE_LTE;
            }

            // Conditional parameters for specific RANs
            boolean cssSupported = false;
            int roamingIndicator = 0;
            int systemIsInPrl = 0;
            int defaultRoamingIndicator = 0;
            boolean isEndcAvailable = false;
            boolean isNrAvailable = false;
            boolean isDcNrRestricted = false;
            LteVopsSupportInfo vopsInfo = new LteVopsSupportInfo(
                    LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE,
                    LteVopsSupportInfo.LTE_STATUS_NOT_AVAILABLE);

            switch (regResult.accessTechnologySpecificInfo.getDiscriminator()) {
                case android.hardware.radio.V1_5.RegStateResult
                        .AccessTechnologySpecificInfo.hidl_discriminator.cdmaInfo:
                    android.hardware.radio.V1_5.RegStateResult
                            .AccessTechnologySpecificInfo.Cdma2000RegistrationInfo cdmaInfo =
                                    regResult.accessTechnologySpecificInfo.cdmaInfo();
                    cssSupported = cdmaInfo.cssSupported;
                    roamingIndicator = cdmaInfo.roamingIndicator;
                    systemIsInPrl = cdmaInfo.systemIsInPrl;
                    defaultRoamingIndicator = cdmaInfo.defaultRoamingIndicator;
                    break;
                case android.hardware.radio.V1_5.RegStateResult
                        .AccessTechnologySpecificInfo.hidl_discriminator.eutranInfo:
                    android.hardware.radio.V1_5.RegStateResult
                            .AccessTechnologySpecificInfo.EutranRegistrationInfo eutranInfo =
                                    regResult.accessTechnologySpecificInfo.eutranInfo();

                    isEndcAvailable = eutranInfo.nrIndicators.isDcNrRestricted;
                    isNrAvailable = eutranInfo.nrIndicators.isNrAvailable;
                    isDcNrRestricted = eutranInfo.nrIndicators.isEndcAvailable;
                    vopsInfo = convertHalLteVopsSupportInfo(
                            eutranInfo.lteVopsInfo.isVopsSupported,
                            eutranInfo.lteVopsInfo.isEmcBearerSupported);
                    break;
                default:
                    log("No access tech specific info passes for RegStateResult");
                    break;
            }

            // build the result based on the domain for the request
            switch(domain) {
                case NetworkRegistrationInfo.DOMAIN_CS:
                    return new NetworkRegistrationInfo(domain, transportType, regState,
                            networkType, reasonForDenial, isEmergencyOnly, availableServices,
                            cellIdentity, rplmn, cssSupported, roamingIndicator, systemIsInPrl,
                            defaultRoamingIndicator);
                default:
                    loge("Unknown domain passed to CellularNetworkService= " + domain);
                    // fall through
                case NetworkRegistrationInfo.DOMAIN_PS:
                    return new NetworkRegistrationInfo(domain, transportType, regState, networkType,
                            reasonForDenial, isEmergencyOnly, availableServices, cellIdentity,
                            rplmn, MAX_DATA_CALLS, isDcNrRestricted, isNrAvailable, isEndcAvailable,
                            vopsInfo, isUsingCarrierAggregation);
            }
        }

        private LteVopsSupportInfo convertHalLteVopsSupportInfo(
                boolean vopsSupport, boolean emcBearerSupport) {
            int vops = LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED;
+29 −8
Original line number Diff line number Diff line
@@ -1347,6 +1347,15 @@ public class RIL extends BaseCommands implements CommandsInterface {

            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                final android.hardware.radio.V1_5.IRadio radioProxy15 =
                        (android.hardware.radio.V1_5.IRadio) radioProxy;
                try {
                    radioProxy15.getVoiceRegistrationState_1_5(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "getVoiceRegistrationState_1_5", e);
                }
            } else {
                try {
                    radioProxy.getVoiceRegistrationState(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
@@ -1354,6 +1363,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                }
            }
        }
    }

    @Override
    public void getDataRegistrationState(Message result) {
@@ -1364,6 +1374,16 @@ public class RIL extends BaseCommands implements CommandsInterface {

            if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));


            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
                final android.hardware.radio.V1_5.IRadio radioProxy15 =
                        (android.hardware.radio.V1_5.IRadio) radioProxy;
                try {
                    radioProxy15.getDataRegistrationState_1_5(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "getDataRegistrationState_1_5", e);
                }
            } else {
                try {
                    radioProxy.getDataRegistrationState(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
@@ -1371,6 +1391,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                }
            }
        }
    }

    @Override
    public void getOperator(Message result) {
+33 −0
Original line number Diff line number Diff line
@@ -328,6 +328,23 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param voiceRegResponse Current Voice registration response as defined by VoiceRegStateResult
     *        in 1.5/types.hal
     */
    public void getVoiceRegistrationStateResponse_1_5(RadioResponseInfo responseInfo,
            android.hardware.radio.V1_5.RegStateResult voiceRegResponse) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, voiceRegResponse);
            }
            mRil.processResponseDone(rr, responseInfo, voiceRegResponse);
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in
@@ -379,6 +396,22 @@ public class RadioResponse extends IRadioResponse.Stub {
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param dataRegResponse Current Data registration response as defined by DataRegStateResult in
     *        1.5/types.hal
     */
    public void getDataRegistrationStateResponse_1_5(RadioResponseInfo responseInfo,
            android.hardware.radio.V1_5.RegStateResult dataRegResponse) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, dataRegResponse);
            }
            mRil.processResponseDone(rr, responseInfo, dataRegResponse);
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error