diff options
Diffstat (limited to 'telephony/java/com/android/internal/telephony/IccRecords.java')
-rw-r--r-- | telephony/java/com/android/internal/telephony/IccRecords.java | 165 |
1 files changed, 45 insertions, 120 deletions
diff --git a/telephony/java/com/android/internal/telephony/IccRecords.java b/telephony/java/com/android/internal/telephony/IccRecords.java index 6849fad9d908..114094b74181 100644 --- a/telephony/java/com/android/internal/telephony/IccRecords.java +++ b/telephony/java/com/android/internal/telephony/IccRecords.java @@ -16,10 +16,6 @@ package com.android.internal.telephony; - - -import java.util.ArrayList; - import android.os.AsyncResult; import android.os.Handler; import android.os.Message; @@ -27,125 +23,66 @@ import android.os.Registrant; import android.os.RegistrantList; import android.util.Log; -import static com.android.internal.telephony.TelephonyProperties.*; - -// TODO: move abstract parts to here +import java.util.ArrayList; /** * {@hide} */ public abstract class IccRecords extends Handler implements IccConstants { - static String LOG_TAG = "IccRecords"; - - protected static final boolean DBG = true; + + protected static final boolean DBG = true; //***** Instance Variables - PhoneBase phone; - RegistrantList recordsLoadedRegistrants = new RegistrantList(); + protected PhoneBase phone; + protected RegistrantList recordsLoadedRegistrants = new RegistrantList(); - int recordsToLoad; // number of pending load requests + protected int recordsToLoad; // number of pending load requests - AdnRecordCache adnCache; + protected AdnRecordCache adnCache; //***** Cached SIM State; cleared on channel close - boolean recordsRequested = false; // true if we've made requests for the sim records - - String imsi; - String iccid; - String msisdn = null; // My mobile number - String msisdnTag = null; - String voiceMailNum = null; - String voiceMailTag = null; - String newVoiceMailNum = null; - String newVoiceMailTag = null; - boolean isVoiceMailFixed = false; - int countVoiceMessages = 0; - boolean callForwardingEnabled; - int mncLength = 0; // 0 is used to indicate that the value - // is not initialized - int mailboxIndex = 0; // 0 is no mailbox dailing number associated - - - byte[] efMWIS = null; - byte[] efCPHS_MWI =null; - byte[] mEfCff = null; - byte[] mEfCfis = null; + protected boolean recordsRequested = false; // true if we've made requests for the sim records + public String iccid; + protected String msisdn = null; // My mobile number + protected String msisdnTag = null; + protected String voiceMailNum = null; + protected String voiceMailTag = null; + protected String newVoiceMailNum = null; + protected String newVoiceMailTag = null; + protected boolean isVoiceMailFixed = false; + protected int countVoiceMessages = 0; - String spn; - int spnDisplayCondition; - // Numeric network codes listed in TS 51.011 EF[SPDI] - ArrayList<String> spdiNetworks = null; + protected int mncLength = 0; // 0 is used to indicate that the value + // is not initialized + protected int mailboxIndex = 0; // 0 is no mailbox dailing number associated - String pnnHomeName = null; + protected String spn; + protected int spnDisplayCondition; //***** Constants // Bitmasks for SPN display rules. - static final int SPN_RULE_SHOW_SPN = 0x01; - static final int SPN_RULE_SHOW_PLMN = 0x02; - - // From TS 51.011 EF[SPDI] section - static final int TAG_SPDI_PLMN_LIST = 0x80; - - // Full Name IEI from TS 24.008 - static final int TAG_FULL_NETWORK_NAME = 0x43; - - // Short Name IEI from TS 24.008 - static final int TAG_SHORT_NETWORK_NAME = 0x45; - - // active CFF from CPHS 4.2 B.4.5 - static final int CFF_UNCONDITIONAL_ACTIVE = 0x0a; - static final int CFF_UNCONDITIONAL_DEACTIVE = 0x05; - static final int CFF_LINE1_MASK = 0x0f; - static final int CFF_LINE1_RESET = 0xf0; + protected static final int SPN_RULE_SHOW_SPN = 0x01; + protected static final int SPN_RULE_SHOW_PLMN = 0x02; //***** Event Constants - private static final int EVENT_SET_MSISDN_DONE = 30; - + protected static final int EVENT_SET_MSISDN_DONE = 30; + //***** Constructor - public IccRecords(PhoneBase phone) { - this.phone = phone; + public IccRecords(PhoneBase p) { + this.phone = p; } -// TODO T: check if public can /should be avoided - protected AdnRecordCache getAdnCache() { - return adnCache; - } + protected abstract void onRadioOffOrNotAvailable(); - protected void onRadioOffOrNotAvailable() { - imsi = null; - msisdn = null; - voiceMailNum = null; - countVoiceMessages = 0; - mncLength = 0; - iccid = null; - spn = null; - // -1 means no EF_SPN found; treat accordingly. - spnDisplayCondition = -1; - efMWIS = null; - efCPHS_MWI = null; - spn = null; - spdiNetworks = null; - pnnHomeName = null; - - adnCache.reset(); - - phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, null); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_NUMERIC, null); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ALPHA, null); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ISO_COUNTRY, null); - - // recordsRequested is set to false indicating that the SIM - // read requests made so far are not valid. This is set to - // true only when fresh set of read requests are made. - recordsRequested = false; + //***** Public Methods + public AdnRecordCache getAdnCache() { + return adnCache; } - - //***** Public Methods public void registerForRecordsLoaded(Handler h, int what, Object obj) { Registrant r = new Registrant(h, what, obj); recordsLoadedRegistrants.add(r); @@ -155,9 +92,8 @@ public abstract class IccRecords extends Handler implements IccConstants { } } - /** Returns null if SIM is not yet ready */ - public String getIMSI() { - return imsi; + public void unregisterForRecordsLoaded(Handler h) { + recordsLoadedRegistrants.remove(h); } public String getMsisdnNumber() { @@ -203,10 +139,10 @@ public abstract class IccRecords extends Handler implements IccConstants { } /** - * Return Service Provider Name stored in SIM - * @return null if SIM is not yet ready + * Return Service Provider Name stored in SIM (EF_SPN=0x6F46) or in RUIM (EF_RUIM_SPN=0x6F41) + * @return null if SIM is not yet ready or no RUIM entry */ - public String getServiceProvideName() { + public String getServiceProviderName() { return spn; } @@ -217,7 +153,7 @@ public abstract class IccRecords extends Handler implements IccConstants { * EF_MAILBOX_CPHS (CPHS 4.2) * * If EF_MBDN is available, store the voice mail number to EF_MBDN - * + * * If EF_MAILBOX_CPHS is enabled, store the voice mail number to EF_CHPS * * So the voice mail number will be stored in both EFs if both are available @@ -245,7 +181,7 @@ public abstract class IccRecords extends Handler implements IccConstants { * Sets the SIM voice message waiting indicator records * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported * @param countWaiting The number of messages waiting, if known. Use - * -1 to indicate that an unknown number of + * -1 to indicate that an unknown number of * messages are waiting */ public abstract void setVoiceMessageWaiting(int line, int countWaiting); @@ -257,20 +193,13 @@ public abstract class IccRecords extends Handler implements IccConstants { /** * Returns number of voice messages waiting, if available - * If not available (eg, on an older CPHS SIM) -1 is returned if + * If not available (eg, on an older CPHS SIM) -1 is returned if * getVoiceMessageWaiting() is true */ public int getCountVoiceMessages() { return countVoiceMessages; } - public boolean getVoiceCallForwardingFlag() { - return callForwardingEnabled; - } - - public abstract void setVoiceCallForwardingFlag(int line, boolean enable); - - /** * Called by STK Service when REFRESH is received. * @param fileChanged indicates whether any files changed @@ -279,7 +208,6 @@ public abstract class IccRecords extends Handler implements IccConstants { public abstract void onRefresh(boolean fileChanged, int[] fileList); -// TODO T: check if public can /should be avoided public boolean getRecordsLoaded() { if (recordsToLoad == 0 && recordsRequested == true) { return true; @@ -292,10 +220,9 @@ public abstract class IccRecords extends Handler implements IccConstants { public abstract void handleMessage(Message msg); protected abstract void onRecordLoaded(); - + protected abstract void onAllRecordsLoaded(); - -// TODO T: check if public can /should be avoided + /** * Returns the SpnDisplayRule based on settings on the SIM and the * specified plmn (currently-registered PLMN). See TS 22.101 Annex A @@ -304,9 +231,7 @@ public abstract class IccRecords extends Handler implements IccConstants { * If the SPN is not found on the SIM, the rule is always PLMN_ONLY. */ protected abstract int getDisplayRule(String plmn); - - private void log(String s) { - Log.d(LOG_TAG, " " + s); - } - + + protected abstract void log(String s); } + |