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

Commit 1d8f87c5 authored by Nathan Harold's avatar Nathan Harold
Browse files

Expose Registration Failures in PhoneStateListener

Add a new command from RIL to TelephonyRegistry to report
registration failures whenever they occur.

Bug: 143187047
Test: wip
Change-Id: Ic10d798b1334fa3ce6742a25662b0148c62321d6
parent a474dc25
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ public abstract class BaseCommands implements CommandsInterface {
    protected Registrant mCatCcAlphaRegistrant;
    @UnsupportedAppUsage
    protected Registrant mSsRegistrant;
    protected Registrant mRegistrationFailedRegistrant;

    // Preferred network type received from PhoneFactory.
    // This is used when establishing a connection to the
@@ -559,6 +560,16 @@ public abstract class BaseCommands implements CommandsInterface {
        mCatCcAlphaRegistrant.clear();
    }

    @Override
    public void setOnRegistrationFailed(Handler h, int what, Object obj) {
        mRegistrationFailedRegistrant = new Registrant(h, what, obj);
    }

    @Override
    public void unSetOnRegistrationFailed(Handler h) {
        mRegistrationFailedRegistrant.clear();
    }

    @Override
    public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj) {
        mVoicePrivacyOnRegistrants.addUnique(h, what, obj);
+14 −0
Original line number Diff line number Diff line
@@ -481,6 +481,20 @@ public interface CommandsInterface {
    void setOnSs(Handler h, int what, Object obj);
    void unSetOnSs(Handler h);

    /**
     * Register for unsolicited NATT Keepalive Status Indications
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void setOnRegistrationFailed(Handler h, int what, Object obj) {}

    /**
     * @param h Handler for notification message.
     */
    default void unSetOnRegistrationFailed(Handler h) {}

    /**
     * Sets the handler for Event Notifications for CDMA Display Info.
     * Unlike the register* methods, there's only one notification handler
+7 −0
Original line number Diff line number Diff line
@@ -258,6 +258,13 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
            callQuality, callNetworkType);
    }

    @Override
    public void notifyRegistrationFailed(Phone sender, @NonNull CellIdentity cellIdentity,
            @NonNull String chosenPlmn, int domain, int causeCode, int additionalCauseCode) {
        mTelephonyRegistryMgr.notifyRegistrationFailed(sender.getPhoneId(), sender.getSubId(),
                cellIdentity, chosenPlmn, domain, causeCode, additionalCauseCode);
    }

    /**
     * Convert the {@link DataActivityState} enum into the TelephonyManager.DATA_* constants for the
     * public API.
+9 −0
Original line number Diff line number Diff line
@@ -332,6 +332,7 @@ public class GsmCdmaPhone extends Phone {
        mCi.registerUiccApplicationEnablementChanged(this, EVENT_UICC_APPS_ENABLEMENT_CHANGED,
                null);
        mCi.setOnSuppServiceNotification(this, EVENT_SSN, null);
        mCi.setOnRegistrationFailed(this, EVENT_REGISTRATION_FAILED, null);

        //GSM
        mCi.setOnUSSD(this, EVENT_USSD, null);
@@ -2758,6 +2759,14 @@ public class GsmCdmaPhone extends Phone {
                }
                break;

            case EVENT_REGISTRATION_FAILED:
                logd("Event RegistrationFailed Received");
                ar = (AsyncResult) msg.obj;
                RegistrationFailedEvent rfe = (RegistrationFailedEvent) ar.result;
                mNotifier.notifyRegistrationFailed(this, rfe.cellIdentity, rfe.chosenPlmn,
                        rfe.domain, rfe.causeCode, rfe.additionalCauseCode);
                break;

            case EVENT_SET_CALL_FORWARD_DONE:
                ar = (AsyncResult)msg.obj;
                IccRecords r = mIccRecords.get();
+2 −1
Original line number Diff line number Diff line
@@ -204,8 +204,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_UICC_APPS_ENABLEMENT_CHANGED   = 53;
    protected static final int EVENT_GET_UICC_APPS_ENABLEMENT_DONE  = 54;
    protected static final int EVENT_REAPPLY_UICC_APPS_ENABLEMENT_DONE = 55;
    protected static final int EVENT_REGISTRATION_FAILED = 56;

    protected static final int EVENT_LAST = EVENT_ALL_DATA_DISCONNECTED;
    protected static final int EVENT_LAST = EVENT_REGISTRATION_FAILED;

    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
Loading