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

Commit 81c57de0 authored by Kuen Yuet Cheung's avatar Kuen Yuet Cheung
Browse files

Add setUserDataEnabled and setUserDataRoamingEnabled in CommandsInterface, RILJ and Proxy

This changes defined setUserDataEnabled and setUserDataRoamingEnabled
in CommandsInterface, and implemented in RILJ by calling the proxy
function added in RadioDataProxy.

Test: m
Bug: 389120182
FLAG: EXEMPT HAL interface change
Change-Id: Ie7be68ed0284080e49118c2cb1f3b1e7a39851c2
parent 40a412ff
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -2587,6 +2587,28 @@ public interface CommandsInterface {
     */
    default void cancelHandover(Message result, int callId) {};

    /**
     * Tells the modem if user data setting is enabled or disabled.
     *
     * This API is for informational purposes. The modem must not block any subsequent setup data
     * call requests.
     *
     * @param result  Message that will be sent back to handler.
     * @param enabled Whether the user mobile data is enabled.
     */
    default void setUserDataEnabled(Message result, boolean enabled) {};

    /**
     * Tells the modem if user data roaming setting is enabled or disabled.
     *
     * This API is for informational purposes. The modem must not block any subsequent setup data
     * call requests.
     *
     * @param result  Message that will be sent back to handler.
     * @param enabled Whether the user mobile data roaming is enabled.
     */
    default void setUserDataRoamingEnabled(Message result, boolean enabled) {};

    /**
     * Control the data throttling at modem.
     *
+14 −0
Original line number Diff line number Diff line
@@ -230,6 +230,20 @@ public class DataResponse extends IRadioDataResponse.Stub {
        }
    }

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

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

    @Override
    public String getInterfaceHash() {
        return IRadioDataResponse.HASH;
+45 −0
Original line number Diff line number Diff line
@@ -4764,6 +4764,51 @@ public class RIL extends BaseCommands implements CommandsInterface {
        });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUserDataEnabled(Message result, boolean enabled) {
        RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
        if (!canMakeRequest("setUserDataEnabled", dataProxy, result, RADIO_HAL_VERSION_2_4)) {
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_SET_USER_DATA_ENABLED, result,
                mRILDefaultWorkSource);
        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest) + " enabled="
                    + enabled);
        }

        radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setUserDataEnabled", () -> {
            dataProxy.setUserDataEnabled(rr.mSerial, enabled);
        });
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUserDataRoamingEnabled(Message result, boolean enabled) {
        RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
        if (!canMakeRequest("setUserDataRoamingEnabled", dataProxy, result,
                RADIO_HAL_VERSION_2_4)) {
            return;
        }

        RILRequest rr = obtainRequest(RIL_REQUEST_SET_USER_DATA_ROAMING_ENABLED, result,
                mRILDefaultWorkSource);
        if (RILJ_LOGD) {
            riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest) + " enabled="
                    + enabled);
        }

        radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setUserDataRoamingEnabled", () -> {
            dataProxy.setUserDataRoamingEnabled(rr.mSerial, enabled);
        });
    }

    /**
     * {@inheritDoc}
     */
+6 −0
Original line number Diff line number Diff line
@@ -195,6 +195,8 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_UICC_S
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_USAGE_SETTING;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_USER_DATA_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_USER_DATA_ROAMING_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SHUTDOWN;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SIGNAL_STRENGTH;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SIM_AUTHENTICATION;
@@ -5261,6 +5263,10 @@ public class RILUtils {
                return "SET_SATELLITE_ENABLED_FOR_CARRIER";
            case RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER:
                return "IS_SATELLITE_ENABLED_FOR_CARRIER";
            case RIL_REQUEST_SET_USER_DATA_ENABLED:
                return "SET_USER_DATA_ENABLED";
            case RIL_REQUEST_SET_USER_DATA_ROAMING_ENABLED:
                return "SET_USER_DATA_ROAMING_ENABLED";
            default:
                return "<unknown request " + request + ">";
        }
+26 −0
Original line number Diff line number Diff line
@@ -448,4 +448,30 @@ public class RadioDataProxy extends RadioServiceProxy {
            mRadioProxy.stopKeepalive(serial, sessionHandle);
        }
    }

    /**
     * Call IRadioData#setUserDataEnabled
     * @param serial Serial number of request
     * @param enabled Whether the user mobile data is enabled
     * @throws RemoteException
     */
    public void setUserDataEnabled(int serial, boolean enabled) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mDataProxy.setUserDataEnabled(serial, enabled);
        }
    }

    /**
     * Call IRadioData#setUserDataRoamingEnabled
     * @param serial Serial number of request
     * @param enabled Whether the user mobile data roaming is enabled
     * @throws RemoteException
     */
    public void setUserDataRoamingEnabled(int serial, boolean enabled) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mDataProxy.setUserDataRoamingEnabled(serial, enabled);
        }
    }
}