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

Commit 3b95b44b authored by Sandeep Gutta's avatar Sandeep Gutta Committed by Luca Stefani
Browse files

MSIM: Dummy subId related changes

Replace isActiveSubId() in some places where isValidSubscriptionId()
method used, this change is to filter out DUMMY subId value

Change access modifier of below method and enum to protected
 - handleSimLoaded()
 - EVENT_SIM_LOCKED_QUERY_ICCID_DONE

Change-Id: I768d6de927fc49a6cc5c06f2102b8688e6191c57
CRs-Fixed: 1034971

MSIM: Change access modifier of handleSimLoaded

Change access modifier of handleSimLoaded()

Change-Id: Ie676caf2fc4de5cbc1cc500d0bea104f6a264f11
CRs-Fixed: 1033865
parent 82d9ea50
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1279,7 +1279,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    private void updateSavedNetworkOperator(NetworkSelectMessage nsm) {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {
            // open the shared preferences editor, and write the value.
            // nsm.operatorNumeric is "" if we're in automatic.selection.
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
@@ -1754,7 +1754,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private int getCallForwardingIndicatorFromSharedPref() {
        int status = IccRecords.CALL_FORWARDING_STATUS_DISABLED;
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
            status = sp.getInt(CF_STATUS + subId, IccRecords.CALL_FORWARDING_STATUS_UNKNOWN);
            Rlog.d(LOG_TAG, "getCallForwardingIndicatorFromSharedPref: for subId " + subId + "= " +
@@ -2275,7 +2275,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    public void setVoiceMessageCount(int countWaiting) {
        mVmCount = countWaiting;
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {

            Rlog.d(LOG_TAG, "setVoiceMessageCount: Storing Voice Mail Count = " + countWaiting +
                    " for mVmCountKey = " + VM_COUNT + subId + " in preferences.");
@@ -2295,7 +2295,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected int getStoredVoiceMessageCount() {
        int countVoiceMessages = 0;
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionController.getInstance().isActiveSubId(subId)) {
            int invalidCount = -2;  //-1 is not really invalid. It is used for unknown number of vm
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
            int countFromSP = sp.getInt(VM_COUNT + subId, invalidCount);
@@ -3331,7 +3331,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    protected void setPreferredNetworkTypeIfSimLoaded() {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
        if (SubscriptionManager.from(mContext).isActiveSubId(subId)) {
            int type = PhoneFactory.calculatePreferredNetworkType(mContext, getSubId());
            setPreferredNetworkType(type, null);
        }
+1 −1
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ public class ServiceStateTracker extends Handler {
            // Set the network type, in case the radio does not restore it.
            int subId = mPhone.getSubId();
            if (mPreviousSubId.getAndSet(subId) != subId) {
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                if (mSubscriptionController.isActiveSubId(subId)) {
                    Context context = mPhone.getContext();

                    mPhone.notifyPhoneStateChanged();
+1 −1
Original line number Diff line number Diff line
@@ -977,7 +977,7 @@ public class SubscriptionController extends ISub.Stub {

                            // Set the default sub if not set or if single sim device
                            if (!SubscriptionManager.isValidSubscriptionId(defaultSubId)
                                    || subIdCountMax == 1) {
                                    || (subIdCountMax == 1) || (!isActiveSubId(defaultSubId))) {
                                setDefaultFallbackSubId(subId);
                            }
                            // If single sim device, set this subscription as the default for everything
+4 −4
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public class SubscriptionInfoUpdater extends Handler {
    private static final String LOG_TAG = "SubscriptionInfoUpdater";
    private static final int PROJECT_SIM_NUM = TelephonyManager.getDefault().getPhoneCount();

    private static final int EVENT_SIM_LOCKED_QUERY_ICCID_DONE = 1;
    protected static final int EVENT_SIM_LOCKED_QUERY_ICCID_DONE = 1;
    private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 2;
    private static final int EVENT_SIM_LOADED = 3;
    private static final int EVENT_SIM_ABSENT = 4;
@@ -350,7 +350,7 @@ public class SubscriptionInfoUpdater extends Handler {
        sendMessage(obtainMessage(EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS, callback));
    }

    private static class QueryIccIdUserObj {
    protected static class QueryIccIdUserObj {
        public String reason;
        public int slotId;

@@ -360,7 +360,7 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    };

    private void handleSimLocked(int slotId, String reason) {
    protected void handleSimLocked(int slotId, String reason) {
        if (mIccId[slotId] != null && mIccId[slotId].equals(ICCID_STRING_FOR_NO_SIM)) {
            logd("SIM" + (slotId + 1) + " hot plug in");
            mIccId[slotId] = null;
@@ -387,7 +387,7 @@ public class SubscriptionInfoUpdater extends Handler {
        }
    }

    private void handleSimLoaded(int slotId) {
    protected void handleSimLoaded(int slotId) {
        logd("handleSimLoaded: slotId: " + slotId);

        // The SIM should be loaded at this state, but it is possible in cases such as SIM being
+5 −5
Original line number Diff line number Diff line
@@ -309,11 +309,11 @@ public class DcTracker extends Handler {
                    if (DBG) log("SubscriptionListener.onSubscriptionInfoChanged");
                    // Set the network type, in case the radio does not restore it.
                    int subId = mPhone.getSubId();
                    if (SubscriptionManager.isValidSubscriptionId(subId)) {
                    if (mSubscriptionManager.isActiveSubId(subId)) {
                        registerSettingsObserver();
                    }
                    if (mPreviousSubId.getAndSet(subId) != subId &&
                            SubscriptionManager.isValidSubscriptionId(subId)) {
                            mSubscriptionManager.isActiveSubId(subId)) {
                        onRecordsLoadedOrSubIdChanged();
                    }
                }
@@ -396,7 +396,7 @@ public class DcTracker extends Handler {

        // Stop reconnect if not current subId is not correct.
        // FIXME STOPSHIP - phoneSubId is coming up as -1 way after boot and failing this?
        if (!SubscriptionManager.isValidSubscriptionId(currSubId) || (currSubId != phoneSubId)) {
        if (!mSubscriptionManager.isActiveSubId(currSubId) || (currSubId != phoneSubId)) {
            log("receive ReconnectAlarm but subId incorrect, ignore");
            return;
        }
@@ -3658,7 +3658,7 @@ public class DcTracker extends Handler {
                // If onRecordsLoadedOrSubIdChanged() is not called here, it should be called on
                // onSubscriptionsChanged() when a valid subId is available.
                int subId = mPhone.getSubId();
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                if (mSubscriptionManager.isActiveSubId(subId)) {
                    onRecordsLoadedOrSubIdChanged();
                } else {
                    log("Ignoring EVENT_RECORDS_LOADED as subId is not valid: " + subId);
@@ -4064,7 +4064,7 @@ public class DcTracker extends Handler {
                mIccRecords.set(null);
            }
            if (newIccRecords != null) {
                if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) {
                if (mSubscriptionManager.isActiveSubId(mPhone.getSubId())) {
                    log("New records found.");
                    mIccRecords.set(newIccRecords);
                    newIccRecords.registerForRecordsLoaded(