diff options
Diffstat (limited to 'telephony/java/com/android/internal/telephony/gsm/SIMRecords.java')
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/SIMRecords.java | 293 |
1 files changed, 125 insertions, 168 deletions
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index 57d76c25c927..e33e556b6d7b 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -17,23 +17,26 @@ package com.android.internal.telephony.gsm; import android.os.AsyncResult; -import android.os.RegistrantList; -import android.os.Registrant; import android.os.Handler; import android.os.Message; -import android.telephony.gsm.SmsMessage; +import android.os.Registrant; import android.util.Log; -import java.util.ArrayList; -import com.android.internal.telephony.IccUtils; +import static com.android.internal.telephony.TelephonyProperties.*; + import com.android.internal.telephony.AdnRecord; import com.android.internal.telephony.AdnRecordCache; import com.android.internal.telephony.AdnRecordLoader; import com.android.internal.telephony.CommandsInterface; +import com.android.internal.telephony.gsm.SimCard; +import com.android.internal.telephony.gsm.SmsMessage; import com.android.internal.telephony.IccException; +import com.android.internal.telephony.IccFileHandler; import com.android.internal.telephony.IccRecords; -import static com.android.internal.telephony.TelephonyProperties.*; -import com.android.internal.telephony.gsm.SimCard; +import com.android.internal.telephony.IccUtils; +import com.android.internal.telephony.PhoneProxy; + +import java.util.ArrayList; /** * {@hide} @@ -47,36 +50,16 @@ public final class SIMRecords extends IccRecords { //***** Instance Variables - GSMPhone phone; - RegistrantList recordsLoadedRegistrants = new RegistrantList(); - - int recordsToLoad; // number of pending load requests - - AdnRecordCache adnCache; - VoiceMailConstants mVmConfig; - - //***** Cached SIM State; cleared on channel close - boolean recordsRequested = false; // true if we've made requests for the sim records + //***** Cached SIM State; cleared on channel close 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 + /** - * Sates only used by getSpnFsm FSM + * States only used by getSpnFsm FSM */ private Get_Spn_Fsm_State spnState; @@ -157,9 +140,8 @@ public final class SIMRecords extends IccRecords { //***** Constructor - SIMRecords(GSMPhone phone) { - super(phone); - this.phone = phone; + SIMRecords(GSMPhone p) { + super(p); adnCache = new AdnRecordCache(phone); @@ -171,19 +153,26 @@ public final class SIMRecords extends IccRecords { recordsToLoad = 0; - phone.mCM.registerForSIMReady(this, EVENT_SIM_READY, null); - phone.mCM.registerForOffOrNotAvailable( + p.mCM.registerForSIMReady(this, EVENT_SIM_READY, null); + p.mCM.registerForOffOrNotAvailable( this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); - phone.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null); - phone.mCM.setOnIccRefresh(this, EVENT_SIM_REFRESH, null); + p.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null); + p.mCM.setOnIccRefresh(this, EVENT_SIM_REFRESH, null); // Start off by setting empty state - onRadioOffOrNotAvailable(); + onRadioOffOrNotAvailable(); } - protected AdnRecordCache getAdnCache() { - return adnCache; + public void dispose() { + //Unregister for all events + phone.mCM.unregisterForSIMReady(this); + phone.mCM.unregisterForOffOrNotAvailable( this); + phone.mCM.unSetOnIccRefresh(this); + } + + protected void finalize() { + if(DBG) Log.d(LOG_TAG, "SIMRecords finalized"); } protected void onRadioOffOrNotAvailable() { @@ -197,7 +186,7 @@ public final class SIMRecords extends IccRecords { // -1 means no EF_SPN found; treat accordingly. spnDisplayCondition = -1; efMWIS = null; - efCPHS_MWI = null; + efCPHS_MWI = null; spn = null; spdiNetworks = null; pnnHomeName = null; @@ -205,9 +194,9 @@ public final class SIMRecords extends IccRecords { 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); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, null); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, null); + phone.setSystemProperty(PROPERTY_ICC_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 @@ -217,14 +206,6 @@ public final class SIMRecords extends IccRecords { //***** Public Methods - public void registerForRecordsLoaded(Handler h, int what, Object obj) { - Registrant r = new Registrant(h, what, obj); - recordsLoadedRegistrants.add(r); - - if (recordsToLoad == 0 && recordsRequested == true) { - r.notifyRegistrant(new AsyncResult(null, null, null)); - } - } /** Returns null if SIM is not yet ready */ public String getIMSI() { @@ -274,21 +255,13 @@ public final class SIMRecords extends IccRecords { } /** - * Return Service Provider Name stored in SIM - * @return null if SIM is not yet ready - */ - public String getServiceProvideName() { - return spn; - } - - /** * Set voice mail number to SIM record * * The voice mail number can be stored either in EF_MBDN (TS 51.011) or * 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 @@ -346,7 +319,7 @@ public final class SIMRecords extends IccRecords { * 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 void @@ -367,17 +340,17 @@ public final class SIMRecords extends IccRecords { countVoiceMessages = countWaiting; - phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, + phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, (countVoiceMessages != 0) ? "true" : "false"); - phone.notifyMessageWaitingIndicator(); + ((GSMPhone) phone).notifyMessageWaitingIndicator(); try { if (efMWIS != null) { // TS 51.011 10.3.45 // lsb of byte 0 is 'voicemail' status - efMWIS[0] = (byte)((efMWIS[0] & 0xfe) + efMWIS[0] = (byte)((efMWIS[0] & 0xfe) | (countVoiceMessages == 0 ? 0 : 1)); // byte 1 is the number of voice messages waiting @@ -389,17 +362,17 @@ public final class SIMRecords extends IccRecords { efMWIS[1] = (byte) countWaiting; } - ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed( + phone.getIccFileHandler().updateEFLinearFixed( EF_MWIS, 1, efMWIS, null, obtainMessage (EVENT_UPDATE_DONE, EF_MWIS)); - } + } if (efCPHS_MWI != null) { // Refer CPHS4_2.WW6 B4.2.3 - efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0) + efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0) | (countVoiceMessages == 0 ? 0x5 : 0xa)); - ((SIMFileHandler)phone.getIccFileHandler()).updateEFTransparent( + phone.getIccFileHandler().updateEFTransparent( EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI, obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS)); } @@ -409,20 +382,6 @@ public final class SIMRecords extends IccRecords { } } - /** @return true if there are messages waiting, false otherwise. */ - public boolean getVoiceMessageWaiting() { - return countVoiceMessages != 0; - } - - /** - * Returns number of voice messages waiting, if available - * 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; } @@ -436,7 +395,7 @@ public final class SIMRecords extends IccRecords { phone.setSystemProperty(PROPERTY_LINE1_VOICE_CALL_FORWARDING, (callForwardingEnabled ? "true" : "false")); - phone.notifyCallForwardingIndicator(); + ((GSMPhone) phone).notifyCallForwardingIndicator(); try { if (mEfCfis != null) { @@ -450,7 +409,7 @@ public final class SIMRecords extends IccRecords { // TODO: Should really update other fields in EF_CFIS, eg, // dialing number. We don't read or use it right now. - ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed( + phone.getIccFileHandler().updateEFLinearFixed( EF_CFIS, 1, mEfCfis, null, obtainMessage (EVENT_UPDATE_DONE, EF_CFIS)); } @@ -464,7 +423,7 @@ public final class SIMRecords extends IccRecords { | CFF_UNCONDITIONAL_DEACTIVE); } - ((SIMFileHandler)phone.getIccFileHandler()).updateEFTransparent( + phone.getIccFileHandler().updateEFTransparent( EF_CFF_CPHS, mEfCff, obtainMessage (EVENT_UPDATE_DONE, EF_CFF_CPHS)); } @@ -530,19 +489,19 @@ public final class SIMRecords extends IccRecords { case EVENT_RADIO_OFF_OR_NOT_AVAILABLE: onRadioOffOrNotAvailable(); - break; + break; /* IO events */ case EVENT_GET_IMSI_DONE: isRecordLoadResponse = true; - + ar = (AsyncResult)msg.obj; if (ar.exception != null) { Log.e(LOG_TAG, "Exception querying IMSI", ar.exception); break; - } - + } + imsi = (String) ar.result; // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more @@ -551,10 +510,10 @@ public final class SIMRecords extends IccRecords { Log.e(LOG_TAG, "invalid IMSI " + imsi); imsi = null; } - + Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxxxx"); - phone.mSimCard.updateImsiConfiguration(imsi); - phone.mSimCard.broadcastSimStateChangedIntent( + ((GSMPhone) phone).mSimCard.updateImsiConfiguration(imsi); + ((GSMPhone) phone).mSimCard.broadcastSimStateChangedIntent( SimCard.INTENT_VALUE_ICC_IMSI, null); break; @@ -604,20 +563,20 @@ public final class SIMRecords extends IccRecords { ar = (AsyncResult)msg.obj; if (ar.exception != null) { - - Log.d(LOG_TAG, "Invalid or missing EF" + + Log.d(LOG_TAG, "Invalid or missing EF" + ((msg.what == EVENT_GET_CPHS_MAILBOX_DONE) ? "[MAILBOX]" : "[MBDN]")); // Bug #645770 fall back to CPHS // FIXME should use SST to decide if (msg.what == EVENT_GET_MBDN_DONE) { - //load CPHS on fail... + //load CPHS on fail... // FIXME right now, only load line1's CPHS voice mail entry recordsToLoad += 1; new AdnRecordLoader(phone).loadFromEF( - EF_MAILBOX_CPHS, EF_EXT1, 1, + EF_MAILBOX_CPHS, EF_EXT1, 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE)); } break; @@ -625,7 +584,8 @@ public final class SIMRecords extends IccRecords { adn = (AdnRecord)ar.result; - Log.d(LOG_TAG, "VM: " + adn + ((msg.what == EVENT_GET_CPHS_MAILBOX_DONE) ? " EF[MAILBOX]" : " EF[MBDN]")); + Log.d(LOG_TAG, "VM: " + adn + + ((msg.what == EVENT_GET_CPHS_MAILBOX_DONE) ? " EF[MAILBOX]" : " EF[MBDN]")); if (adn.isEmpty() && msg.what == EVENT_GET_MBDN_DONE) { // Bug #645770 fall back to CPHS @@ -633,7 +593,7 @@ public final class SIMRecords extends IccRecords { // FIXME right now, only load line1's CPHS voice mail entry recordsToLoad += 1; new AdnRecordLoader(phone).loadFromEF( - EF_MAILBOX_CPHS, EF_EXT1, 1, + EF_MAILBOX_CPHS, EF_EXT1, 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE)); break; @@ -697,13 +657,13 @@ public final class SIMRecords extends IccRecords { countVoiceMessages = data[1] & 0xff; if (voiceMailWaiting && countVoiceMessages == 0) { - // Unknown count = -1 + // Unknown count = -1 countVoiceMessages = -1; } - phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, + phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, voiceMailWaiting ? "true" : "false"); - phone.notifyMessageWaitingIndicator(); + ((GSMPhone) phone).notifyMessageWaitingIndicator(); break; case EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE: @@ -732,10 +692,10 @@ public final class SIMRecords extends IccRecords { countVoiceMessages = 0; } - phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, - countVoiceMessages != 0 + phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, + countVoiceMessages != 0 ? "true" : "false"); - phone.notifyMessageWaitingIndicator(); + ((GSMPhone) phone).notifyMessageWaitingIndicator(); } break; @@ -744,13 +704,13 @@ public final class SIMRecords extends IccRecords { ar = (AsyncResult)msg.obj; data = (byte[])ar.result; - + if (ar.exception != null) { break; - } + } iccid = IccUtils.bcdToString(data, 0, data.length); - + Log.d(LOG_TAG, "iccid: " + iccid); break; @@ -819,7 +779,7 @@ public final class SIMRecords extends IccRecords { phone.setSystemProperty(PROPERTY_LINE1_VOICE_CALL_FORWARDING, (callForwardingEnabled ? "true" : "false")); - phone.notifyCallForwardingIndicator(); + ((GSMPhone) phone).notifyCallForwardingIndicator(); } break; @@ -833,7 +793,7 @@ public final class SIMRecords extends IccRecords { break; } - parseEfSpdi(data); + parseEfSpdi(data); break; case EVENT_UPDATE_DONE: @@ -857,7 +817,7 @@ public final class SIMRecords extends IccRecords { for ( ; tlv.isValidObject() ; tlv.nextObject()) { if (tlv.getTag() == TAG_FULL_NETWORK_NAME) { - pnnHomeName + pnnHomeName = IccUtils.networkNameToString( tlv.getData(), 0, tlv.getData().length); break; @@ -892,7 +852,8 @@ public final class SIMRecords extends IccRecords { + ar.exception + " length " + index.length); } else { Log.d(LOG_TAG, "READ EF_SMS RECORD index=" + index[0]); - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixed(EF_SMS,index[0],obtainMessage(EVENT_GET_SMS_DONE)); + phone.getIccFileHandler().loadEFLinearFixed(EF_SMS,index[0], + obtainMessage(EVENT_GET_SMS_DONE)); } break; @@ -1013,20 +974,20 @@ public final class SIMRecords extends IccRecords { IccUtils.bytesToHexString(data)); mEfCfis = data; - + // Refer TS 51.011 Section 10.3.46 for the content description callForwardingEnabled = ((data[1] & 0x01) != 0); phone.setSystemProperty(PROPERTY_LINE1_VOICE_CALL_FORWARDING, (callForwardingEnabled ? "true" : "false")); - phone.notifyCallForwardingIndicator(); + ((GSMPhone) phone).notifyCallForwardingIndicator(); break; }}catch (RuntimeException exc) { // I don't want these exceptions to be fatal Log.w(LOG_TAG, "Exception parsing SIM record", exc); - } finally { + } finally { // Count up record load responses even if they are fails if (isRecordLoadResponse) { onRecordLoaded(); @@ -1039,12 +1000,12 @@ public final class SIMRecords extends IccRecords { case EF_MBDN: recordsToLoad++; new AdnRecordLoader(phone).loadFromEF(EF_MBDN, EF_EXT6, - mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE)); + mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE)); break; case EF_MAILBOX_CPHS: recordsToLoad++; new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1, - 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE)); + 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE)); break; default: // For now, fetch all records if this is not a @@ -1060,7 +1021,7 @@ public final class SIMRecords extends IccRecords { if (result == null || result.length == 0) { return; } - + switch ((result[0])) { case CommandsInterface.SIM_REFRESH_FILE_UPDATED: // result[1] contains the EFID of the updated file. @@ -1111,7 +1072,7 @@ public final class SIMRecords extends IccRecords { Log.i("ENF", "message text " + message.getMessageBody()); - phone.mSMS.dispatchMessage(message); + ((GSMPhone) phone).mSMS.dispatchMessage(message); } } @@ -1146,7 +1107,7 @@ public final class SIMRecords extends IccRecords { Log.i("ENF", "message text " + message.getMessageBody()); - phone.mSMS.dispatchMessage(message); + ((GSMPhone) phone).mSMS.dispatchMessage(message); // 3GPP TS 51.011 v5.0.0 (20011-12) 10.5.3 // 1 == "received by MS from network; message read" @@ -1154,8 +1115,8 @@ public final class SIMRecords extends IccRecords { ba[0] = 1; if (false) { // XXX writing seems to crash RdoServD - ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed(EF_SMS, i, ba, null, - obtainMessage(EVENT_MARK_SMS_READ_DONE, i)); + phone.getIccFileHandler().updateEFLinearFixed(EF_SMS, + i, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, i)); } } } @@ -1173,19 +1134,17 @@ public final class SIMRecords extends IccRecords { recordsToLoad = 0; } } - + protected void onAllRecordsLoaded() { Log.d(LOG_TAG, "SIMRecords: record load complete"); // Some fields require more than one SIM record to set - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_NUMERIC, - getSIMOperatorNumeric()); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, getSIMOperatorNumeric()); if (imsi != null) { - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ISO_COUNTRY, - MccTable.countryCodeForMcc( - Integer.parseInt(imsi.substring(0,3)))); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, + MccTable.countryCodeForMcc(Integer.parseInt(imsi.substring(0,3)))); } else { Log.e("SIM", "[SIMRecords] onAllRecordsLoaded: imsi is NULL!"); @@ -1195,13 +1154,13 @@ public final class SIMRecords extends IccRecords { recordsLoadedRegistrants.notifyRegistrants( new AsyncResult(null, null, null)); - phone.mSimCard.broadcastSimStateChangedIntent( + ((GSMPhone) phone).mSimCard.broadcastSimStateChangedIntent( SimCard.INTENT_VALUE_ICC_LOADED, null); } - + //***** Private Methods - + private void setVoiceMailByCountry (String spn) { if (mVmConfig.containsCarrier(spn)) { isVoiceMailFixed = true; @@ -1214,7 +1173,7 @@ public final class SIMRecords extends IccRecords { /* broadcast intent SIM_READY here so that we can make sure READY is sent before IMSI ready */ - phone.mSimCard.broadcastSimStateChangedIntent( + ((GSMPhone) phone).mSimCard.broadcastSimStateChangedIntent( SimCard.INTENT_VALUE_ICC_READY, null); fetchSimRecords(); @@ -1222,14 +1181,14 @@ public final class SIMRecords extends IccRecords { private void fetchSimRecords() { recordsRequested = true; + IccFileHandler iccFh = phone.getIccFileHandler(); - Log.v(LOG_TAG, "SIMRecords:fetchSimRecords " + recordsToLoad); + Log.v(LOG_TAG, "SIMRecords:fetchSimRecords " + recordsToLoad); phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_ICCID, - obtainMessage(EVENT_GET_ICCID_DONE)); + iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE)); recordsToLoad++; // FIXME should examine EF[MSISDN]'s capability configuration @@ -1239,17 +1198,14 @@ public final class SIMRecords extends IccRecords { recordsToLoad++; // Record number is subscriber profile - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixed(EF_MBI, 1, - obtainMessage(EVENT_GET_MBI_DONE)); + iccFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_AD, - obtainMessage(EVENT_GET_AD_DONE)); + iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE)); recordsToLoad++; // Record number is subscriber profile - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixed(EF_MWIS, 1, - obtainMessage(EVENT_GET_MWIS_DONE)); + iccFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE)); recordsToLoad++; @@ -1257,50 +1213,49 @@ public final class SIMRecords extends IccRecords { // the same info as EF[MWIS]. If both exist, both are updated // but the EF[MWIS] data is preferred // Please note this must be loaded after EF[MWIS] - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent( - EF_VOICE_MAIL_INDICATOR_CPHS, + iccFh.loadEFTransparent( + EF_VOICE_MAIL_INDICATOR_CPHS, obtainMessage(EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE)); recordsToLoad++; // Same goes for Call Forward Status indicator: fetch both // EF[CFIS] and CPHS-EF, with EF[CFIS] preferred. - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE)); + iccFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_CFF_CPHS, - obtainMessage(EVENT_GET_CFF_DONE)); + iccFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE)); recordsToLoad++; getSpnFsm(true, null); - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_SPDI, - obtainMessage(EVENT_GET_SPDI_DONE)); + iccFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixed(EF_PNN, 1, - obtainMessage(EVENT_GET_PNN_DONE)); + iccFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_SST, - obtainMessage(EVENT_GET_SST_DONE)); + iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE)); recordsToLoad++; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent(EF_INFO_CPHS, - obtainMessage(EVENT_GET_INFO_CPHS_DONE)); + iccFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE)); recordsToLoad++; // XXX should seek instead of examining them all if (false) { // XXX - ((SIMFileHandler)phone.getIccFileHandler()).loadEFLinearFixedAll(EF_SMS, - obtainMessage(EVENT_GET_ALL_SMS_DONE)); + iccFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE)); recordsToLoad++; } if (CRASH_RIL) { - String sms = "0107912160130310f20404d0110041007030208054832b0120ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; + String sms = "0107912160130310f20404d0110041007030208054832b0120" + + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + + "ffffffffffffffffffffffffffffff"; byte[] ba = IccUtils.hexStringToBytes(sms); - ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed(EF_SMS, 1, ba, null, + iccFh.updateEFLinearFixed(EF_SMS, 1, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, 1)); } } @@ -1387,7 +1342,7 @@ public final class SIMRecords extends IccRecords { case INIT: spn = null; - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent( EF_SPN, + phone.getIccFileHandler().loadEFTransparent( EF_SPN, obtainMessage(EVENT_GET_SPN_DONE)); recordsToLoad++; @@ -1401,16 +1356,16 @@ public final class SIMRecords extends IccRecords { if (DBG) log("Load EF_SPN: " + spn + " spnDisplayCondition: " + spnDisplayCondition); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ALPHA, spn); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn); spnState = Get_Spn_Fsm_State.IDLE; } else { - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent( EF_SPN_CPHS, + phone.getIccFileHandler().loadEFTransparent( EF_SPN_CPHS, obtainMessage(EVENT_GET_SPN_DONE)); recordsToLoad++; spnState = Get_Spn_Fsm_State.READ_SPN_CPHS; - + // See TS 51.011 10.3.11. Basically, default to // show PLMN always, and SPN also if roaming. spnDisplayCondition = -1; @@ -1423,12 +1378,12 @@ public final class SIMRecords extends IccRecords { data, 0, data.length - 1 ); if (DBG) log("Load EF_SPN_CPHS: " + spn); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ALPHA, spn); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn); spnState = Get_Spn_Fsm_State.IDLE; } else { - ((SIMFileHandler)phone.getIccFileHandler()).loadEFTransparent( EF_SPN_SHORT_CPHS, - obtainMessage(EVENT_GET_SPN_DONE)); + phone.getIccFileHandler().loadEFTransparent( + EF_SPN_SHORT_CPHS, obtainMessage(EVENT_GET_SPN_DONE)); recordsToLoad++; spnState = Get_Spn_Fsm_State.READ_SPN_SHORT_CPHS; @@ -1441,7 +1396,7 @@ public final class SIMRecords extends IccRecords { data, 0, data.length - 1); if (DBG) log("Load EF_SPN_SHORT_CPHS: " + spn); - phone.setSystemProperty(PROPERTY_SIM_OPERATOR_ALPHA, spn); + phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn); }else { if (DBG) log("No SPN loaded in either CHPS or 3GPP"); } @@ -1479,7 +1434,7 @@ public final class SIMRecords extends IccRecords { spdiNetworks = new ArrayList<String>(plmnEntries.length / 3); for (int i = 0 ; i + 2 < plmnEntries.length ; i += 3) { - String plmnCode; + String plmnCode; plmnCode = IccUtils.bcdToString(plmnEntries, i, 3); // Valid operator codes are 5 or 6 digits @@ -1498,7 +1453,9 @@ public final class SIMRecords extends IccRecords { return ((mCphsInfo[1] & CPHS_SST_MBN_MASK) == CPHS_SST_MBN_ENABLED ); } - private void log(String s) { + protected void log(String s) { Log.d(LOG_TAG, "[SIMRecords] " + s); } + } + |