diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 769226ecb8b50..86ea12bfa9254 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -541,6 +541,20 @@ public interface Phone { */ void unregisterForCdmaOtaStatusChange(Handler h); + /** + * Registration point for subscription info ready + * @param h handler to notify + * @param what what code of message when delivered + * @param obj placed in Message.obj + */ + public void registerForSubscriptionInfoReady(Handler h, int what, Object obj); + + /** + * Unregister for notifications for subscription info + * @param h Handler to be removed from the registrant list. + */ + public void unregisterForSubscriptionInfoReady(Handler h); + /** * Returns SIM record load state. Use * getSimCard().registerForReady() for change notification. @@ -1365,6 +1379,13 @@ public interface Phone { */ String getCdmaMin(); + /** + * Check if subscription data has been assigned to mMin + * + * return true if MIN info is ready; false otherwise. + */ + boolean isMinInfoReady(); + /** * Retrieves PRL Version for CDMA phones */ diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index fbda221ddbbbe..6e2b3f3f762de 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -698,6 +698,12 @@ public abstract class PhoneBase implements Phone { return null; } + public boolean isMinInfoReady() { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + return false; + } + public String getCdmaPrlVersion(){ // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); @@ -724,6 +730,16 @@ public abstract class PhoneBase implements Phone { Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); } + public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + + public void unregisterForSubscriptionInfoReady(Handler h) { + // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. + Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); + } + public boolean isOtaSpNumber(String dialStr) { // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. Log.e(LOG_TAG, "Error! This function should never be executed, inactive CDMAPhone."); diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java index 30d56dad26e04..f2568c165d642 100644 --- a/telephony/java/com/android/internal/telephony/PhoneProxy.java +++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java @@ -315,6 +315,14 @@ public class PhoneProxy extends Handler implements Phone { mActivePhone.unregisterForCdmaOtaStatusChange(h); } + public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) { + mActivePhone.registerForSubscriptionInfoReady(h, what, obj); + } + + public void unregisterForSubscriptionInfoReady(Handler h) { + mActivePhone.unregisterForSubscriptionInfoReady(h); + } + public boolean getIccRecordsLoaded() { return mActivePhone.getIccRecordsLoaded(); } @@ -419,6 +427,10 @@ public class PhoneProxy extends Handler implements Phone { return mActivePhone.getCdmaMin(); } + public boolean isMinInfoReady() { + return mActivePhone.isMinInfoReady(); + } + public String getCdmaPrlVersion() { return mActivePhone.getCdmaPrlVersion(); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index 7b3ff5e8e0011..e0fbd81a16bc6 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -441,6 +441,10 @@ public class CDMAPhone extends PhoneBase { return mSST.getCdmaMin(); } + public boolean isMinInfoReady() { + return mSST.isMinInfoReady(); + } + public void getCallWaiting(Message onComplete) { mCM.queryCallWaiting(CommandsInterface.SERVICE_CLASS_VOICE, onComplete); } @@ -556,6 +560,14 @@ public class CDMAPhone extends PhoneBase { mCM.unregisterForCdmaOtaProvision(h); } + public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) { + mSST.registerForSubscriptionInfoReady(h, what, obj); + } + + public void unregisterForSubscriptionInfoReady(Handler h) { + mSST.unregisterForSubscriptionInfoReady(h); + } + public void setOnEcbModeExitResponse(Handler h, int what, Object obj) { mECMExitRespRegistrant = new Registrant (h, what, obj); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 53f0274ea247b..753b5e7307496 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -93,6 +93,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { private int mRegistrationState = -1; private RegistrantList cdmaDataConnectionAttachedRegistrants = new RegistrantList(); private RegistrantList cdmaDataConnectionDetachedRegistrants = new RegistrantList(); + private RegistrantList cdmaForSubscriptionInfoReadyRegistrants = new RegistrantList(); // Sometimes we get the NITZ time before we know what country we are in. // Keep the time zone information from the NITZ string so we can fix @@ -125,6 +126,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { private int mHomeNetworkId[] = null; private String mMin; private String mPrlVersion; + private boolean mIsMinInfoReady = false; private boolean isEriTextLoaded = false; private boolean isSubscriptionFromRuim = false; @@ -264,6 +266,25 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { cdmaDataConnectionDetachedRegistrants.remove(h); } + /** + * Registration point for subscription info ready + * @param h handler to notify + * @param what what code of message when delivered + * @param obj placed in Message.obj + */ + public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) { + Registrant r = new Registrant(h, what, obj); + cdmaForSubscriptionInfoReadyRegistrants.add(r); + + if (isMinInfoReady()) { + r.notifyRegistrant(); + } + } + + public void unregisterForSubscriptionInfoReady(Handler h) { + cdmaForSubscriptionInfoReadyRegistrants.remove(h); + } + //***** Called from CDMAPhone public void getLacAndCid(Message onComplete) { @@ -426,6 +447,13 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { mMin = cdmaSubscription[3]; mPrlVersion = cdmaSubscription[4]; Log.d(LOG_TAG,"GET_CDMA_SUBSCRIPTION MDN=" + mMdn); + //Notify apps subscription info is ready + if (cdmaForSubscriptionInfoReadyRegistrants != null) { + cdmaForSubscriptionInfoReadyRegistrants.notifyRegistrants(); + } + if (!mIsMinInfoReady) { + mIsMinInfoReady = true; + } } else { Log.w(LOG_TAG,"error parsing cdmaSubscription params num=" + cdmaSubscription.length); @@ -1545,4 +1573,13 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { return null; } } + + /** + * Check if subscription data has been assigned to mMin + * + * return true if MIN info is ready; false otherwise. + */ + public boolean isMinInfoReady() { + return mIsMinInfoReady; + } }