diff options
author | Alex Yakavenka <ayakaven@quicinc.com> | 2011-12-09 14:35:21 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2012-03-26 13:57:57 -0700 |
commit | 12ef0981be95a074443edcc600abce692e80d3d0 (patch) | |
tree | 6583c68270ec568e30c6749325ae4ab3dbdda251 /telephony | |
parent | 4355b001cb736d4aa312231ce129506a3c7f6808 (diff) | |
download | frameworks_base-12ef0981be95a074443edcc600abce692e80d3d0.zip frameworks_base-12ef0981be95a074443edcc600abce692e80d3d0.tar.gz frameworks_base-12ef0981be95a074443edcc600abce692e80d3d0.tar.bz2 |
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
Diffstat (limited to 'telephony')
8 files changed, 21 insertions, 37 deletions
diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 6fc0134..3aa53eef 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -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 diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java index f914030..110d8bf 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMALTEPhone.java @@ -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); diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index ce581de..bb00d4b 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -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; @@ -1127,13 +1125,6 @@ public class CDMAPhone extends PhoneBase { } /** - * {@inheritDoc} - */ - public IccFileHandler getIccFileHandler() { - return this.mIccFileHandler; - } - - /** * Activate or deactivate cell broadcast SMS. * * @param activate 0 = activate, 1 = deactivate diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java index cad2e22..09008cd 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java @@ -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 = diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index 75f5d47..9ec56fc 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -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); } } diff --git a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java index 6e10542..be13c35 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java +++ b/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java @@ -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(); @@ -1440,13 +1438,6 @@ public class GSMPhone extends PhoneBase { } /** - * {@inheritDoc} - */ - public IccFileHandler getIccFileHandler(){ - return this.mIccFileHandler; - } - - /** * Activate or deactivate cell broadcast SMS. * * @param activate 0 = activate, 1 = deactivate diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java index 205c73d..9b3d5cd 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmMmiCode.java @@ -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 { diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 148b139..080d90c 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -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); |