am db08ff76: Merge "Refactor IccRecords and IccCard" into honeycomb-LTE

* commit 'db08ff768b144c6ad8b326300d95c0c60e40f2eb':
  Refactor IccRecords and IccCard
This commit is contained in:
Wink Saville
2011-05-10 16:31:36 -07:00
committed by Android Git Automerger
17 changed files with 226 additions and 169 deletions

View File

@@ -28,6 +28,8 @@ import android.util.Log;
import com.android.internal.telephony.PhoneBase; import com.android.internal.telephony.PhoneBase;
import com.android.internal.telephony.CommandsInterface.RadioState; import com.android.internal.telephony.CommandsInterface.RadioState;
import com.android.internal.telephony.gsm.SIMRecords;
import android.os.SystemProperties; import android.os.SystemProperties;
/** /**
@@ -430,8 +432,14 @@ public abstract class IccCard {
broadcastIccStateChangedIntent(INTENT_VALUE_ICC_LOCKED, broadcastIccStateChangedIntent(INTENT_VALUE_ICC_LOCKED,
INTENT_VALUE_LOCKED_NETWORK); INTENT_VALUE_LOCKED_NETWORK);
} }
/*
* TODO: We need to try to remove this, maybe if the RIL sends up a RIL_UNSOL_SIM_REFRESH?
*/
if (oldState != State.READY && newState == State.READY && LTE_AVAILABLE_ON_CDMA) { if (oldState != State.READY && newState == State.READY && LTE_AVAILABLE_ON_CDMA) {
mPhone.mSIMRecords.onSimReady(); if (mPhone.mIccRecords instanceof SIMRecords) {
((SIMRecords)mPhone.mIccRecords).onSimReady();
}
} }
} }

View File

@@ -21,9 +21,6 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.os.Registrant; import android.os.Registrant;
import android.os.RegistrantList; import android.os.RegistrantList;
import android.util.Log;
import java.util.ArrayList;
/** /**
* {@hide} * {@hide}
@@ -79,6 +76,11 @@ public abstract class IccRecords extends Handler implements IccConstants {
this.phone = p; this.phone = p;
} }
/**
* Call when the IccRecords object is no longer going to be used.
*/
public abstract void dispose();
protected abstract void onRadioOffOrNotAvailable(); protected abstract void onRadioOffOrNotAvailable();
//***** Public Methods //***** Public Methods
@@ -99,6 +101,17 @@ public abstract class IccRecords extends Handler implements IccConstants {
recordsLoadedRegistrants.remove(h); recordsLoadedRegistrants.remove(h);
} }
/**
* Get the International Mobile Subscriber ID (IMSI) on a SIM
* for GSM, UMTS and like networks. Default is null if IMSI is
* not supported or unavailable.
*
* @return null if SIM is not yet ready or unavailable
*/
public String getIMSI() {
return null;
}
public String getMsisdnNumber() { public String getMsisdnNumber() {
return msisdn; return msisdn;
} }
@@ -220,6 +233,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
} }
//***** Overridden from Handler //***** Overridden from Handler
@Override
public abstract void handleMessage(Message msg); public abstract void handleMessage(Message msg);
protected abstract void onRecordLoaded(); protected abstract void onRecordLoaded();
@@ -232,8 +246,51 @@ public abstract class IccRecords extends Handler implements IccConstants {
* and TS 51.011 10.3.11 for details. * and TS 51.011 10.3.11 for details.
* *
* If the SPN is not found on the SIM, the rule is always PLMN_ONLY. * If the SPN is not found on the SIM, the rule is always PLMN_ONLY.
* Generally used for GSM/UMTS and the like SIMs.
*/ */
protected abstract int getDisplayRule(String plmn); public abstract int getDisplayRule(String plmn);
/**
* Return true if "Restriction of menu options for manual PLMN selection"
* bit is set or EF_CSP data is unavailable, return false otherwise.
* Generally used for GSM/UMTS and the like SIMs.
*/
public boolean isCspPlmnEnabled() {
return false;
}
/**
* Returns the 5 or 6 digit MCC/MNC of the operator that
* provided the SIM card. Returns null of SIM is not yet ready
* or is not valid for the type of IccCard. Generally used for
* GSM/UMTS and the like SIMS
*/
public String getOperatorNumeric() {
return null;
}
/**
* Get the current Voice call forwarding flag for GSM/UMTS and the like SIMs
*
* @return true if enabled
*/
public boolean getVoiceCallForwardingFlag() {
return false;
}
/**
* Set the voice call forwarding flag for GSM/UMTS and the like SIMs
*
* @param line to enable/disable
* @param enable
*/
public void setVoiceCallForwardingFlag(int line, boolean enable) {
}
/**
* Write string to log file
*
* @param s is the string to write
*/
protected abstract void log(String s); protected abstract void log(String s);
} }

View File

