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

Commit e6abedb3 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: I655dc93c0b213e1b85b29b9a168f99072ca82186
Merged-In: I655dc93c0b213e1b85b29b9a168f99072ca82186
parent db5da1ce
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -5190,6 +5190,16 @@ public class CarrierConfigManager {
    public static final String KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL =
            "display_no_data_notification_on_permanent_failure_bool";

    /**
     * Boolean indicating if the VoNR setting is visible in the Call Settings menu.
     * If true, the VoNR setting menu will be visible. If false, the menu will be gone.
     *
     * Disabled by default.
     *
     * @hide
     */
    public static final String KEY_VONR_SETTING_VISIBILITY_BOOL = "vonr_setting_visibility_bool";

    /**
     * Determine whether unthrottle data retry when tracking area code (TAC/LAC) from cell changes
     *
@@ -5806,6 +5816,7 @@ public class CarrierConfigManager {
        sDefaults.putString(KEY_CARRIER_PROVISIONING_APP_STRING, "");
        sDefaults.putBoolean(KEY_DISPLAY_NO_DATA_NOTIFICATION_ON_PERMANENT_FAILURE_BOOL, false);
        sDefaults.putBoolean(KEY_UNTHROTTLE_DATA_RETRY_WHEN_TAC_CHANGES_BOOL, false);
        sDefaults.putBoolean(KEY_VONR_SETTING_VISIBILITY_BOOL, false);
    }

    /**
+94 −0
Original line number Diff line number Diff line
@@ -12147,6 +12147,100 @@ public class TelephonyManager {
        }
    }
    /**
     * No error. Operation succeeded.
     * @hide
     */
    public static final int ENABLE_VONR_SUCCESS = 0;
    /**
     * Radio is not available.
     * @hide
     */
    public static final int ENABLE_VONR_RADIO_NOT_AVAILABLE = 2;
    /**
     * Internal Radio error.
     * @hide
     */
    public static final int ENABLE_VONR_RADIO_ERROR = 3;
    /**
     * Voice over NR enable/disable request is received when system is in invalid state.
     * @hide
     */
    public static final int ENABLE_VONR_RADIO_INVALID_STATE = 4;
    /**
     * Voice over NR enable/disable request is not supported.
     * @hide
     */
    public static final int ENABLE_VONR_REQUEST_NOT_SUPPORTED = 5;
    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = {"EnableVoNrResult"}, value = {
            ENABLE_VONR_SUCCESS,
            ENABLE_VONR_RADIO_NOT_AVAILABLE,
            ENABLE_VONR_RADIO_ERROR,
            ENABLE_VONR_RADIO_INVALID_STATE,
            ENABLE_VONR_REQUEST_NOT_SUPPORTED})
    public @interface EnableVoNrResult {}
    /**
     * Enable or disable Voice over NR (VoNR)
     *
     * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
     * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultDataSubscriptionId()}
     *
     * <p>Requires Permission:
     * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}.
     *
     * @param enabled  enable or disable VoNR.
     * @throws IllegalStateException if the Telephony process is not currently available.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public @EnableVoNrResult int setVoNrEnabled(boolean enabled) {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.setVoNrEnabled(
                        getSubId(SubscriptionManager.getDefaultDataSubscriptionId()), enabled);
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#setVoNrEnabled", e);
        }
        return ENABLE_VONR_RADIO_INVALID_STATE;
    }
    /**
     * Is Voice over NR (VoNR) enabled.
     * @return true if Voice over NR (VoNR) is enabled else false. Enabled state does not mean
     *  voice call over NR is active or voice ove NR is available. It means the device is allowed to
     *  register IMS over NR.
     * @throws IllegalStateException if the Telephony process is not currently available.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public boolean isVoNrEnabled() {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.isVoNrEnabled(getSubId());
            } else {
                throw new IllegalStateException("telephony service is null.");
            }
        } catch (RemoteException ex) {
            Rlog.e(TAG, "isVoNrEnabled RemoteException", ex);
            ex.rethrowFromSystemServer();
        }
        return false;
    }
    /**
     * Carrier action to start or stop reporting default network available events.
     *
+14 −0
Original line number Diff line number Diff line
@@ -2223,6 +2223,20 @@ interface ITelephony {
     */
    List<String> getEquivalentHomePlmns(int subId, String callingPackage, String callingFeatureId);

    /**
     * Enable or disable Voice over NR (VoNR)
     * @param subId the subscription ID that this action applies to.
     * @param enabled enable or disable VoNR.
     * @return operation result.
     */
    int setVoNrEnabled(int subId, boolean enabled);

    /**
     * Is voice over NR enabled
     * @return true if VoNR is enabled else false
     */
    boolean isVoNrEnabled(int subId);

    /**
     * Enable/Disable E-UTRA-NR Dual Connectivity
     * @return operation result. See TelephonyManager.EnableNrDualConnectivityResult for
+2 −0
Original line number Diff line number Diff line
@@ -528,6 +528,8 @@ public interface RILConstants {
    int RIL_REQUEST_SET_ALLOWED_NETWORK_TYPES_BITMAP = 222;
    int RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP = 223;
    int RIL_REQUEST_GET_SLICING_CONFIG = 224;
    int RIL_REQUEST_ENABLE_VONR = 225;
    int RIL_REQUEST_IS_VONR_ENABLED = 225;

    /* Responses begin */
    int RIL_RESPONSE_ACKNOWLEDGEMENT = 800;