Search code examples
androidandroid-sourcetelephonymanagerandroid-5.1.1-lollipopdual-sim

SubscriptionInfo.getMnc() returns the same value for both the SIMs with different carriers


I was trying to get the MCC and MNC number (basically I want the IMSI number but these will also suffice) in Android 5.1 device having dual Sim (both active). As 5.1 supports dual Sim so I used the Subscription manager like this:

SubscriptionManager manager = SubscriptionManager.from(this);
List<SubscriptionInfo> sil = manager.getActiveSubscriptionInfoList();
    if (sil != null) {
        for (SubscriptionInfo subInfo : sil) {
            Log.v("TestMain", "SubInfo:" + subInfo);
        }
    } else {
        Log.v("TestMain", "SubInfo: list is null");
    }

and got the this output:

07-24 18:28:32.162    3844-3844/? V/TestMain﹕ SubInfo:{id=1, mcc 405 mnc 803, iccId=89918030914128062059 simSlotIndex=0 displayName=Aircel Karnataka carrierName=Aircel — Aircel Karnataka nameSource=0}
07-24 18:28:32.162    3844-3844/? V/TestMain﹕ SubInfo:{id=2,  mcc 405 mnc 803, iccId=8991860044481968955 simSlotIndex=1 displayName=CARD 2 carrierName=Vodafone Karnataka nameSource=0}

MCC(will be same as it the same country) notice that MNC are same though the carriers are different.

While I was switching off the phone I saw this lines in my logcat:

07-24 18:31:02.295      616-616/? V/KeyguardUpdateMonitor﹕ SubInfo:{id=1,  mcc 405 mnc 803, iccId=89918030914128062059 simSlotIndex=0 displayName=CARD 1 carrierName=Emergency calls only — Aircel Karnataka nameSource=0}
07-24 18:31:02.295      616-616/? V/KeyguardUpdateMonitor﹕ SubInfo:{id=2,  mcc 404 mnc 86, iccId=8991860044481968955 simSlotIndex=1 displayName=CARD 2 carrierName=Emergency calls only — Vodafone Karnataka nameSource=0}

As you can see the keyguard application gets the MNC right for both the sim.

So I explored the code of the keyguard application and found that the code is same as I was using Code from Android Source taken from here:

protected void handleSimSubscriptionInfoChanged() {
        if (DEBUG_SIM_STATES) {
            Log.v(TAG, "onSubscriptionInfoChanged()");
            List<SubscriptionInfo> sil = mSubscriptionManager.getActiveSubscriptionInfoList();
            if (sil != null) {
                for (SubscriptionInfo subInfo : sil) {
                    Log.v(TAG, "SubInfo:" + subInfo);
                }
            } else {
                Log.v(TAG, "onSubscriptionInfoChanged: list is null");
            }
        }

I explored some more and found that even the keyguard applications gets MCC right only when the phone is switching off, other times even it is getting the same MNC for both the SIMs. But the carrier name is distinct always.

Is this a bug in Android 5.1 or am I doing something wrong?


Solution

  • This was a bug in android 5.1, it got fixed after I updated the phone