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

Commit 147a3ea9 authored by Gwen Lin's avatar Gwen Lin
Browse files

Revert "Revert "Support notifyImsDataNework in CommandsInterface..."

Revert submission 33884452-revert-33324342-notify_ims_data_network-OMVZACYCSE

Reason for revert: Vendor RIL change is ready

Reverted changes: /q/submissionid:33884452-revert-33324342-notify_ims_data_network-OMVZACYCSE

Change-Id: I737505e2cd4772681ffbae4874c03cf4b79efef0
parent 0e23622a
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ import android.os.Message;
import android.os.WorkSource;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.DataState;
import android.telephony.BarringInfo;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
@@ -3021,4 +3024,24 @@ public interface CommandsInterface {
     */
    default void updateAllowedImsServices(@NonNull Set<Integer> allowedImsServicesAny,
            @NonNull Set<Integer> allowedImsServicesHomeOnly, @Nullable Message result) {}

    /**
     * Notify IMS data network to the modem.
     *
     * @param accessNetwork The access network type.
     * @param dataNetworkState The data network connection state.
     * @param physicalTransportType The physical transport type of the data network.
     * @param physicalNetworkSlotIndex The slot index while the physical transport type is
     *        {@link AccessNetworkConstants#TRANSPORT_TYPE_WWAN}. If the physical transport type is
     *        {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, this slot index will be
     *        {@link SubscriptionManager#INVALID_SIM_SLOT_INDEX}.
     * @param result Callback message to receive the result.
     *
     * Response function is IRadioDataResponse.notifyImsDataNetworkResponse()
     *
     * This is available when android.hardware.telephony.data is defined.
     */
    default void notifyImsDataNetwork(@RadioAccessNetworkType int accessNetwork,
            @DataState int dataNetworkState, @TransportType int physicalTransportType,
            int physicalNetworkSlotIndex, @Nullable Message result) {}
}
+7 −0
Original line number Diff line number Diff line
@@ -244,6 +244,13 @@ public class DataResponse extends IRadioDataResponse.Stub {
        RadioResponse.responseVoid(HAL_SERVICE_DATA, mRil, responseInfo);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void notifyImsDataNetworkResponse(RadioResponseInfo responseInfo) {
        RadioResponse.responseVoid(HAL_SERVICE_DATA, mRil, responseInfo);
    }

    @Override
    public String getInterfaceHash() {
        return IRadioDataResponse.HASH;
+39 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ import android.provider.Settings;
import android.sysprop.TelephonyProperties;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
import android.telephony.AccessNetworkConstants.TransportType;
import android.telephony.Annotation.DataState;
import android.telephony.BarringInfo;
import android.telephony.CarrierRestrictionRules;
import android.telephony.ClientRequestStats;
@@ -4809,6 +4812,42 @@ public class RIL extends BaseCommands implements CommandsInterface {
        });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void notifyImsDataNetwork(@RadioAccessNetworkType int accessNetwork,
            @DataState int dataNetworkState, @TransportType int physicalTransportType,
            int physicalNetworkSlotIndex, @Nullable Message result) {
        RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
        if (!canMakeRequest("notifyImsDataNetwork", dataProxy, result, RADIO_HAL_VERSION_2_4)) {
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_NOTIFY_IMS_DATA_NETWORK, result,
                mRILDefaultWorkSource);
        if (RILJ_LOGD) {
            riljLog(
                    rr.serialString()
                            + "> "
                            + RILUtils.requestToString(rr.mRequest)
                            + " accessNetwork="
                            + AccessNetworkConstants.AccessNetworkType.toString(accessNetwork)
                            + " dataNetworkState="
                            + TelephonyUtils.dataStateToString(dataNetworkState)
                            + " physicalTransportType="
                            + AccessNetworkConstants.transportTypeToString(physicalTransportType)
                            + " physicalNetworkSlotIndex="
                            + physicalNetworkSlotIndex);
        }

        radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "notifyImsDataNetwork", () -> {
            dataProxy.notifyImsDataNetwork(rr.mSerial, accessNetwork,
                    RILUtils.convertToHalDataNetworkState(dataNetworkState),
                    physicalTransportType, physicalNetworkSlotIndex);
        });
    }

    /**
     * {@inheritDoc}
     */
+27 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SECURIT
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_VONR_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NOTIFY_IMS_DATA_NETWORK;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_READ_ITEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_RESET_CONFIG;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_WRITE_CDMA_PRL;
@@ -313,6 +314,7 @@ import android.os.SystemClock;
import android.service.carrier.CarrierIdentifier;
import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation;
import android.telephony.Annotation.DataState;
import android.telephony.BarringInfo;
import android.telephony.CarrierInfo;
import android.telephony.CarrierRestrictionRules;
@@ -4822,6 +4824,29 @@ public class RILUtils {
        };
    }

    /**
     * Convert to HAL data network state.
     * @param state Telephony data state.
     * @return The converted HAL data network state.
     */
    public static int convertToHalDataNetworkState(@DataState int state) {
        return switch (state) {
            case TelephonyManager.DATA_UNKNOWN ->
                    android.hardware.radio.data.DataNetworkState.UNKNOWN;
            case TelephonyManager.DATA_DISCONNECTED ->
                    android.hardware.radio.data.DataNetworkState.DISCONNECTED;
            case TelephonyManager.DATA_CONNECTING ->
                    android.hardware.radio.data.DataNetworkState.CONNECTING;
            case TelephonyManager.DATA_CONNECTED ->
                    android.hardware.radio.data.DataNetworkState.CONNECTED;
            case TelephonyManager.DATA_DISCONNECTING ->
                    android.hardware.radio.data.DataNetworkState.DISCONNECTING;
            default ->
                    // Throw an exception for any unsupported state.
                    throw new IllegalArgumentException("Unsupported data state: " + state);
        };
    }

    /** Append the data to the end of an ArrayList */
    public static void appendPrimitiveArrayToArrayList(byte[] src, ArrayList<Byte> dst) {
        for (byte b : src) {
@@ -5332,6 +5357,8 @@ public class RILUtils {
                return "SET_USER_DATA_ROAMING_ENABLED";
            case RIL_REQUEST_UPDATE_ALLOWED_IMS_SERVICES:
                return "UPDATE_ALLOWED_IMS_SERVICES";
            case RIL_REQUEST_NOTIFY_IMS_DATA_NETWORK:
                return "NOTIFY_IMS_DATA_NETWORK";
            default:
                return "<unknown request " + request + ">";
        }
+20 −0
Original line number Diff line number Diff line
@@ -474,4 +474,24 @@ public class RadioDataProxy extends RadioServiceProxy {
            mDataProxy.setUserDataRoamingEnabled(serial, enabled);
        }
    }

    /**
     * Call IRadioData#notifyImsDataNetwork
     *
     * @param serial Serial number of request
     * @param accessNetwork The access network type.
     * @param dataNetworkState The data network connection state.
     * @param physicalTransportType The physical transport type of the data network.
     * @param physicalNetworkModemId The logic modem ID while the physical transport type is WWAN.
     *        If the physical transport type is WLAN, this modem ID will be -1.
     * @throws RemoteException if error occurs
     */
    public void notifyImsDataNetwork(int serial, int accessNetwork, int dataNetworkState,
            int physicalTransportType, int physicalNetworkModemId) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mDataProxy.notifyImsDataNetwork(serial, accessNetwork, dataNetworkState,
                    physicalTransportType, physicalNetworkModemId);
        }
    }
}