From 5d39ec4a37de500ada84225f8bd2c244db0cd287 Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Tue, 13 Sep 2011 11:58:08 -0700 Subject: Add method to retrieve MSISDN for CDMA/LTE devices. For CDMA/LTE devices, the MDN and MSISDN may be different. Add a new method getMsisdn() to the Phone interface to return the MSISDN. For GSM/UMTS, this will be the same as getLine1Number(). For CDMA/LTE, getLine1Number() will continue to return the MDN and getMsisdn() will return the MSISDN. Change-Id: Iba0ca24858992b21f63ae7ec0c27d2e90d4b0903 --- telephony/java/com/android/internal/telephony/Phone.java | 10 +++++++++- telephony/java/com/android/internal/telephony/PhoneBase.java | 5 +++++ telephony/java/com/android/internal/telephony/PhoneProxy.java | 4 ++++ .../java/com/android/internal/telephony/cdma/CDMALTEPhone.java | 5 +++++ .../android/internal/telephony/cdma/CdmaLteUiccRecords.java | 5 +++++ .../java/com/android/internal/telephony/gsm/GSMPhone.java | 5 +++++ .../java/com/android/internal/telephony/gsm/SIMRecords.java | 2 +- 7 files changed, 34 insertions(+), 2 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 5e64148a600a..444f0d29c76b 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -932,7 +932,8 @@ public interface Phone { boolean getCallForwardingIndicator(); /** - * Get the line 1 phone number (MSISDN).

+ * Get the line 1 phone number (MSISDN). For CDMA phones, the MDN is returned + * and {@link #getMsisdn()} will return the MSISDN on CDMA/LTE phones.

* * @return phone number. May return null if not * available or the SIM is not ready @@ -1431,6 +1432,13 @@ public interface Phone { */ String getMeid(); + /** + * Retrieves the MSISDN from the UICC. For GSM/UMTS phones, this is equivalent to + * {@link #getLine1Number()}. For CDMA phones, {@link #getLine1Number()} returns + * the MDN, so this method is provided to return the MSISDN on CDMA/LTE phones. + */ + String getMsisdn(); + /** * Retrieves IMEI for phones. Returns null if IMEI is not set. */ diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 4f86ea87f4bb..82f3955c9f2e 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -1124,6 +1124,11 @@ public abstract class PhoneBase extends Handler implements Phone { Log.e(LOG_TAG, "requestIsimAuthentication() is only supported on LTE devices"); } + public String getMsisdn() { + logUnexpectedGsmMethodCall("getMsisdn"); + return null; + } + /** * Common error logger method for unexpected calls to CDMA-only methods. */ diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index 367801778b3d..e0e8d49156d8 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -686,6 +686,10 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getMeid(); } + public String getMsisdn() { + return mActivePhone.getMsisdn(); + } + public String getImei() { return mActivePhone.getImei(); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java index f4ed91ddfdb9..6903025f9dd9 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java @@ -140,6 +140,11 @@ public class CDMALTEPhone extends CDMAPhone { return mIccRecords.getIsimRecords(); } + @Override + public String getMsisdn() { + return mIccRecords.getMsisdnNumber(); + } + @Override public void requestIsimAuthentication(String nonce, Message result) { mCM.requestIsimAuthentication(nonce, result); diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java index c4fa6f63e179..0617fee741f1 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteUiccRecords.java @@ -19,6 +19,7 @@ import android.os.AsyncResult; import android.os.SystemProperties; import android.util.Log; +import com.android.internal.telephony.AdnRecordLoader; import com.android.internal.telephony.GsmAlphabet; import com.android.internal.telephony.IccCardApplication.AppType; import com.android.internal.telephony.IccFileHandler; @@ -276,6 +277,10 @@ public final class CdmaLteUiccRecords extends SIMRecords { obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfPlLoaded())); recordsToLoad++; + new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1, + obtainMessage(EVENT_GET_MSISDN_DONE)); + recordsToLoad++; + iccFh.loadEFTransparent(EF_CSIM_LI, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimLiLoaded())); recordsToLoad++; diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index 1db98600123f..d325aaa5e6e2 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -877,6 +877,11 @@ public class GSMPhone extends PhoneBase { return mIccRecords.getMsisdnNumber(); } + @Override + public String getMsisdn() { + return mIccRecords.getMsisdnNumber(); + } + public String getLine1AlphaTag() { return mIccRecords.getMsisdnAlphaTag(); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index d84715ef9510..73c319c7a327 100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -127,7 +127,7 @@ public class SIMRecords extends IccRecords { private static final int EVENT_GET_MWIS_DONE = 7; private static final int EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE = 8; protected static final int EVENT_GET_AD_DONE = 9; // Admin data on SIM - private static final int EVENT_GET_MSISDN_DONE = 10; + protected static final int EVENT_GET_MSISDN_DONE = 10; private static final int EVENT_GET_CPHS_MAILBOX_DONE = 11; private static final int EVENT_GET_SPN_DONE = 12; private static final int EVENT_GET_SPDI_DONE = 13; -- cgit v1.2.3-59-g8ed1b