@@ -118,8 +118,8 @@ public abstract class PhoneBase extends Handler implements Phone {
int mCallRingDelay; int mCallRingDelay;
public boolean mIsTheCurrentActivePhone = true; public boolean mIsTheCurrentActivePhone = true;
boolean mIsVoiceCapable = true; boolean mIsVoiceCapable = true;
public SIMRecords mSIMRecords; public IccRecords mIccRecords;
public SimCard mSimCard; public IccCard mIccCard;
public SMSDispatcher mSMS; public SMSDispatcher mSMS;
/** /**
@@ -681,6 +681,31 @@ public abstract class PhoneBase extends Handler implements Phone {
return null; return null;
} }
@Override
public IccCard getIccCard() {
return mIccCard;
}
@Override
public String getIccSerialNumber() {
return mIccRecords.iccid;
}
@Override
public boolean getIccRecordsLoaded() {
return mIccRecords.getRecordsLoaded();
}
@Override
public boolean getMessageWaitingIndicator() {
return mIccRecords.getVoiceMessageWaiting();
}
@Override
public boolean getCallForwardingIndicator() {
return mIccRecords.getVoiceCallForwardingFlag();
}
/** /**
* Query the status of the CDMA roaming preference * Query the status of the CDMA roaming preference
*/ */

View File

@@ -48,58 +48,30 @@ public class CDMALTEPhone extends CDMAPhone {
// Constructors // Constructors
public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) { public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
this(context, ci, notifier, false); this(context, ci, notifier, false);
log("CDMALTEPhone Constructors");
} }
public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier, public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
boolean unitTestMode) { boolean unitTestMode) {
super(context, ci, notifier, false); super(context, ci, notifier, false);
mSIMRecords = new SIMRecords(this);
mSimCard = new SimCard(this, LOG_TAG, DBG);
} }
@Override @Override
protected void initSST() { protected void initSstIcc() {
mSST = new CdmaLteServiceStateTracker(this); mSST = new CdmaLteServiceStateTracker(this);
} mIccRecords = new SIMRecords(this);
mIccCard = new SimCard(this, LOG_TAG, DBG);
public void dispose() {
synchronized (PhoneProxy.lockForRadioTechnologyChange) {
super.dispose();
mSIMRecords.dispose();
mSimCard.dispose();
}
}
@Override
public void removeReferences() {
super.removeReferences();
this.mSIMRecords = null;
this.mSimCard = null;
}
@Override
public ServiceStateTracker getServiceStateTracker() {
return mSST;
}
public IccCard getIccCard() {
return mSimCard;
}
@Override
public String getIccSerialNumber() {
return mSIMRecords.iccid;
} }
@Override @Override
public DataState getDataConnectionState(String apnType) { public DataState getDataConnectionState(String apnType) {
// TODO: Remove instanceof if possible.
boolean isCdmaDataConnectionTracker = false; boolean isCdmaDataConnectionTracker = false;
if (mDataConnectionTracker instanceof CdmaDataConnectionTracker) { if (mDataConnectionTracker instanceof CdmaDataConnectionTracker) {
log("getDataConnectionState isCdmaDataConnectionTracker");
isCdmaDataConnectionTracker = true; isCdmaDataConnectionTracker = true;
} else {
log("getDataConnectionState NOT CdmaDataConnectionTracker");
} }
log("getDataConnectionState");
DataState ret = DataState.DISCONNECTED; DataState ret = DataState.DISCONNECTED;
if (!isCdmaDataConnectionTracker && (SystemProperties.get("adb.connected", "").length() if (!isCdmaDataConnectionTracker && (SystemProperties.get("adb.connected", "").length()
@@ -145,28 +117,29 @@ public class CDMALTEPhone extends CDMAPhone {
} }
} }
log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
return ret; return ret;
} }
public boolean updateCurrentCarrierInProvider() { public boolean updateCurrentCarrierInProvider() {
if (mSIMRecords != null) { if (mIccRecords != null) {
try { try {
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"); Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
ContentValues map = new ContentValues(); ContentValues map = new ContentValues();
map.put(Telephony.Carriers.NUMERIC, mSIMRecords.getSIMOperatorNumeric()); map.put(Telephony.Carriers.NUMERIC, mIccRecords.getOperatorNumeric());
log("updateCurrentCarrierInProvider insert uri=" + uri);
mContext.getContentResolver().insert(uri, map); mContext.getContentResolver().insert(uri, map);
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
Log.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator", e); Log.e(LOG_TAG, "[CDMALTEPhone] Can't store current operator ret false", e);
} }
} else {
log("updateCurrentCarrierInProvider mIccRecords == null ret false");
} }
return false; return false;
} }
public String getActiveApn(String apnType) { @Override
return mDataConnectionTracker.getActiveApnString(apnType);
}
protected void log(String s) { protected void log(String s) {
if (DBG) if (DBG)
Log.d(LOG_TAG, "[CDMALTEPhone] " + s); Log.d(LOG_TAG, "[CDMALTEPhone] " + s);

View File

@@ -49,6 +49,7 @@ import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface; import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection; import com.android.internal.telephony.Connection;
import com.android.internal.telephony.DataConnection; import com.android.internal.telephony.DataConnection;
import com.android.internal.telephony.IccRecords;
import com.android.internal.telephony.MccTable; import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.IccCard; import com.android.internal.telephony.IccCard;
import com.android.internal.telephony.IccException; import com.android.internal.telephony.IccException;
@@ -99,8 +100,6 @@ public class CDMAPhone extends PhoneBase {
// Instance Variables // Instance Variables
CdmaCallTracker mCT; CdmaCallTracker mCT;
CdmaServiceStateTracker mSST; CdmaServiceStateTracker mSST;
RuimRecords mRuimRecords;
RuimCard mRuimCard;
ArrayList <CdmaMmiCode> mPendingMmis = new ArrayList<CdmaMmiCode>(); ArrayList <CdmaMmiCode> mPendingMmis = new ArrayList<CdmaMmiCode>();
RuimPhoneBookInterfaceManager mRuimPhoneBookInterfaceManager; RuimPhoneBookInterfaceManager mRuimPhoneBookInterfaceManager;
RuimSmsInterfaceManager mRuimSmsInterfaceManager; RuimSmsInterfaceManager mRuimSmsInterfaceManager;
@@ -142,19 +141,21 @@ public class CDMAPhone extends PhoneBase {
// Constructors // Constructors
public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) { public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
super(notifier, context, ci, false); super(notifier, context, ci, false);
initSST(); initSstIcc();
init(context, notifier); init(context, notifier);
} }
public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier, public CDMAPhone(Context context, CommandsInterface ci, PhoneNotifier notifier,
boolean unitTestMode) { boolean unitTestMode) {
super(notifier, context, ci, unitTestMode); super(notifier, context, ci, unitTestMode);
initSST(); initSstIcc();
init(context, notifier); init(context, notifier);
} }
protected void initSST() { protected void initSstIcc() {
mSST = new CdmaServiceStateTracker(this); mSST = new CdmaServiceStateTracker(this);
mIccRecords = new RuimRecords(this);
mIccCard = new RuimCard(this, LOG_TAG, DBG);
} }
protected void init(Context context, PhoneNotifier notifier) { protected void init(Context context, PhoneNotifier notifier) {
@@ -162,18 +163,16 @@ public class CDMAPhone extends PhoneBase {
mCT = new CdmaCallTracker(this); mCT = new CdmaCallTracker(this);
mSMS = new CdmaSMSDispatcher(this); mSMS = new CdmaSMSDispatcher(this);
mIccFileHandler = new RuimFileHandler(this); mIccFileHandler = new RuimFileHandler(this);
mRuimRecords = new RuimRecords(this);
mDataConnectionTracker = new CdmaDataConnectionTracker (this); mDataConnectionTracker = new CdmaDataConnectionTracker (this);
mRuimCard = new RuimCard(this);
mRuimPhoneBookInterfaceManager = new RuimPhoneBookInterfaceManager(this); mRuimPhoneBookInterfaceManager = new RuimPhoneBookInterfaceManager(this);
mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this, mSMS); mRuimSmsInterfaceManager = new RuimSmsInterfaceManager(this, mSMS);
mSubInfo = new PhoneSubInfo(this); mSubInfo = new PhoneSubInfo(this);
mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML); mEriManager = new EriManager(this, context, EriManager.ERI_FROM_XML);
mCcatService = CatService.getInstance(mCM, mRuimRecords, mContext, mCcatService = CatService.getInstance(mCM, mIccRecords, mContext,
mIccFileHandler, mRuimCard); mIccFileHandler, mIccCard);
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
mRuimRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null); mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mCM.registerForOn(this, EVENT_RADIO_ON, null); mCM.registerForOn(this, EVENT_RADIO_ON, null);
mCM.setOnSuppServiceNotification(this, EVENT_SSN, null); mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
@@ -222,9 +221,10 @@ public class CDMAPhone extends PhoneBase {
public void dispose() { public void dispose() {
synchronized(PhoneProxy.lockForRadioTechnologyChange) { synchronized(PhoneProxy.lockForRadioTechnologyChange) {
super.dispose(); super.dispose();
log("dispose");
//Unregister from all former registered events //Unregister from all former registered events
mRuimRecords.unregisterForRecordsLoaded(this); //EVENT_RUIM_RECORDS_LOADED mIccRecords.unregisterForRecordsLoaded(this); //EVENT_RUIM_RECORDS_LOADED
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
mCM.unregisterForOn(this); //EVENT_RADIO_ON mCM.unregisterForOn(this); //EVENT_RADIO_ON
@@ -241,8 +241,8 @@ public class CDMAPhone extends PhoneBase {
mSST.dispose(); mSST.dispose();
mSMS.dispose(); mSMS.dispose();
mIccFileHandler.dispose(); // instance of RuimFileHandler mIccFileHandler.dispose(); // instance of RuimFileHandler
mRuimRecords.dispose(); mIccRecords.dispose();
mRuimCard.dispose(); mIccCard.dispose();
mRuimPhoneBookInterfaceManager.dispose(); mRuimPhoneBookInterfaceManager.dispose();
mRuimSmsInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose();
mSubInfo.dispose(); mSubInfo.dispose();
@@ -252,13 +252,14 @@ public class CDMAPhone extends PhoneBase {
} }
public void removeReferences() { public void removeReferences() {
log("removeReferences");
this.mRuimPhoneBookInterfaceManager = null; this.mRuimPhoneBookInterfaceManager = null;
this.mRuimSmsInterfaceManager = null; this.mRuimSmsInterfaceManager = null;
this.mSMS = null; this.mSMS = null;
this.mSubInfo = null; this.mSubInfo = null;
this.mRuimRecords = null; this.mIccRecords = null;
this.mIccFileHandler = null; this.mIccFileHandler = null;
this.mRuimCard = null; this.mIccCard = null;
this.mDataConnectionTracker = null; this.mDataConnectionTracker = null;
this.mCT = null; this.mCT = null;
this.mSST = null; this.mSST = null;
@@ -547,14 +548,6 @@ public class CDMAPhone extends PhoneBase {
Log.e(LOG_TAG, "setLine1Number: not possible in CDMA"); Log.e(LOG_TAG, "setLine1Number: not possible in CDMA");
} }
public IccCard getIccCard() {
return mRuimCard;
}
public String getIccSerialNumber() {
return mRuimRecords.iccid;
}
public void setCallWaiting(boolean enable, Message onComplete) { public void setCallWaiting(boolean enable, Message onComplete) {
Log.e(LOG_TAG, "method setCallWaiting is NOT supported in CDMA!"); Log.e(LOG_TAG, "method setCallWaiting is NOT supported in CDMA!");
} }
@@ -657,6 +650,7 @@ public class CDMAPhone extends PhoneBase {
} }
} }
log("getDataConnectionState apnType=" + apnType + " ret=" + ret);
return ret; return ret;
} }
@@ -733,7 +727,7 @@ public class CDMAPhone extends PhoneBase {
Message resp; Message resp;
mVmNumber = voiceMailNumber; mVmNumber = voiceMailNumber;
resp = obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete); resp = obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete);
mRuimRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp); mIccRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp);
} }
public String getVoiceMailNumber() { public String getVoiceMailNumber() {
@@ -755,7 +749,7 @@ public class CDMAPhone extends PhoneBase {
* @hide * @hide
*/ */
public int getVoiceMessageCount() { public int getVoiceMessageCount() {
int voicemailCount = mRuimRecords.getVoiceMessageCount(); int voicemailCount = mIccRecords.getVoiceMessageCount();
// If mRuimRecords.getVoiceMessageCount returns zero, then there is possibility // If mRuimRecords.getVoiceMessageCount returns zero, then there is possibility
// that phone was power cycled and would have lost the voicemail count. // that phone was power cycled and would have lost the voicemail count.
// So get the count from preferences. // So get the count from preferences.
@@ -780,10 +774,6 @@ public class CDMAPhone extends PhoneBase {
return ret; return ret;
} }
public boolean getIccRecordsLoaded() {
return mRuimRecords.getRecordsLoaded();
}
public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) { public void getCallForwardingOption(int commandInterfaceCFReason, Message onComplete) {
Log.e(LOG_TAG, "getCallForwardingOption: not possible in CDMA"); Log.e(LOG_TAG, "getCallForwardingOption: not possible in CDMA");
} }
@@ -864,13 +854,13 @@ public class CDMAPhone extends PhoneBase {
/*package*/ void /*package*/ void
updateMessageWaitingIndicator(boolean mwi) { updateMessageWaitingIndicator(boolean mwi) {
// this also calls notifyMessageWaitingIndicator() // this also calls notifyMessageWaitingIndicator()
mRuimRecords.setVoiceMessageWaiting(1, mwi ? -1 : 0); mIccRecords.setVoiceMessageWaiting(1, mwi ? -1 : 0);
} }
/* This function is overloaded to send number of voicemails instead of sending true/false */ /* This function is overloaded to send number of voicemails instead of sending true/false */
/*package*/ void /*package*/ void
updateMessageWaitingIndicator(int mwi) { updateMessageWaitingIndicator(int mwi) {
mRuimRecords.setVoiceMessageWaiting(1, mwi); mIccRecords.setVoiceMessageWaiting(1, mwi);
} }
@Override @Override
@@ -1417,6 +1407,7 @@ public class CDMAPhone extends PhoneBase {
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"); Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
ContentValues map = new ContentValues(); ContentValues map = new ContentValues();
map.put(Telephony.Carriers.NUMERIC, operatorNumeric); map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
log("updateCurrentCarrierInProvider insert uri=" + uri);
getContext().getContentResolver().insert(uri, map); getContext().getContentResolver().insert(uri, map);
// Updates MCC MNC device configuration information // Updates MCC MNC device configuration information
@@ -1429,4 +1420,9 @@ public class CDMAPhone extends PhoneBase {
} }
return false; return false;
} }
protected void log(String s) {
if (DBG)
Log.d(LOG_TAG, "[CDMAPhone] " + s);
}
} }

