Loading src/java/com/android/internal/telephony/GsmCdmaPhone.java +10 −0 Original line number Diff line number Diff line Loading @@ -744,6 +744,16 @@ public class GsmCdmaPhone extends Phone { return (r != null) ? r.getIccId() : null; } @Override public String getFullIccSerialNumber() { IccRecords r = mIccRecords.get(); if (!isPhoneTypeGsm() && r == null) { // to get ICCID form SIMRecords because it is on MF. r = mUiccController.getIccRecords(mPhoneId, UiccController.APP_FAM_3GPP); } return (r != null) ? r.getFullIccId() : null; } @Override public boolean canConference() { if (mImsPhone != null && mImsPhone.canConference()) { Loading src/java/com/android/internal/telephony/Phone.java +10 −1 Original line number Diff line number Diff line Loading @@ -1535,13 +1535,22 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Retrieves the serial number of the ICC, if applicable. * Retrieves the serial number of the ICC, if applicable. Returns only the decimal digits before * the first hex digit in the ICC ID. */ public String getIccSerialNumber() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getIccId() : null; } /** * Retrieves the full serial number of the ICC (including hex digits), if applicable. */ public String getFullIccSerialNumber() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getFullIccId() : null; } /** * Returns SIM record load state. Use * <code>getSimCard().registerForReady()</code> for change notification. Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +1 −1 Original line number Diff line number Diff line Loading @@ -256,7 +256,7 @@ public class SubscriptionInfoUpdater extends Handler { if (ar.exception == null) { if (ar.result != null) { byte[] data = (byte[])ar.result; mIccId[slotId] = IccUtils.bcdToString(data, 0, data.length); mIccId[slotId] = IccUtils.bchToString(data, 0, data.length); } else { logd("Null ar"); mIccId[slotId] = ICCID_STRING_FOR_NO_SIM; Loading src/java/com/android/internal/telephony/uicc/IccRecords.java +19 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.os.Message; import android.os.Registrant; import android.os.RegistrantList; import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.telephony.SubscriptionInfo; Loading Loading @@ -66,7 +65,8 @@ public abstract class IccRecords extends Handler implements IccConstants { protected boolean mRecordsRequested = false; // true if we've made requests for the sim records protected String mIccId; protected String mIccId; // Includes only decimals (no hex) protected String mFullIccId; // Includes hex characters in ICCID protected String mMsisdn = null; // My mobile number protected String mMsisdnTag = null; protected String mNewMsisdn = null; Loading Loading @@ -116,7 +116,7 @@ public abstract class IccRecords extends Handler implements IccConstants { @Override public String toString() { String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mIccId); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mFullIccId); return "mDestroyed=" + mDestroyed + " mContext=" + mContext + " mCi=" + mCi Loading Loading @@ -189,10 +189,24 @@ public abstract class IccRecords extends Handler implements IccConstants { return mAdnCache; } /** * Returns the ICC ID stripped at the first hex character. Some SIMs have ICC IDs * containing hex digits; {@link #getFullIccId()} should be used to get the full ID including * hex digits. * @return ICC ID without hex digits */ public String getIccId() { return mIccId; } /** * Returns the full ICC ID including hex digits. * @return full ICC ID including hex digits */ public String getFullIccId() { return mFullIccId; } public void registerForRecordsLoaded(Handler h, int what, Object obj) { if (mDestroyed.get()) { return; Loading Loading @@ -719,9 +733,10 @@ public abstract class IccRecords extends Handler implements IccConstants { pw.println(" mRecordsRequested=" + mRecordsRequested); pw.println(" mRecordsToLoad=" + mRecordsToLoad); pw.println(" mRdnCache=" + mAdnCache); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mIccId); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mFullIccId); pw.println(" iccid=" + iccIdToPrint); if (TextUtils.isEmpty(mMsisdn)) { pw.println(" mMsisdn=null"); } else { Loading src/java/com/android/internal/telephony/uicc/IccUtils.java +20 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ public class IccUtils { StringBuilder ret = new StringBuilder(length*2); for (int i = offset ; i < offset + length ; i++) { byte b; int v; v = data[i] & 0xf; Loading @@ -61,6 +60,26 @@ public class IccUtils { return ret.toString(); } /** * Some fields (like ICC ID) in GSM SIMs are stored as nibble-swizzled BCH */ public static String bchToString(byte[] data, int offset, int length) { StringBuilder ret = new StringBuilder(length*2); for (int i = offset ; i < offset + length ; i++) { int v; v = data[i] & 0xf; ret.append("0123456789abcdef".charAt(v)); v = (data[i] >> 4) & 0xf; ret.append("0123456789abcdef".charAt(v)); } return ret.toString(); } /** * Decode cdma byte into String. */ Loading Loading
src/java/com/android/internal/telephony/GsmCdmaPhone.java +10 −0 Original line number Diff line number Diff line Loading @@ -744,6 +744,16 @@ public class GsmCdmaPhone extends Phone { return (r != null) ? r.getIccId() : null; } @Override public String getFullIccSerialNumber() { IccRecords r = mIccRecords.get(); if (!isPhoneTypeGsm() && r == null) { // to get ICCID form SIMRecords because it is on MF. r = mUiccController.getIccRecords(mPhoneId, UiccController.APP_FAM_3GPP); } return (r != null) ? r.getFullIccId() : null; } @Override public boolean canConference() { if (mImsPhone != null && mImsPhone.canConference()) { Loading
src/java/com/android/internal/telephony/Phone.java +10 −1 Original line number Diff line number Diff line Loading @@ -1535,13 +1535,22 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Retrieves the serial number of the ICC, if applicable. * Retrieves the serial number of the ICC, if applicable. Returns only the decimal digits before * the first hex digit in the ICC ID. */ public String getIccSerialNumber() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getIccId() : null; } /** * Retrieves the full serial number of the ICC (including hex digits), if applicable. */ public String getFullIccSerialNumber() { IccRecords r = mIccRecords.get(); return (r != null) ? r.getFullIccId() : null; } /** * Returns SIM record load state. Use * <code>getSimCard().registerForReady()</code> for change notification. Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +1 −1 Original line number Diff line number Diff line Loading @@ -256,7 +256,7 @@ public class SubscriptionInfoUpdater extends Handler { if (ar.exception == null) { if (ar.result != null) { byte[] data = (byte[])ar.result; mIccId[slotId] = IccUtils.bcdToString(data, 0, data.length); mIccId[slotId] = IccUtils.bchToString(data, 0, data.length); } else { logd("Null ar"); mIccId[slotId] = ICCID_STRING_FOR_NO_SIM; Loading
src/java/com/android/internal/telephony/uicc/IccRecords.java +19 −4 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.os.Message; import android.os.Registrant; import android.os.RegistrantList; import android.telephony.Rlog; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.telephony.SubscriptionInfo; Loading Loading @@ -66,7 +65,8 @@ public abstract class IccRecords extends Handler implements IccConstants { protected boolean mRecordsRequested = false; // true if we've made requests for the sim records protected String mIccId; protected String mIccId; // Includes only decimals (no hex) protected String mFullIccId; // Includes hex characters in ICCID protected String mMsisdn = null; // My mobile number protected String mMsisdnTag = null; protected String mNewMsisdn = null; Loading Loading @@ -116,7 +116,7 @@ public abstract class IccRecords extends Handler implements IccConstants { @Override public String toString() { String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mIccId); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mFullIccId); return "mDestroyed=" + mDestroyed + " mContext=" + mContext + " mCi=" + mCi Loading Loading @@ -189,10 +189,24 @@ public abstract class IccRecords extends Handler implements IccConstants { return mAdnCache; } /** * Returns the ICC ID stripped at the first hex character. Some SIMs have ICC IDs * containing hex digits; {@link #getFullIccId()} should be used to get the full ID including * hex digits. * @return ICC ID without hex digits */ public String getIccId() { return mIccId; } /** * Returns the full ICC ID including hex digits. * @return full ICC ID including hex digits */ public String getFullIccId() { return mFullIccId; } public void registerForRecordsLoaded(Handler h, int what, Object obj) { if (mDestroyed.get()) { return; Loading Loading @@ -719,9 +733,10 @@ public abstract class IccRecords extends Handler implements IccConstants { pw.println(" mRecordsRequested=" + mRecordsRequested); pw.println(" mRecordsToLoad=" + mRecordsToLoad); pw.println(" mRdnCache=" + mAdnCache); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mIccId); String iccIdToPrint = SubscriptionInfo.givePrintableIccid(mFullIccId); pw.println(" iccid=" + iccIdToPrint); if (TextUtils.isEmpty(mMsisdn)) { pw.println(" mMsisdn=null"); } else { Loading
src/java/com/android/internal/telephony/uicc/IccUtils.java +20 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ public class IccUtils { StringBuilder ret = new StringBuilder(length*2); for (int i = offset ; i < offset + length ; i++) { byte b; int v; v = data[i] & 0xf; Loading @@ -61,6 +60,26 @@ public class IccUtils { return ret.toString(); } /** * Some fields (like ICC ID) in GSM SIMs are stored as nibble-swizzled BCH */ public static String bchToString(byte[] data, int offset, int length) { StringBuilder ret = new StringBuilder(length*2); for (int i = offset ; i < offset + length ; i++) { int v; v = data[i] & 0xf; ret.append("0123456789abcdef".charAt(v)); v = (data[i] >> 4) & 0xf; ret.append("0123456789abcdef".charAt(v)); } return ret.toString(); } /** * Decode cdma byte into String. */ Loading