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

Commit bc1818a3 authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by Gary Jian
Browse files

VoNR toggle

Allow user to enable or disable voice over NR.

Bug: 190668235
Test: verified using settings UI
Change-Id: I55ca15a35310c444e91807554b9dcc7355040d86
Merged-In: I55ca15a35310c444e91807554b9dcc7355040d86
parent eaa057ff
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1598,6 +1598,17 @@ public interface CommandsInterface {
     */
    default void isNrDualConnectivityEnabled(Message message, WorkSource workSource) {}

    /**
     * Enable or disable Voice over NR (VoNR)
     * @param enabled enable or disable VoNR.
     */
    default void setVoNrEnabled(boolean enabled, Message message, WorkSource workSource) {}

    /**
     * Is voice over NR enabled
     */
    default void isVoNrEnabled(Message message, WorkSource workSource) {}

    /**
     * Request to enable/disable network state change notifications when
     * location information (lac and/or cid) has changed.
+15 −0
Original line number Diff line number Diff line
@@ -4656,6 +4656,21 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mCi.setSimCardPower(state, result, workSource);
    }

    /**
     * Enable or disable Voice over NR (VoNR)
     * @param enabled enable or disable VoNR.
     **/
    public void setVoNrEnabled(boolean enabled, Message result, WorkSource workSource) {
        mCi.setVoNrEnabled(enabled, result, workSource);
    }

    /**
     * Is voice over NR enabled
     */
    public void isVoNrEnabled(Message message, WorkSource workSource) {
        mCi.isVoNrEnabled(message, workSource);
    }

    public void setCarrierTestOverride(String mccmnc, String imsi, String iccid, String gid1,
            String gid2, String pnn, String spn, String carrierPrivilegeRules, String apn) {
    }
+43 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.WorkSource;
import android.provider.Settings;
import android.sysprop.TelephonyProperties;
@@ -235,6 +236,8 @@ public class RIL extends BaseCommands implements CommandsInterface {

    final Integer mPhoneId;

    private static final String PROPERTY_IS_VONR_ENABLED = "persist.radio.is_vonr_enabled_";

    /**
     * A set that records if radio service is disabled in hal for
     * a specific phone id slot to avoid further getService request.
@@ -3096,6 +3099,46 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    private void setVoNrEnabled(boolean enabled) {
        SystemProperties.set(PROPERTY_IS_VONR_ENABLED + mPhoneId, String.valueOf(enabled));
    }

    private boolean isVoNrEnabled() {
        return SystemProperties.getBoolean(PROPERTY_IS_VONR_ENABLED + mPhoneId, true);
    }

    /**
     * Is voice over NR enabled
     */
    @Override
    public void isVoNrEnabled(Message result, WorkSource workSource) {
        boolean isEnabled = isVoNrEnabled();
        if (result != null) {
            AsyncResult.forMessage(result, isEnabled, null);
            result.sendToTarget();
        }
    }

    /**
     * Enable or disable Voice over NR (VoNR)
     * @param enabled enable or disable VoNR.
     */
    @Override
    public void setVoNrEnabled(boolean enabled, Message result, WorkSource workSource) {
        setVoNrEnabled(enabled);
        /* 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.
           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) {
            AsyncResult.forMessage(result, null, null);
            result.sendToTarget();
        }
    }

    @Override
    public void setCdmaSubscriptionSource(int cdmaSubscription , Message result) {
        IRadio radioProxy = getRadioProxy(result);