View File

@@ -98,7 +98,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null); p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null);
p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
p.mRuimRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null); p.mIccRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null);
p.mCM.registerForNVReady(this, EVENT_NV_READY, null); p.mCM.registerForNVReady(this, EVENT_NV_READY, null);
p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null); p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null);
p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null); p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null);
@@ -124,7 +124,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
// Unregister from all events // Unregister from all events
mPhone.mCM.unregisterForAvailable(this); mPhone.mCM.unregisterForAvailable(this);
mPhone.mCM.unregisterForOffOrNotAvailable(this); mPhone.mCM.unregisterForOffOrNotAvailable(this);
mCdmaPhone.mRuimRecords.unregisterForRecordsLoaded(this); mCdmaPhone.mIccRecords.unregisterForRecordsLoaded(this);
mPhone.mCM.unregisterForNVReady(this); mPhone.mCM.unregisterForNVReady(this);
mPhone.mCM.unregisterForDataNetworkStateChanged(this); mPhone.mCM.unregisterForDataNetworkStateChanged(this);
mCdmaPhone.mCT.unregisterForVoiceCallEnded(this); mCdmaPhone.mCT.unregisterForVoiceCallEnded(this);
@@ -183,7 +183,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
(psState == ServiceState.STATE_IN_SERVICE || (psState == ServiceState.STATE_IN_SERVICE ||
mAutoAttachOnCreation) && mAutoAttachOnCreation) &&
(mPhone.mCM.getNvState() == CommandsInterface.RadioState.NV_READY || (mPhone.mCM.getNvState() == CommandsInterface.RadioState.NV_READY ||
mCdmaPhone.mRuimRecords.getRecordsLoaded()) && mCdmaPhone.mIccRecords.getRecordsLoaded()) &&
(mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() || (mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() ||
mPhone.getState() == Phone.State.IDLE) && mPhone.getState() == Phone.State.IDLE) &&
!roaming && !roaming &&
@@ -197,7 +197,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
reason += " - psState= " + psState; reason += " - psState= " + psState;
} }
if (!(mPhone.mCM.getNvState() == CommandsInterface.RadioState.NV_READY || if (!(mPhone.mCM.getNvState() == CommandsInterface.RadioState.NV_READY ||
mCdmaPhone.mRuimRecords.getRecordsLoaded())) { mCdmaPhone.mIccRecords.getRecordsLoaded())) {
reason += " - radioState= " + mPhone.mCM.getNvState() + " - RUIM not loaded"; reason += " - radioState= " + mPhone.mCM.getNvState() + " - RUIM not loaded";
} }
if (!(mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() || if (!(mCdmaPhone.mSST.isConcurrentVoiceAndDataAllowed() ||

View File

@@ -214,7 +214,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
cm.unregisterForNVReady(this); cm.unregisterForNVReady(this);
cm.unregisterForCdmaOtaProvision(this); cm.unregisterForCdmaOtaProvision(this);
phone.unregisterForEriFileLoaded(this); phone.unregisterForEriFileLoaded(this);
phone.mRuimRecords.unregisterForRecordsLoaded(this); phone.mIccRecords.unregisterForRecordsLoaded(this);
cm.unSetOnSignalStrengthUpdate(this); cm.unSetOnSignalStrengthUpdate(this);
cm.unSetOnNITZTime(this); cm.unSetOnNITZTime(this);
cr.unregisterContentObserver(mAutoTimeObserver); cr.unregisterContentObserver(mAutoTimeObserver);
@@ -260,7 +260,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
// unlocked. At this stage, the radio is already powered on. // unlocked. At this stage, the radio is already powered on.
isSubscriptionFromRuim = true; isSubscriptionFromRuim = true;
if (mNeedToRegForRuimLoaded) { if (mNeedToRegForRuimLoaded) {
phone.mRuimRecords.registerForRecordsLoaded(this, phone.mIccRecords.registerForRecordsLoaded(this,
EVENT_RUIM_RECORDS_LOADED, null); EVENT_RUIM_RECORDS_LOADED, null);
mNeedToRegForRuimLoaded = false; mNeedToRegForRuimLoaded = false;
} }

View File

@@ -25,8 +25,8 @@ import com.android.internal.telephony.IccCard;
*/ */
public final class RuimCard extends IccCard { public final class RuimCard extends IccCard {
RuimCard(CDMAPhone phone) { RuimCard(CDMAPhone phone, String LOG_TAG, boolean dbg) {
super(phone, "CDMA", true); super(phone, LOG_TAG, dbg);
mPhone.mCM.registerForRUIMLockedOrAbsent(mHandler, EVENT_ICC_LOCKED_OR_ABSENT, null); mPhone.mCM.registerForRUIMLockedOrAbsent(mHandler, EVENT_ICC_LOCKED_OR_ABSENT, null);
mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mPhone.mCM.registerForRUIMReady(mHandler, EVENT_ICC_READY, null); mPhone.mCM.registerForRUIMReady(mHandler, EVENT_ICC_READY, null);
@@ -43,7 +43,7 @@ public final class RuimCard extends IccCard {
@Override @Override
public String getServiceProviderName () { public String getServiceProviderName () {
return ((CDMAPhone)mPhone).mRuimRecords.getServiceProviderName(); return mPhone.mIccRecords.getServiceProviderName();
} }
} }

View File

@@ -32,7 +32,7 @@ public class RuimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager
public RuimPhoneBookInterfaceManager(CDMAPhone phone) { public RuimPhoneBookInterfaceManager(CDMAPhone phone) {
super(phone); super(phone);
adnCache = phone.mRuimRecords.getAdnCache(); adnCache = phone.mIccRecords.getAdnCache();
//NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy //NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy
} }

View File

@@ -98,6 +98,7 @@ public final class RuimRecords extends IccRecords {
} }
@Override
public void dispose() { public void dispose() {
//Unregister for all events //Unregister for all events
phone.mCM.unregisterForRUIMReady(this); phone.mCM.unregisterForRUIMReady(this);
@@ -334,7 +335,7 @@ public final class RuimRecords extends IccRecords {
} }
recordsLoadedRegistrants.notifyRegistrants( recordsLoadedRegistrants.notifyRegistrants(
new AsyncResult(null, null, null)); new AsyncResult(null, null, null));
((CDMAPhone) phone).mRuimCard.broadcastIccStateChangedIntent( phone.mIccCard.broadcastIccStateChangedIntent(
RuimCard.INTENT_VALUE_ICC_LOADED, null); RuimCard.INTENT_VALUE_ICC_LOADED, null);
} }
@@ -343,7 +344,7 @@ public final class RuimRecords extends IccRecords {
READY is sent before IMSI ready READY is sent before IMSI ready
*/ */
((CDMAPhone) phone).mRuimCard.broadcastIccStateChangedIntent( phone.mIccCard.broadcastIccStateChangedIntent(
RuimCard.INTENT_VALUE_ICC_READY, null); RuimCard.INTENT_VALUE_ICC_READY, null);
fetchRuimRecords(); fetchRuimRecords();
@@ -368,8 +369,13 @@ public final class RuimRecords extends IccRecords {
// Further records that can be inserted are Operator/OEM dependent // Further records that can be inserted are Operator/OEM dependent
} }
/**
* {@inheritDoc}
*
* No Display rule for RUIMs yet.
*/
@Override @Override
protected int getDisplayRule(String plmn) { public int getDisplayRule(String plmn) {
// TODO together with spn // TODO together with spn
return 0; return 0;
} }

View File

@@ -142,19 +142,18 @@ public class GSMPhone extends PhoneBase {
mSST = new GsmServiceStateTracker (this); mSST = new GsmServiceStateTracker (this);
mSMS = new GsmSMSDispatcher(this); mSMS = new GsmSMSDispatcher(this);
mIccFileHandler = new SIMFileHandler(this); mIccFileHandler = new SIMFileHandler(this);
mSIMRecords = new SIMRecords(this); mIccRecords = new SIMRecords(this);
mDataConnectionTracker = new GsmDataConnectionTracker (this); mDataConnectionTracker = new GsmDataConnectionTracker (this);
mSimCard = new SimCard(this); mIccCard = new SimCard(this);
if (!unitTestMode) { if (!unitTestMode) {
mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this); mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this);
mSimSmsIntManager = new SimSmsInterfaceManager(this, mSMS); mSimSmsIntManager = new SimSmsInterfaceManager(this, mSMS);
mSubInfo = new PhoneSubInfo(this); mSubInfo = new PhoneSubInfo(this);
} }
mStkService = CatService.getInstance(mCM, mSIMRecords, mContext, mStkService = CatService.getInstance(mCM, mIccRecords, mContext, mIccFileHandler, mIccCard);
(SIMFileHandler)mIccFileHandler, mSimCard);
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
mSIMRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null); mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
mCM.registerForOn(this, EVENT_RADIO_ON, null); mCM.registerForOn(this, EVENT_RADIO_ON, null);
mCM.setOnUSSD(this, EVENT_USSD, null); mCM.setOnUSSD(this, EVENT_USSD, null);
@@ -206,7 +205,7 @@ public class GSMPhone extends PhoneBase {
//Unregister from all former registered events //Unregister from all former registered events
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
mSIMRecords.unregisterForRecordsLoaded(this); //EVENT_SIM_RECORDS_LOADED mIccRecords.unregisterForRecordsLoaded(this); //EVENT_SIM_RECORDS_LOADED
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
mCM.unregisterForOn(this); //EVENT_RADIO_ON mCM.unregisterForOn(this); //EVENT_RADIO_ON
mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
@@ -221,8 +220,8 @@ public class GSMPhone extends PhoneBase {
mDataConnectionTracker.dispose(); mDataConnectionTracker.dispose();
mSST.dispose(); mSST.dispose();
mIccFileHandler.dispose(); // instance of SimFileHandler mIccFileHandler.dispose(); // instance of SimFileHandler
mSIMRecords.dispose(); mIccRecords.dispose();
mSimCard.dispose(); mIccCard.dispose();
mSimPhoneBookIntManager.dispose(); mSimPhoneBookIntManager.dispose();
mSimSmsIntManager.dispose(); mSimSmsIntManager.dispose();
mSubInfo.dispose(); mSubInfo.dispose();
@@ -236,9 +235,9 @@ public class GSMPhone extends PhoneBase {
this.mSimSmsIntManager = null; this.mSimSmsIntManager = null;
this.mSMS = null; this.mSMS = null;
this.mSubInfo = null; this.mSubInfo = null;
this.mSIMRecords = null; this.mIccRecords = null;
this.mIccFileHandler = null; this.mIccFileHandler = null;
this.mSimCard = null; this.mIccCard = null;
this.mDataConnectionTracker = null; this.mDataConnectionTracker = null;
this.mCT = null; this.mCT = null;
this.mSST = null; this.mSST = null;
@@ -274,14 +273,6 @@ public class GSMPhone extends PhoneBase {
return mSST.mSignalStrength; return mSST.mSignalStrength;
} }
public boolean getMessageWaitingIndicator() {
return mSIMRecords.getVoiceMessageWaiting();
}
public boolean getCallForwardingIndicator() {
return mSIMRecords.getVoiceCallForwardingFlag();
}
public CallTracker getCallTracker() { public CallTracker getCallTracker() {
return mCT; return mCT;
} }
@@ -419,7 +410,7 @@ public class GSMPhone extends PhoneBase {
/*package*/ void /*package*/ void
updateMessageWaitingIndicator(boolean mwi) { updateMessageWaitingIndicator(boolean mwi) {
// this also calls notifyMessageWaitingIndicator() // this also calls notifyMessageWaitingIndicator()
mSIMRecords.setVoiceMessageWaiting(1, mwi ? -1 : 0); mIccRecords.setVoiceMessageWaiting(1, mwi ? -1 : 0);
} }
public void public void
@@ -820,7 +811,7 @@ public class GSMPhone extends PhoneBase {
public String getVoiceMailNumber() { public String getVoiceMailNumber() {
// Read from the SIM. If its null, try reading from the shared preference area. // Read from the SIM. If its null, try reading from the shared preference area.
String number = mSIMRecords.getVoiceMailNumber(); String number = mIccRecords.getVoiceMailNumber();
if (TextUtils.isEmpty(number)) { if (TextUtils.isEmpty(number)) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
number = sp.getString(VM_NUMBER, null); number = sp.getString(VM_NUMBER, null);
@@ -843,7 +834,7 @@ public class GSMPhone extends PhoneBase {
public String getVoiceMailAlphaTag() { public String getVoiceMailAlphaTag() {
String ret; String ret;
ret = mSIMRecords.getVoiceMailAlphaTag(); ret = mIccRecords.getVoiceMailAlphaTag();
if (ret == null || ret.length() == 0) { if (ret == null || ret.length() == 0) {
return mContext.getText( return mContext.getText(
@@ -872,23 +863,19 @@ public class GSMPhone extends PhoneBase {
} }
public String getSubscriberId() { public String getSubscriberId() {
return mSIMRecords.imsi; return mIccRecords.getIMSI();
}
public String getIccSerialNumber() {
return mSIMRecords.iccid;
} }
public String getLine1Number() { public String getLine1Number() {
return mSIMRecords.getMsisdnNumber(); return mIccRecords.getMsisdnNumber();
} }
public String getLine1AlphaTag() { public String getLine1AlphaTag() {
return mSIMRecords.getMsisdnAlphaTag(); return mIccRecords.getMsisdnAlphaTag();
} }
public void setLine1Number(String alphaTag, String number, Message onComplete) { public void setLine1Number(String alphaTag, String number, Message onComplete) {
mSIMRecords.setMsisdnNumber(alphaTag, number, onComplete); mIccRecords.setMsisdnNumber(alphaTag, number, onComplete);
} }
public void setVoiceMailNumber(String alphaTag, public void setVoiceMailNumber(String alphaTag,
@@ -898,7 +885,7 @@ public class GSMPhone extends PhoneBase {
Message resp; Message resp;
mVmNumber = voiceMailNumber; mVmNumber = voiceMailNumber;
resp = obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete); resp = obtainMessage(EVENT_SET_VM_NUMBER_DONE, 0, 0, onComplete);
mSIMRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp); mIccRecords.setVoiceMailNumber(alphaTag, mVmNumber, resp);
} }
private boolean isValidCommandInterfaceCFReason (int commandInterfaceCFReason) { private boolean isValidCommandInterfaceCFReason (int commandInterfaceCFReason) {
@@ -988,15 +975,6 @@ public class GSMPhone extends PhoneBase {
mCM.setCallWaiting(enable, CommandsInterface.SERVICE_CLASS_VOICE, onComplete); mCM.setCallWaiting(enable, CommandsInterface.SERVICE_CLASS_VOICE, onComplete);
} }
public boolean
getIccRecordsLoaded() {
return mSIMRecords.getRecordsLoaded();
}
public IccCard getIccCard() {
return mSimCard;
}
public void public void
getAvailableNetworks(Message response) { getAvailableNetworks(Message response) {
mCM.getAvailableNetworks(response); mCM.getAvailableNetworks(response);
@@ -1276,7 +1254,7 @@ public class GSMPhone extends PhoneBase {
case EVENT_SET_CALL_FORWARD_DONE: case EVENT_SET_CALL_FORWARD_DONE:
ar = (AsyncResult)msg.obj; ar = (AsyncResult)msg.obj;
if (ar.exception == null) { if (ar.exception == null) {
mSIMRecords.setVoiceCallForwardingFlag(1, msg.arg1 == 1); mIccRecords.setVoiceCallForwardingFlag(1, msg.arg1 == 1);
} }
onComplete = (Message) ar.userObj; onComplete = (Message) ar.userObj;
if (onComplete != null) { if (onComplete != null) {
@@ -1340,11 +1318,11 @@ public class GSMPhone extends PhoneBase {
* @return true for success; false otherwise. * @return true for success; false otherwise.
*/ */
boolean updateCurrentCarrierInProvider() { boolean updateCurrentCarrierInProvider() {
if (mSIMRecords != null) { if (mIccRecords != null) {
try { try {
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"); Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
ContentValues map = new ContentValues(); ContentValues map = new ContentValues();
map.put(Telephony.Carriers.NUMERIC, mSIMRecords.getSIMOperatorNumeric()); map.put(Telephony.Carriers.NUMERIC, mIccRecords.getOperatorNumeric());
mContext.getContentResolver().insert(uri, map); mContext.getContentResolver().insert(uri, map);
return true; return true;
} catch (SQLException e) { } catch (SQLException e) {
@@ -1409,11 +1387,11 @@ public class GSMPhone extends PhoneBase {
if (infos == null || infos.length == 0) { if (infos == null || infos.length == 0) {
// Assume the default is not active // Assume the default is not active
// Set unconditional CFF in SIM to false // Set unconditional CFF in SIM to false
mSIMRecords.setVoiceCallForwardingFlag(1, false); mIccRecords.setVoiceCallForwardingFlag(1, false);
} else { } else {
for (int i = 0, s = infos.length; i < s; i++) { for (int i = 0, s = infos.length; i < s; i++) {
if ((infos[i].serviceClass & SERVICE_CLASS_VOICE) != 0) { if ((infos[i].serviceClass & SERVICE_CLASS_VOICE) != 0) {
mSIMRecords.setVoiceCallForwardingFlag(1, (infos[i].status == 1)); mIccRecords.setVoiceCallForwardingFlag(1, (infos[i].status == 1));
// should only have the one // should only have the one
break; break;
} }
@@ -1462,6 +1440,6 @@ public class GSMPhone extends PhoneBase {
} }
public boolean isCspPlmnEnabled() { public boolean isCspPlmnEnabled() {
return mSIMRecords.isCspPlmnEnabled(); return mIccRecords.isCspPlmnEnabled();
} }
} }

View File

@@ -143,7 +143,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null); p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null);
p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
p.mSIMRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null); p.mIccRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null);
p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null); p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null);
p.getCallTracker().registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null); p.getCallTracker().registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null);
p.getCallTracker().registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null); p.getCallTracker().registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null);
@@ -179,7 +179,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
//Unregister for all events //Unregister for all events
mPhone.mCM.unregisterForAvailable(this); mPhone.mCM.unregisterForAvailable(this);
mPhone.mCM.unregisterForOffOrNotAvailable(this); mPhone.mCM.unregisterForOffOrNotAvailable(this);
mPhone.mSIMRecords.unregisterForRecordsLoaded(this); mPhone.mIccRecords.unregisterForRecordsLoaded(this);
mPhone.mCM.unregisterForDataNetworkStateChanged(this); mPhone.mCM.unregisterForDataNetworkStateChanged(this);
mPhone.getCallTracker().unregisterForVoiceCallEnded(this); mPhone.getCallTracker().unregisterForVoiceCallEnded(this);
mPhone.getCallTracker().unregisterForVoiceCallStarted(this); mPhone.getCallTracker().unregisterForVoiceCallStarted(this);
@@ -582,7 +582,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
boolean allowed = boolean allowed =
gprsState == ServiceState.STATE_IN_SERVICE && gprsState == ServiceState.STATE_IN_SERVICE &&
mPhone.mSIMRecords.getRecordsLoaded() && mPhone.mIccRecords.getRecordsLoaded() &&
mPhone.getState() == Phone.State.IDLE && mPhone.getState() == Phone.State.IDLE &&
mInternalDataEnabled && mInternalDataEnabled &&
(!mPhone.getServiceState().getRoaming() || getDataOnRoamingEnabled()) && (!mPhone.getServiceState().getRoaming() || getDataOnRoamingEnabled()) &&
@@ -593,7 +593,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
if (!(gprsState == ServiceState.STATE_IN_SERVICE)) { if (!(gprsState == ServiceState.STATE_IN_SERVICE)) {
reason += " - gprs= " + gprsState; reason += " - gprs= " + gprsState;
} }
if (!mPhone.mSIMRecords.getRecordsLoaded()) reason += " - SIM not loaded"; if (!mPhone.mIccRecords.getRecordsLoaded()) reason += " - SIM not loaded";
if (mPhone.getState() != Phone.State.IDLE) { if (mPhone.getState() != Phone.State.IDLE) {
reason += " - PhoneState= " + mPhone.getState(); reason += " - PhoneState= " + mPhone.getState();
} }
@@ -1510,7 +1510,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
log("onRadioAvailable: We're on the simulator; assuming data is connected"); log("onRadioAvailable: We're on the simulator; assuming data is connected");
} }
if (mPhone.mSIMRecords.getRecordsLoaded()) { if (mPhone.mIccRecords.getRecordsLoaded()) {
notifyDataAvailability(null); notifyDataAvailability(null);
} }
@@ -1757,7 +1757,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
*/ */
private void createAllApnList() { private void createAllApnList() {
mAllApns = new ArrayList<ApnSetting>(); mAllApns = new ArrayList<ApnSetting>();
String operator = mPhone.mSIMRecords.getSIMOperatorNumeric(); String operator = mPhone.mIccRecords.getOperatorNumeric();
if (operator != null) { if (operator != null) {
String selection = "numeric = '" + operator + "'"; String selection = "numeric = '" + operator + "'";
if (DBG) log("createAllApnList: selection=" + selection); if (DBG) log("createAllApnList: selection=" + selection);
@@ -1860,7 +1860,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
return apnList; return apnList;
} }
String operator = mPhone.mSIMRecords.getSIMOperatorNumeric(); String operator = mPhone.mIccRecords.getOperatorNumeric();
if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) { if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
if (canSetPreferApn && mPreferredApn != null) { if (canSetPreferApn && mPreferredApn != null) {
if (DBG) { if (DBG) {

View File

@@ -765,7 +765,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
// invalid length // invalid length
handlePasswordError(com.android.internal.R.string.invalidPin); handlePasswordError(com.android.internal.R.string.invalidPin);
} else if (sc.equals(SC_PIN) && } else if (sc.equals(SC_PIN) &&
phone.mSimCard.getState() == SimCard.State.PUK_REQUIRED ) { phone.mIccCard.getState() == SimCard.State.PUK_REQUIRED ) {
// Sim is puk-locked // Sim is puk-locked
handlePasswordError(com.android.internal.R.string.needPuk); handlePasswordError(com.android.internal.R.string.needPuk);
} else { } else {
@@ -885,7 +885,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
*/ */
if ((ar.exception == null) && (msg.arg1 == 1)) { if ((ar.exception == null) && (msg.arg1 == 1)) {
boolean cffEnabled = (msg.arg2 == 1); boolean cffEnabled = (msg.arg2 == 1);
phone.mSIMRecords.setVoiceCallForwardingFlag(1, cffEnabled); phone.mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled);
} }
onSetComplete(ar); onSetComplete(ar);
@@ -1203,7 +1203,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
(info.serviceClass & serviceClassMask) (info.serviceClass & serviceClassMask)
== CommandsInterface.SERVICE_CLASS_VOICE) { == CommandsInterface.SERVICE_CLASS_VOICE) {
boolean cffEnabled = (info.status == 1); boolean cffEnabled = (info.status == 1);
phone.mSIMRecords.setVoiceCallForwardingFlag(1, cffEnabled); phone.mIccRecords.setVoiceCallForwardingFlag(1, cffEnabled);
} }
return TextUtils.replace(template, sources, destinations); return TextUtils.replace(template, sources, destinations);
@@ -1228,7 +1228,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
sb.append(context.getText(com.android.internal.R.string.serviceDisabled)); sb.append(context.getText(com.android.internal.R.string.serviceDisabled));
// Set unconditional CFF in SIM to false // Set unconditional CFF in SIM to false
phone.mSIMRecords.setVoiceCallForwardingFlag(1, false); phone.mIccRecords.setVoiceCallForwardingFlag(1, false);
} else { } else {
SpannableStringBuilder tb = new SpannableStringBuilder(); SpannableStringBuilder tb = new SpannableStringBuilder();

View File

@@ -247,7 +247,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
cm.unregisterForVoiceNetworkStateChanged(this); cm.unregisterForVoiceNetworkStateChanged(this);
cm.unregisterForSIMReady(this); cm.unregisterForSIMReady(this);
phone.mSIMRecords.unregisterForRecordsLoaded(this); phone.mIccRecords.unregisterForRecordsLoaded(this);
cm.unSetOnSignalStrengthUpdate(this); cm.unSetOnSignalStrengthUpdate(this);
cm.unSetOnRestrictedStateChanged(this); cm.unSetOnRestrictedStateChanged(this);
cm.unSetOnNITZTime(this); cm.unSetOnNITZTime(this);
@@ -281,7 +281,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
// it has been unlocked. At this stage, the radio is already // it has been unlocked. At this stage, the radio is already
// powered on. // powered on.
if (mNeedToRegForSimLoaded) { if (mNeedToRegForSimLoaded) {
phone.mSIMRecords.registerForRecordsLoaded(this, phone.mIccRecords.registerForRecordsLoaded(this,
EVENT_SIM_RECORDS_LOADED, null); EVENT_SIM_RECORDS_LOADED, null);
mNeedToRegForSimLoaded = false; mNeedToRegForSimLoaded = false;
} }
@@ -487,8 +487,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
} }
protected void updateSpnDisplay() { protected void updateSpnDisplay() {
int rule = phone.mSIMRecords.getDisplayRule(ss.getOperatorNumeric()); int rule = phone.mIccRecords.getDisplayRule(ss.getOperatorNumeric());
String spn = phone.mSIMRecords.getServiceProviderName(); String spn = phone.mIccRecords.getServiceProviderName();
String plmn = ss.getOperatorAlphaLong(); String plmn = ss.getOperatorAlphaLong();
// For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN // For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN

View File

@@ -59,8 +59,8 @@ public final class SIMRecords extends IccRecords {
// ***** Cached SIM State; cleared on channel close // ***** Cached SIM State; cleared on channel close
String imsi; private String imsi;
boolean callForwardingEnabled; private boolean callForwardingEnabled;
/** /**
@@ -191,6 +191,7 @@ public final class SIMRecords extends IccRecords {
} }
@Override
public void dispose() { public void dispose() {
//Unregister for all events //Unregister for all events
phone.mCM.unregisterForSIMReady(this); phone.mCM.unregisterForSIMReady(this);
@@ -231,7 +232,10 @@ public final class SIMRecords extends IccRecords {
//***** Public Methods //***** Public Methods
/** Returns null if SIM is not yet ready */ /**
* {@inheritDoc}
*/
@Override
public String getIMSI() { public String getIMSI() {
return imsi; return imsi;
} }
@@ -404,10 +408,18 @@ public final class SIMRecords extends IccRecords {
} }
} }
/**
* {@inheritDoc}
*/
@Override
public boolean getVoiceCallForwardingFlag() { public boolean getVoiceCallForwardingFlag() {
return callForwardingEnabled; return callForwardingEnabled;
} }
/**
* {@inheritDoc}
*/
@Override
public void setVoiceCallForwardingFlag(int line, boolean enable) { public void setVoiceCallForwardingFlag(int line, boolean enable) {
if (line != 1) return; // only line 1 is supported if (line != 1) return; // only line 1 is supported
@@ -468,12 +480,13 @@ public final class SIMRecords extends IccRecords {
} }
} }
/** Returns the 5 or 6 digit MCC/MNC of the operator that /**
* provided the SIM card. Returns null of SIM is not yet ready * {@inheritDoc}
*/ */
public String getSIMOperatorNumeric() { @Override
public String getOperatorNumeric() {
if (imsi == null) { if (imsi == null) {
Log.d(LOG_TAG, "getSIMOperatorNumeric: IMSI == null"); Log.d(LOG_TAG, "getOperatorNumeric: IMSI == null");
return null; return null;
} }
if (mncLength == UNINITIALIZED || mncLength == UNKNOWN) { if (mncLength == UNINITIALIZED || mncLength == UNKNOWN) {
@@ -484,7 +497,7 @@ public final class SIMRecords extends IccRecords {
// STOPSHIP: to be removed // STOPSHIP: to be removed
if (SystemProperties.getInt(com.android.internal.telephony.TelephonyProperties if (SystemProperties.getInt(com.android.internal.telephony.TelephonyProperties
.PROPERTY_NETWORK_LTE_ON_CDMA, 0) == 1) { .PROPERTY_NETWORK_LTE_ON_CDMA, 0) == 1) {
Log.e(LOG_TAG, "getSIMOperatorNumeric: STOPSHIP bad numeric operators in lte"); Log.e(LOG_TAG, "getOperatorNumeric: STOPSHIP bad numeric operators in lte");
return SystemProperties.get("ro.cdma.home.operator.numeric", "310004"); return SystemProperties.get("ro.cdma.home.operator.numeric", "310004");
} }
// Length = length of MCC + length of MNC // Length = length of MCC + length of MNC
@@ -559,7 +572,7 @@ public final class SIMRecords extends IccRecords {
// finally have both the imsi and the mncLength and can parse the imsi properly // finally have both the imsi and the mncLength and can parse the imsi properly
MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength)); MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
} }
phone.mSimCard.broadcastIccStateChangedIntent( phone.mIccCard.broadcastIccStateChangedIntent(
SimCard.INTENT_VALUE_ICC_IMSI, null); SimCard.INTENT_VALUE_ICC_IMSI, null);
break; break;
@@ -1221,7 +1234,7 @@ public final class SIMRecords extends IccRecords {
protected void onAllRecordsLoaded() { protected void onAllRecordsLoaded() {
Log.d(LOG_TAG, "SIMRecords: record load complete"); Log.d(LOG_TAG, "SIMRecords: record load complete");
String operator = getSIMOperatorNumeric(); String operator = getOperatorNumeric();
// Some fields require more than one SIM record to set // Some fields require more than one SIM record to set
@@ -1240,7 +1253,7 @@ public final class SIMRecords extends IccRecords {
recordsLoadedRegistrants.notifyRegistrants( recordsLoadedRegistrants.notifyRegistrants(
new AsyncResult(null, null, null)); new AsyncResult(null, null, null));
phone.mSimCard.broadcastIccStateChangedIntent( phone.mIccCard.broadcastIccStateChangedIntent(
SimCard.INTENT_VALUE_ICC_LOADED, null); SimCard.INTENT_VALUE_ICC_LOADED, null);
} }
@@ -1265,7 +1278,7 @@ public final class SIMRecords extends IccRecords {
/* broadcast intent SIM_READY here so that we can make sure /* broadcast intent SIM_READY here so that we can make sure
READY is sent before IMSI ready READY is sent before IMSI ready
*/ */
phone.mSimCard.broadcastIccStateChangedIntent( phone.mIccCard.broadcastIccStateChangedIntent(
SimCard.INTENT_VALUE_ICC_READY, null); SimCard.INTENT_VALUE_ICC_READY, null);
fetchSimRecords(); fetchSimRecords();
@@ -1362,7 +1375,8 @@ public final class SIMRecords extends IccRecords {
* *
* If the SPN is not found on the SIM, the rule is always PLMN_ONLY. * If the SPN is not found on the SIM, the rule is always PLMN_ONLY.
*/ */
protected int getDisplayRule(String plmn) { @Override
public int getDisplayRule(String plmn) {
int rule; int rule;
if (spn == null || spnDisplayCondition == -1) { if (spn == null || spnDisplayCondition == -1) {
// EF_SPN was not found on the SIM, or not yet loaded. Just show ONS. // EF_SPN was not found on the SIM, or not yet loaded. Just show ONS.
@@ -1389,7 +1403,7 @@ public final class SIMRecords extends IccRecords {
private boolean isOnMatchingPlmn(String plmn) { private boolean isOnMatchingPlmn(String plmn) {
if (plmn == null) return false; if (plmn == null) return false;
if (plmn.equals(getSIMOperatorNumeric())) { if (plmn.equals(getOperatorNumeric())) {
return true; return true;
} }

View File

@@ -62,7 +62,7 @@ public final class SimCard extends IccCard {
@Override @Override
public String getServiceProviderName () { public String getServiceProviderName () {
return ((GSMPhone)mPhone).mSIMRecords.getServiceProviderName(); return mPhone.mIccRecords.getServiceProviderName();
} }
} }

View File

@@ -32,7 +32,7 @@ public class SimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
public SimPhoneBookInterfaceManager(GSMPhone phone) { public SimPhoneBookInterfaceManager(GSMPhone phone) {
super(phone); super(phone);
adnCache = phone.mSIMRecords.getAdnCache(); adnCache = phone.mIccRecords.getAdnCache();
//NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy //NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy
} }