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

Commit f50dba86 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Notify CDMA call Settings when CDMA USSD codes are unavailable

When getting CDMA Supplementary Service information, throw an
Exception if SS over CDMA is disabled, which will cause an error
to be shown to the user and the setting moved to disabled.

This is to support the case where SS over UT is available and becomes
unavailable while the user is interacting with these settings, but
there is no CDMA fallback available. Throwing an exception will
cause the UI to gray out settings that are now unavailable.

Bug: 191057045
Test: manual
Change-Id: I7c6356286a79e55b362afcdc40f157d61e55d29a
parent 721817ed
Loading
Loading
Loading
Loading
+38 −6
Original line number Diff line number Diff line
@@ -257,6 +257,7 @@ public class GsmCdmaPhone extends Phone {
    private IccSmsInterfaceManager mIccSmsInterfaceManager;

    private boolean mResetModemOnRadioTechnologyChange = false;
    private boolean mSsOverCdmaSupported = false;

    private int mRilVersion;
    private boolean mBroadcastEmergencyCallStateChanges = false;
@@ -2200,6 +2201,11 @@ public class GsmCdmaPhone extends Phone {
        return false;
    }

    private void updateSsOverCdmaSupported(PersistableBundle b) {
        if (b == null) return;
        mSsOverCdmaSupported = b.getBoolean(CarrierConfigManager.KEY_SUPPORT_SS_OVER_CDMA_BOOL);
    }

    @Override
    public boolean useSsOverIms(Message onComplete) {
        boolean isUtEnabled = isUtEnabled();
@@ -2239,9 +2245,17 @@ public class GsmCdmaPhone extends Phone {
                }
                mCi.queryCallForwardStatus(commandInterfaceCFReason, serviceClass, null, resp);
            }
        } else {
            if (!mSsOverCdmaSupported) {
                // If SS over CDMA is not supported and UT is not at the time, notify the user of
                // the error and disable the option.
                AsyncResult.forMessage(onComplete, null,
                        new CommandException(CommandException.Error.INVALID_STATE,
                                "Call Forwarding over CDMA unavailable"));
            } else {
                loge("getCallForwardingOption: not possible in CDMA, just return empty result");
                AsyncResult.forMessage(onComplete, makeEmptyCallForward(), null);
            }
            onComplete.sendToTarget();
        }
    }
@@ -2289,7 +2303,7 @@ public class GsmCdmaPhone extends Phone {
                        timerSeconds,
                        resp);
            }
        } else {
        } else if (mSsOverCdmaSupported) {
            String formatNumber = GsmCdmaConnection.formatDialString(dialingNumber);
            String cfNumber = CdmaMmiCode.getCallForwardingPrefixAndNumber(
                    commandInterfaceCFAction, commandInterfaceCFReason, formatNumber);
@@ -2306,6 +2320,10 @@ public class GsmCdmaPhone extends Phone {

            AsyncResult.forMessage(onComplete, CommandsInterface.SS_STATUS_UNKNOWN, null);
            onComplete.sendToTarget();
        } else {
            loge("setCallForwardingOption: SS over CDMA not supported, can not complete");
            AsyncResult.forMessage(onComplete, CommandsInterface.SS_STATUS_UNKNOWN, null);
            onComplete.sendToTarget();
        }
    }

@@ -2429,8 +2447,17 @@ public class GsmCdmaPhone extends Phone {
            //class parameter in call waiting interrogation  to network
            mCi.queryCallWaiting(CommandsInterface.SERVICE_CLASS_NONE, onComplete);
        } else {
            int arr[] = {CommandsInterface.SS_STATUS_UNKNOWN, CommandsInterface.SERVICE_CLASS_NONE};
            if (!mSsOverCdmaSupported) {
                // If SS over CDMA is not supported and UT is not at the time, notify the user of
                // the error and disable the option.
                AsyncResult.forMessage(onComplete, null,
                        new CommandException(CommandException.Error.INVALID_STATE,
                                "Call Waiting over CDMA unavailable"));
            } else {
                int[] arr =
                        {CommandsInterface.SS_STATUS_UNKNOWN, CommandsInterface.SERVICE_CLASS_NONE};
                AsyncResult.forMessage(onComplete, arr, null);
            }
            onComplete.sendToTarget();
        }
    }
@@ -2458,7 +2485,7 @@ public class GsmCdmaPhone extends Phone {

        if (isPhoneTypeGsm()) {
            mCi.setCallWaiting(enable, serviceClass, onComplete);
        } else {
        } else if (mSsOverCdmaSupported) {
            String cwPrefix = CdmaMmiCode.getCallWaitingPrefix(enable);
            Rlog.i(LOG_TAG, "setCallWaiting in CDMA : dial for set call waiting" + " prefix= " + cwPrefix);

@@ -2472,6 +2499,10 @@ public class GsmCdmaPhone extends Phone {

            AsyncResult.forMessage(onComplete, CommandsInterface.SS_STATUS_UNKNOWN, null);
            onComplete.sendToTarget();
        } else {
            loge("setCallWaiting: SS over CDMA not supported, can not complete");
            AsyncResult.forMessage(onComplete, CommandsInterface.SS_STATUS_UNKNOWN, null);
            onComplete.sendToTarget();
        }
    }

@@ -2924,6 +2955,7 @@ public class GsmCdmaPhone extends Phone {
                updateCdmaRoamingSettingsAfterCarrierConfigChanged(b);

                updateNrSettingsAfterCarrierConfigChanged(b);
                updateSsOverCdmaSupported(b);
                loadAllowedNetworksFromSubscriptionDatabase();
                // Obtain new radio capabilities from the modem, since some are SIM-dependent
                mCi.getRadioCapability(obtainMessage(EVENT_GET_RADIO_CAPABILITY));