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

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

Suppress Registration Errors when WFC disabled

There is still the possibility of IMS registration
failing for a time after the user has disabled WFC.
This causes registration error messages
to keep popping up. This change suppresses
those notifications when the WFC setting is off.

Bug: 64412124
Test: Manual
Change-Id: I5c0b4531655bed57e5a8efe0ebffe13a027e597f
parent e513467a
Loading
Loading
Loading
Loading
+89 −81
Original line number Diff line number Diff line
@@ -1576,7 +1576,16 @@ public class ImsPhone extends ImsPhoneBase {
    public void processDisconnectReason(ImsReasonInfo imsReasonInfo) {
        if (imsReasonInfo.mCode == imsReasonInfo.CODE_REGISTRATION_ERROR
                && imsReasonInfo.mExtraMessage != null) {
            // Suppress WFC Registration notifications if WFC is not enabled by the user.
            if (ImsManager.isWfcEnabledByUser(mContext)) {
                processWfcDisconnectForNotification(imsReasonInfo);
            }
        }
    }

    // Processes an IMS disconnect cause for possible WFC registration errors and optionally
    // disable WFC.
    private void processWfcDisconnectForNotification(ImsReasonInfo imsReasonInfo) {
        CarrierConfigManager configManager =
                (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager == null) {
@@ -1634,9 +1643,9 @@ public class ImsPhone extends ImsPhoneBase {
                    com.android.internal.R.string.wfcRegErrorTitle);

            int idx = Integer.parseInt(codes[1]);
                if (idx < 0 ||
                        idx >= wfcOperatorErrorAlertMessages.length ||
                        idx >= wfcOperatorErrorNotificationMessages.length) {
            if (idx < 0
                    || idx >= wfcOperatorErrorAlertMessages.length
                    || idx >= wfcOperatorErrorNotificationMessages.length) {
                Rlog.e(LOG_TAG, "Invalid index: " + wfcOperatorErrorCodes[i]);
                continue;
            }
@@ -1670,7 +1679,6 @@ public class ImsPhone extends ImsPhoneBase {
            break;
        }
    }
    }

    @Override
    public boolean isUtEnabled() {