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

Commit 44fd6f60 authored by Naveen Kalla's avatar Naveen Kalla
Browse files

Exit Emergency callback mode if modem resets

If the modem resets when the phone is in Emergency
callback mode, exit emergency callback mode.

Bug: 62255356
Test: New unit test "testModemResetInEmergencyCallbackMessages"
      in GsmPhoneTest under telephonytests
Change-Id: I3030b59292252e4c0a6c91603f52084cee59d885
parent ca542f90
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mPcoDataRegistrants = new RegistrantList();
    protected RegistrantList mCarrierInfoForImsiEncryptionRegistrants = new RegistrantList();
    protected RegistrantList mRilNetworkScanResultRegistrants = new RegistrantList();
    protected RegistrantList mModemResetRegistrants = new RegistrantList();


    protected Registrant mGsmSmsRegistrant;
@@ -909,6 +910,16 @@ public abstract class BaseCommands implements CommandsInterface {
      }
    }

    @Override
    public void registerForModemReset(Handler h, int what, Object obj) {
        mModemResetRegistrants.add(new Registrant(h, what, obj));
    }

    @Override
    public void unregisterForModemReset(Handler h) {
        mModemResetRegistrants.remove(h);
    }

    @Override
    public void registerForPcoData(Handler h, int what, Object obj) {
        mPcoDataRegistrants.add(new Registrant(h, what, obj));
+16 −0
Original line number Diff line number Diff line
@@ -2076,6 +2076,22 @@ public interface CommandsInterface {
     */
    public void unregisterForPcoData(Handler h);

    /**
     * Register for modem reset indication.
     *
     * @param h  Handler for the notification message
     * @param what User-defined message code
     * @param obj User object
     */
    void registerForModemReset(Handler h, int what, Object obj);

    /**
     * Unregister for modem reset
     *
     * @param h handler to be removed
     */
    void unregisterForModemReset(Handler h);

    /**
     * Send the updated device state
     *
+16 −0
Original line number Diff line number Diff line
@@ -253,6 +253,7 @@ public class GsmCdmaPhone extends Phone {
        mCi.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);
        mCi.registerForExitEmergencyCallbackMode(this, EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE,
                null);
        mCi.registerForModemReset(this, EVENT_MODEM_RESET, null);
        // get the string that specifies the carrier OTA Sp number
        mCarrierOtaSpNumSchema = TelephonyManager.from(mContext).getOtaSpNumberSchemaForPhone(
                getPhoneId(), "");
@@ -2136,6 +2137,21 @@ public class GsmCdmaPhone extends Phone {
            }
            break;

            case EVENT_MODEM_RESET: {
                logd("Event EVENT_MODEM_RESET Received" + " isInEcm = " + isInEcm()
                        + " isPhoneTypeGsm = " + isPhoneTypeGsm() + " mImsPhone = " + mImsPhone);
                if (isInEcm()) {
                    if (isPhoneTypeGsm()) {
                        if (mImsPhone != null) {
                            mImsPhone.handleExitEmergencyCallbackMode();
                        }
                    } else {
                        handleExitEmergencyCallbackMode(msg);
                    }
                }
            }
            break;

            case EVENT_RUIM_RECORDS_LOADED:
                logd("Event EVENT_RUIM_RECORDS_LOADED Received");
                updateCurrentCarrierInProvider();
+8 −1
Original line number Diff line number Diff line
@@ -194,8 +194,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_CARRIER_CONFIG_CHANGED         = 43;
    // Carrier's CDMA prefer mode setting
    protected static final int EVENT_SET_ROAMING_PREFERENCE_DONE    = 44;
    protected static final int EVENT_MODEM_RESET                    = 45;

    protected static final int EVENT_LAST                       = EVENT_SET_ROAMING_PREFERENCE_DONE;
    protected static final int EVENT_LAST                       = EVENT_MODEM_RESET;

    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
@@ -219,6 +220,12 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    // Key used to read/write "disable DNS server check" pref (used for testing)
    private static final String DNS_SERVER_CHECK_DISABLED_KEY = "dns_server_check_disabled_key";

    /**
     * This method is invoked when the Phone exits Emergency Callback Mode.
     */
    protected void handleExitEmergencyCallbackMode() {
    }

    /**
     * Small container class used to hold information relevant to
     * the carrier selection process. operatorNumeric can be ""
+1 −0
Original line number Diff line number Diff line
@@ -787,6 +787,7 @@ public class RadioIndication extends IRadioIndication.Stub {
        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_MODEM_RESTART, reason);

        mRil.writeMetricsModemRestartEvent(reason);
        mRil.mModemResetRegistrants.notifyRegistrants(new AsyncResult(null, reason, null));
    }

    /**
Loading