Telephony: Remove IccFileHandler from PhoneBase
mIccCard is now be multi-thread safe but other similar variables such as mIccRecords will be cleaned up in the future and are no worse than before. Change-Id: Ic2fc31af2575c2dc0bb30e7348dd9e76ec61e763
This commit is contained in:
committed by
Wink Saville
parent
4355b001cb
commit
12ef0981be
@@ -43,6 +43,7 @@ import com.android.internal.telephony.test.SimulatedRadioControl;
|
||||
import com.android.internal.telephony.gsm.SIMRecords;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
|
||||
/**
|
||||
@@ -116,7 +117,6 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
|
||||
/* Instance Variables */
|
||||
public CommandsInterface mCM;
|
||||
protected IccFileHandler mIccFileHandler;
|
||||
boolean mDnsCheckDisabled;
|
||||
public DataConnectionTracker mDataConnectionTracker;
|
||||
boolean mDoesRilSendMultipleCallRing;
|
||||
@@ -125,7 +125,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
public boolean mIsTheCurrentActivePhone = true;
|
||||
boolean mIsVoiceCapable = true;
|
||||
public IccRecords mIccRecords;
|
||||
public IccCard mIccCard;
|
||||
protected AtomicReference<IccCard> mIccCard = new AtomicReference<IccCard>();
|
||||
public SmsStorageMonitor mSmsStorageMonitor;
|
||||
public SmsUsageMonitor mSmsUsageMonitor;
|
||||
public SMSDispatcher mSMS;
|
||||
@@ -268,7 +268,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
mSmsUsageMonitor = null;
|
||||
mSMS = null;
|
||||
mIccRecords = null;
|
||||
mIccCard = null;
|
||||
mIccCard.set(null);
|
||||
mDataConnectionTracker = null;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,11 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
/**
|
||||
* Retrieves the IccFileHandler of the Phone instance
|
||||
*/
|
||||
public abstract IccFileHandler getIccFileHandler();
|
||||
public IccFileHandler getIccFileHandler(){
|
||||
IccCard iccCard = mIccCard.get();
|
||||
if (iccCard == null) return null;
|
||||
return iccCard.getIccFileHandler();
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieves the Handler of the Phone instance
|
||||
@@ -655,7 +659,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
|
||||
@Override
|
||||
public IccCard getIccCard() {
|
||||
return mIccCard;
|
||||
return mIccCard.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,9 +85,8 @@ public class CDMALTEPhone extends CDMAPhone {
|
||||
|
||||
@Override
|
||||
protected void initSstIcc() {
|
||||
mIccCard = UiccController.getInstance(this).getIccCard();
|
||||
mIccRecords = mIccCard.getIccRecords();
|
||||
mIccFileHandler = mIccCard.getIccFileHandler();
|
||||
mIccCard.set(UiccController.getInstance(this).getIccCard());
|
||||
mIccRecords = mIccCard.get().getIccRecords();
|
||||
// CdmaLteServiceStateTracker registers with IccCard to know
|
||||
// when the card is ready. So create mIccCard before the ServiceStateTracker
|
||||
mSST = new CdmaLteServiceStateTracker(this);
|
||||
|
||||
@@ -149,9 +149,8 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
protected void initSstIcc() {
|
||||
mIccCard = UiccController.getInstance(this).getIccCard();
|
||||
mIccRecords = mIccCard.getIccRecords();
|
||||
mIccFileHandler = mIccCard.getIccFileHandler();
|
||||
mIccCard.set(UiccController.getInstance(this).getIccCard());
|
||||
mIccRecords = mIccCard.get().getIccRecords();
|
||||
// CdmaServiceStateTracker registers with IccCard to know
|
||||
// when the Ruim card is ready. So create mIccCard before the ServiceStateTracker
|
||||
mSST = new CdmaServiceStateTracker(this);
|
||||
@@ -251,7 +250,6 @@ public class CDMAPhone extends PhoneBase {
|
||||
mRuimPhoneBookInterfaceManager = null;
|
||||
mRuimSmsInterfaceManager = null;
|
||||
mSubInfo = null;
|
||||
mIccFileHandler = null;
|
||||
mCT = null;
|
||||
mSST = null;
|
||||
mEriManager = null;
|
||||
@@ -1126,13 +1124,6 @@ public class CDMAPhone extends PhoneBase {
|
||||
super.setSystemProperty(property, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public IccFileHandler getIccFileHandler() {
|
||||
return this.mIccFileHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate or deactivate cell broadcast SMS.
|
||||
*
|
||||
|
||||
@@ -349,7 +349,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
|
||||
ss.setOperatorAlphaLong(eriText);
|
||||
}
|
||||
|
||||
if (phone.mIccCard.getState() == IccCard.State.READY) {
|
||||
if (phone.getIccCard().getState() == IccCard.State.READY) {
|
||||
// SIM is found on the device. If ERI roaming is OFF, and SID/NID matches
|
||||
// one configfured in SIM, use operator name from CSIM record.
|
||||
boolean showSpn =
|
||||
|
||||
@@ -209,8 +209,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
// Unregister for all events.
|
||||
cm.unregisterForRadioStateChanged(this);
|
||||
cm.unregisterForVoiceNetworkStateChanged(this);
|
||||
phone.mIccCard.unregisterForReady(this);
|
||||
|
||||
phone.getIccCard().unregisterForReady(this);
|
||||
cm.unregisterForCdmaOtaProvision(this);
|
||||
phone.unregisterForEriFileLoaded(this);
|
||||
phone.mIccRecords.unregisterForRecordsLoaded(this);
|
||||
@@ -498,7 +497,7 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
|
||||
// NV is ready when subscription source is NV
|
||||
sendMessage(obtainMessage(EVENT_NV_READY));
|
||||
} else {
|
||||
phone.mIccCard.registerForReady(this, EVENT_RUIM_READY, null);
|
||||
phone.getIccCard().registerForReady(this, EVENT_RUIM_READY, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,12 +136,11 @@ public class GSMPhone extends PhoneBase {
|
||||
}
|
||||
|
||||
mCM.setPhoneType(Phone.PHONE_TYPE_GSM);
|
||||
mIccCard = UiccController.getInstance(this).getIccCard();
|
||||
mIccCard.set(UiccController.getInstance(this).getIccCard());
|
||||
mIccRecords = mIccCard.get().getIccRecords();
|
||||
mCT = new GsmCallTracker(this);
|
||||
mSST = new GsmServiceStateTracker (this);
|
||||
mSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
|
||||
mIccFileHandler = mIccCard.getIccFileHandler();
|
||||
mIccRecords = mIccCard.getIccRecords();
|
||||
mDataConnectionTracker = new GsmDataConnectionTracker (this);
|
||||
if (!unitTestMode) {
|
||||
mSimPhoneBookIntManager = new SimPhoneBookInterfaceManager(this);
|
||||
@@ -229,7 +228,6 @@ public class GSMPhone extends PhoneBase {
|
||||
mSimPhoneBookIntManager = null;
|
||||
mSimSmsIntManager = null;
|
||||
mSubInfo = null;
|
||||
mIccFileHandler = null;
|
||||
mCT = null;
|
||||
mSST = null;
|
||||
super.removeReferences();
|
||||
@@ -1439,13 +1437,6 @@ public class GSMPhone extends PhoneBase {
|
||||
return mSimPhoneBookIntManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public IccFileHandler getIccFileHandler(){
|
||||
return this.mIccFileHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate or deactivate cell broadcast SMS.
|
||||
*
|
||||
|
||||
@@ -765,7 +765,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
|
||||
// invalid length
|
||||
handlePasswordError(com.android.internal.R.string.invalidPin);
|
||||
} else if (sc.equals(SC_PIN) &&
|
||||
phone.mIccCard.getState() == IccCard.State.PUK_REQUIRED ) {
|
||||
phone.getIccCard().getState() == IccCard.State.PUK_REQUIRED ) {
|
||||
// Sim is puk-locked
|
||||
handlePasswordError(com.android.internal.R.string.needPuk);
|
||||
} else {
|
||||
|
||||
@@ -211,7 +211,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
cm.setOnNITZTime(this, EVENT_NITZ_TIME, null);
|
||||
cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null);
|
||||
cm.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null);
|
||||
phone.mIccCard.registerForReady(this, EVENT_SIM_READY, null);
|
||||
phone.getIccCard().registerForReady(this, EVENT_SIM_READY, null);
|
||||
|
||||
// system setting property AIRPLANE_MODE_ON is set in Settings.
|
||||
int airplaneMode = Settings.System.getInt(
|
||||
@@ -244,7 +244,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
cm.unregisterForAvailable(this);
|
||||
cm.unregisterForRadioStateChanged(this);
|
||||
cm.unregisterForVoiceNetworkStateChanged(this);
|
||||
phone.mIccCard.unregisterForReady(this);
|
||||
phone.getIccCard().unregisterForReady(this);
|
||||
phone.mIccRecords.unregisterForRecordsLoaded(this);
|
||||
cm.unSetOnSignalStrengthUpdate(this);
|
||||
cm.unSetOnRestrictedStateChanged(this);
|
||||
|
||||
Reference in New Issue
Block a user