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

Commit d1430abd authored by Sarah Chin's avatar Sarah Chin
Browse files

Set CDMA roaming/subscription mode throws ISE if not CDMA

Since the phone can switch to/from CDMA, returning when not CDMA could
cause issues later on. This essentially reverts ag/13862397 and updates
the documentation to call out more clearly when ISE is thrown.

Test: make
Fix: 175665470
Change-Id: Ie6ab0fd4b317d66a74a7c667a0ed6a54ee56c150
parent ac6f5ee9
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -10094,14 +10094,15 @@ public class TelephonyManager {
    /**
     * Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not
     * CDMA capable, this method does nothing.
     * CDMA capable, this method throws an IllegalStateException.
     *
     * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
     * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
     *
     * @param mode CDMA roaming mode.
     * @throws SecurityException if the caller does not have the permission.
     * @throws IllegalStateException if the Telephony process or radio is not currently available.
     * @throws IllegalStateException if the Telephony process or radio is not currently available,
     *         the device is not CDMA capable, or the request fails.
     *
     * @see #CDMA_ROAMING_MODE_RADIO_DEFAULT
     * @see #CDMA_ROAMING_MODE_HOME
@@ -10117,7 +10118,9 @@ public class TelephonyManager {
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public void setCdmaRoamingMode(@CdmaRoamingMode int mode) {
        if (getPhoneType() != PHONE_TYPE_CDMA) return;
        if (getPhoneType() != PHONE_TYPE_CDMA) {
            throw new IllegalStateException("Phone does not support CDMA.");
        }
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
@@ -10199,11 +10202,12 @@ public class TelephonyManager {
    /**
     * Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not
     * CDMA capable, this method does nothing.
     * CDMA capable, this method throws an IllegalStateException.
     *
     * @param mode CDMA subscription mode.
     * @throws SecurityException if the caller does not have the permission.
     * @throws IllegalStateException if the Telephony process is not currently available.
     * @throws IllegalStateException if the Telephony process or radio is not currently available,
     *         the device is not CDMA capable, or the request fails.
     *
     * @see #CDMA_SUBSCRIPTION_UNKNOWN
     * @see #CDMA_SUBSCRIPTION_RUIM_SIM
@@ -10218,7 +10222,9 @@ public class TelephonyManager {
    @SystemApi
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public void setCdmaSubscriptionMode(@CdmaSubscription int mode) {
        if (getPhoneType() != PHONE_TYPE_CDMA) return;
        if (getPhoneType() != PHONE_TYPE_CDMA) {
            throw new IllegalStateException("Phone does not support CDMA.");
        }
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {