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

Commit fc3cfe43 authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by Gerrit Code Review
Browse files

Merge "Add VoNR api into IRadioVoice module"

parents 35aec1e7 5e98170b
Loading
Loading
Loading
Loading
+51 −14
Original line number Diff line number Diff line
@@ -2875,12 +2875,31 @@ public class RIL extends BaseCommands implements CommandsInterface {
     */
    @Override
    public void isVoNrEnabled(Message result, WorkSource workSource) {

        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
            RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
            if (!voiceProxy.isEmpty()) {
                RILRequest rr = obtainRequest(RIL_REQUEST_IS_VONR_ENABLED , result,
                        getDefaultWorkSourceIfInvalid(workSource));

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

                try {
                    voiceProxy.isVoNrEnabled(rr.mSerial);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(VOICE_SERVICE, "isVoNrEnabled", e);
                }
            }
        } else {
            boolean isEnabled = isVoNrEnabled();
            if (result != null) {
                AsyncResult.forMessage(result, isEnabled, null);
                result.sendToTarget();
            }
        }
    }

    /**
     * Enable or disable Voice over NR (VoNR)
@@ -2889,11 +2908,28 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void setVoNrEnabled(boolean enabled, Message result, WorkSource workSource) {
        setVoNrEnabled(enabled);

        if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
            RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
            if (!voiceProxy.isEmpty()) {
                RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_VONR, result,
                        getDefaultWorkSourceIfInvalid(workSource));

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

                try {
                    voiceProxy.setVoNrEnabled(rr.mSerial, enabled);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(VOICE_SERVICE, "setVoNrEnabled", e);
                }
            }
        } else {
            /* calling a query api to let HAL know that VoNREnabled state is updated.
           This is a temporary work around as new HIDL API is not allowed.
               This is a work around as new AIDL API is not allowed for older HAL version devices.
               HAL can check the value of PROPERTY_IS_VONR_ENABLED property to determine
               if there is any change whenever it receives isNrDualConnectivityEnabled request.
           This behavior will be removed in Android T.
            */
            isNrDualConnectivityEnabled(null, workSource);
            if (result != null) {
@@ -2901,6 +2937,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
                result.sendToTarget();
            }
        }
    }

    @Override
    public void setCdmaSubscriptionSource(int cdmaSubscription, Message result) {
+6 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_EMERGENCY_
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_NR_DUAL_CONNECTIVITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_UICC_APPLICATIONS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_VONR;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENTER_SIM_PIN;
@@ -111,6 +112,7 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_REGIST
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_SEND_SMS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ISIM_AUTHENTICATION;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED;
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_NV_READ_ITEM;
@@ -4870,6 +4872,10 @@ public class RILUtils {
                return "GET_ALLOWED_NETWORK_TYPES_BITMAP";
            case RIL_REQUEST_GET_SLICING_CONFIG:
                return "GET_SLICING_CONFIG";
            case RIL_REQUEST_ENABLE_VONR:
                return "ENABLE_VONR";
            case RIL_REQUEST_IS_VONR_ENABLED:
                return "IS_VONR_ENABLED";
            default:
                return "<unknown request " + request + ">";
        }
+25 −0
Original line number Diff line number Diff line
@@ -397,6 +397,18 @@ public class RadioVoiceProxy extends RadioServiceProxy {
        }
    }

    /**
     * Call IRadioVoice#isVoNrEnabled
     * @param serial Serial number of request
     * @throws RemoteException
     */
    public void isVoNrEnabled(int serial) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mVoiceProxy.isVoNrEnabled(serial);
        }
    }

    /**
     * Call IRadioVoice#rejectCall
     * @param serial Serial number of request
@@ -600,6 +612,19 @@ public class RadioVoiceProxy extends RadioServiceProxy {
        }
    }

    /**
     * Call IRadioVoice#setVoNrEnabled
     * @param serial Serial number of request
     * @param enable True to enable, false to disable
     * @throws RemoteException
     */
    public void setVoNrEnabled(int serial, boolean enable) throws RemoteException {
        if (isEmpty()) return;
        if (isAidl()) {
            mVoiceProxy.setVoNrEnabled(serial, enable);
        }
    }

    /**
     * Call IRadioVoice#startDtmf
     * @param serial Serial number of request
+15 −0
Original line number Diff line number Diff line
@@ -256,6 +256,14 @@ public class VoiceResponse extends IRadioVoiceResponse.Stub {
        RadioResponse.responseVoid(mRil, responseInfo);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     * @param enable true for "vonr enabled" and false for "vonr disabled"
     */
    public void isVoNrEnabledResponse(RadioResponseInfo responseInfo, boolean enable) {
        RadioResponse.responseInts(mRil, responseInfo, enable ? 1 : 0);
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
@@ -333,6 +341,13 @@ public class VoiceResponse extends IRadioVoiceResponse.Stub {
        RadioResponse.responseVoid(mRil, responseInfo);
    }

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

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