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

Commit 95162a3a authored by Jack Nudelman's avatar Jack Nudelman
Browse files

Allow for DataThrottling APIs to be call the radio impl.

go/telephony-thermal-mitigation

Bug: 158872959
Test: make

Change-Id: I018a004be3366d5efe5f0c5b0393cea8b02d8cdb
Merged-In: I018a004be3366d5efe5f0c5b0393cea8b02d8cdb
parent 4832c35c
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2585,4 +2585,17 @@ public interface CommandsInterface {
     * @param callId Identifier associated with the data call
     */
    default void cancelHandover(Message result, int callId) {};


    /**
     * Control the data throttling at modem.
     *
     * @param result Message that will be sent back to the requester
     * @param workSource calling Worksource
     * @param dataThrottlingAction the DataThrottlingAction that is being requested.
     * Defined in android.hardware.radio@1.6.types.
     * @param completionWindowSecs seconds in which data throttling action has to be achieved.
     */
    default void setDataThrottling(Message result, WorkSource workSource,
            int dataThrottlingAction, int completionWindowSecs) {};
}
+14 −0
Original line number Diff line number Diff line
@@ -4178,6 +4178,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
                obtainMessage(EVENT_CONFIG_LCE));
    }

    /**
     * Control the data throttling at modem.
     *
     * @param result Message that will be sent back to the requester
     * @param workSource calling Worksource
     * @param dataThrottlingAction the DataThrottlingAction that is being requested. Defined in
     * android.telephony.TelephonyManger.
     * @param completionWindowSecs seconds in which data throttling action has to be achieved.
     */
    public void setDataThrottling(Message result, WorkSource workSource,
            int dataThrottlingAction, int completionWindowSecs) {
        mCi.setDataThrottling(result, workSource, dataThrottlingAction, completionWindowSecs);
    }

    /**
     * Set allowed carriers
     */
+46 −0
Original line number Diff line number Diff line
@@ -4855,6 +4855,50 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * Control the data throttling at modem.
     *
     * @param result Message that will be sent back to the requester
     * @param workSource calling Worksource
     * @param dataThrottlingAction the DataThrottlingAction that is being requested. Defined in
     * android.hardware.radio@1.6.types.
     * @param completionWindowSecs seconds in which full throttling has to be achieved.
     */
    @Override
    public void setDataThrottling(Message result, WorkSource workSource, int dataThrottlingAction,
            int completionWindowSecs) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            if (mRadioVersion.less(RADIO_HAL_VERSION_1_6)) {
                if (result != null) {
                    AsyncResult.forMessage(result, null,
                            CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                    result.sendToTarget();
                }
                return;
            }

            android.hardware.radio.V1_6.IRadio radioProxy16 =
                    (android.hardware.radio.V1_6.IRadio) radioProxy;
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_THROTTLING, result,
                    workSource == null ? mRILDefaultWorkSource : workSource);

            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> "
                        + requestToString(rr.mRequest)
                        + " dataThrottlingAction = " + dataThrottlingAction
                        + " completionWindowSecs " + completionWindowSecs);
            }

            try {
                radioProxy16.setDataThrottling(rr.mSerial, dataThrottlingAction,
                        completionWindowSecs);
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "setDataThrottling", e);
            }
        }
    }

    /**
     * This will only be called if the LCE service is started in PULL mode, which is
     * only enabled when using Radio HAL versions 1.1 and earlier.
@@ -6693,6 +6737,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "RIL_REQUEST_START_HANDOVER";
            case RIL_REQUEST_CANCEL_HANDOVER:
                return "RIL_REQUEST_CANCEL_HANDOVER";
            case RIL_REQUEST_SET_DATA_THROTTLING:
                return "RIL_REQUEST_SET_DATA_THROTTLING";
            default: return "<unknown request>";
        }
    }