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

Commit bd4bb4f2 authored by Libin.Tang@motorola.com's avatar Libin.Tang@motorola.com Committed by Amit Mahajan
Browse files

IMS: add the api to get IMS registration information.

Bug: 18668325
Change-Id: Id5b0ed420990bde44b3525c7ec22eb37827d649c
parent e2742778
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1962,4 +1962,11 @@ public interface Phone {
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForRadioCapabilityChanged(Handler h);

    /**
     * Query the IMS Registration Status.
     *
     * @return true if IMS is Registered
     */
    public boolean isImsRegistered();
}
+19 −0
Original line number Diff line number Diff line
@@ -2055,6 +2055,25 @@ public abstract class PhoneBase extends Handler implements Phone {
                Integer.toString(SID));
    }

    /**
     * Get IMS Registration Status
     */
    @Override
    public boolean isImsRegistered() {
        ImsPhone imsPhone = mImsPhone;
        boolean isImsRegistered = false;
        if (imsPhone != null) {
            isImsRegistered = imsPhone.isImsRegistered();
        } else {
            ServiceStateTracker sst = getServiceStateTracker();
            if (sst != null) {
                isImsRegistered = sst.isImsRegistered();
            }
        }
        Rlog.d(LOG_TAG, "isImsRegistered =" + isImsRegistered);
        return isImsRegistered;
    }

    private boolean getRoamingOverrideHelper(String prefix, String key) {
        String iccId = getIccSerialNumber();
        if (TextUtils.isEmpty(iccId) || TextUtils.isEmpty(key)) {
+5 −0
Original line number Diff line number Diff line
@@ -1502,6 +1502,11 @@ public class PhoneProxy extends Handler implements Phone {
    public IccCardProxy getPhoneIccCardProxy() {
        return mIccCardProxy;
    }

    public boolean isImsRegistered() {
        return mActivePhone.isImsRegistered();
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        try {
            ((PhoneBase)mActivePhone).dump(fd, pw, args);
+19 −0
Original line number Diff line number Diff line
@@ -174,6 +174,8 @@ public abstract class ServiceStateTracker extends Handler {
    protected static final int EVENT_GET_CELL_INFO_LIST                = 43;
    protected static final int EVENT_UNSOL_CELL_INFO_LIST              = 44;
    protected static final int EVENT_CHANGE_IMS_STATE                  = 45;
    protected static final int EVENT_IMS_STATE_CHANGED                 = 46;
    protected static final int EVENT_IMS_STATE_DONE                    = 47;

    protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone";

@@ -222,6 +224,7 @@ public abstract class ServiceStateTracker extends Handler {
    protected static final String ACTION_RADIO_OFF = "android.intent.action.ACTION_RADIO_OFF";
    protected boolean mPowerOffDelayNeed = true;
    protected boolean mDeviceShuttingDown = false;
    private boolean mImsRegistered = false;

    protected SubscriptionManager mSubscriptionManager;
    protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
@@ -293,6 +296,7 @@ public abstract class ServiceStateTracker extends Handler {

        mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
            ServiceState.rilRadioTechnologyToString(ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN));
        mCi.registerForImsNetworkStateChanged(this, EVENT_IMS_STATE_CHANGED, null);
    }

    void requestShutdown() {
@@ -579,6 +583,18 @@ public abstract class ServiceStateTracker extends Handler {
                break;
            }

            case  EVENT_IMS_STATE_CHANGED: // received unsol
                mCi.getImsRegistrationState(this.obtainMessage(EVENT_IMS_STATE_DONE));
                break;

            case EVENT_IMS_STATE_DONE:
                AsyncResult ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
                    int[] responseArray = (int[])ar.result;
                    mImsRegistered = (responseArray[0] == 1) ? true : false;
                }
                break;

            default:
                log("Unhandled message with number: " + msg.what);
                break;
@@ -941,6 +957,9 @@ public abstract class ServiceStateTracker extends Handler {
        pw.flush();
    }

    public boolean isImsRegistered() {
        return mImsRegistered;
    }
    /**
     * Verifies the current thread is the same as the thread originally
     * used in the initialization of this instance. Throws RuntimeException
+8 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ public class ImsPhone extends ImsPhoneBase {

    private final RegistrantList mSilentRedialRegistrants = new RegistrantList();

    private boolean mImsRegistered = false;
    // A runnable which is used to automatically exit from Ecm after a period of time.
    private Runnable mExitEcmRunnable = new Runnable() {
        @Override
@@ -1244,4 +1245,11 @@ public class ImsPhone extends ImsPhoneBase {
    public Phone getDefaultPhone() {
        return mDefaultPhone;
    }

    public boolean isImsRegistered() {
        return mImsRegistered;
    }
    public void setImsRegistered(boolean value) {
        mImsRegistered = value;
    }
}
Loading