diff options
author | Alex Yakavenka <ayakav@codeaurora.org> | 2012-07-26 15:34:10 -0700 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2012-08-08 20:48:20 -0700 |
commit | e0e2ebb5a50e580cbe6957dcafb3495a2d0a27f2 (patch) | |
tree | 4eed1415126fb7bb5caf178a3d1c119e09ae13f3 /src/java/com/android/internal/telephony/ServiceStateTracker.java | |
parent | f7c060b9ded0613109c1cec05c537c4e846fecd4 (diff) | |
download | frameworks_opt_telephony-e0e2ebb5a50e580cbe6957dcafb3495a2d0a27f2.zip frameworks_opt_telephony-e0e2ebb5a50e580cbe6957dcafb3495a2d0a27f2.tar.gz frameworks_opt_telephony-e0e2ebb5a50e580cbe6957dcafb3495a2d0a27f2.tar.bz2 |
Telephony: Dynamically instantiate IccCard
Instantiate when get_sim_status request returns
Change-Id: I9c9333d23f1e0b23256731b245577d1a25721647
Diffstat (limited to 'src/java/com/android/internal/telephony/ServiceStateTracker.java')
-rw-r--r-- | src/java/com/android/internal/telephony/ServiceStateTracker.java | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/java/com/android/internal/telephony/ServiceStateTracker.java b/src/java/com/android/internal/telephony/ServiceStateTracker.java index e4cfb23..178addd 100644 --- a/src/java/com/android/internal/telephony/ServiceStateTracker.java +++ b/src/java/com/android/internal/telephony/ServiceStateTracker.java @@ -18,6 +18,7 @@ package com.android.internal.telephony; import android.os.AsyncResult; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.os.Registrant; import android.os.RegistrantList; @@ -28,12 +29,17 @@ import android.util.TimeUtils; import java.io.FileDescriptor; import java.io.PrintWriter; +import com.android.internal.telephony.uicc.UiccController; + /** * {@hide} */ public abstract class ServiceStateTracker extends Handler { protected CommandsInterface cm; + protected UiccController mUiccController = null; + protected IccCard mIccCard = null; + protected IccRecords mIccRecords = null; public ServiceState ss; protected ServiceState newSS; @@ -131,7 +137,7 @@ public abstract class ServiceStateTracker extends Handler { protected static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 39; protected static final int EVENT_CDMA_PRL_VERSION_CHANGED = 40; protected static final int EVENT_RADIO_ON = 41; - + protected static final int EVENT_ICC_CHANGED = 42; protected static final String TIMEZONE_PROPERTY = "persist.sys.timezone"; @@ -168,7 +174,10 @@ public abstract class ServiceStateTracker extends Handler { protected static final String REGISTRATION_DENIED_GEN = "General"; protected static final String REGISTRATION_DENIED_AUTH = "Authentication Failure"; - public ServiceStateTracker() { + public ServiceStateTracker(PhoneBase p, CommandsInterface ci) { + cm = ci; + mUiccController = UiccController.getInstance(); + mUiccController.registerForIccChanged(this, EVENT_ICC_CHANGED, null); } public boolean getDesiredPowerState() { @@ -295,6 +304,10 @@ public abstract class ServiceStateTracker extends Handler { } break; + case EVENT_ICC_CHANGED: + onUpdateIccAvailability(); + break; + default: log("Unhandled message with number: " + msg.what); break; @@ -305,6 +318,7 @@ public abstract class ServiceStateTracker extends Handler { protected abstract void handlePollStateResult(int what, AsyncResult ar); protected abstract void updateSpnDisplay(); protected abstract void setPowerStateToDesired(); + protected abstract void onUpdateIccAvailability(); protected abstract void log(String s); protected abstract void loge(String s); @@ -535,4 +549,19 @@ public abstract class ServiceStateTracker extends Handler { pw.println(" mPendingRadioPowerOffAfterDataOff=" + mPendingRadioPowerOffAfterDataOff); pw.println(" mPendingRadioPowerOffAfterDataOffTag=" + mPendingRadioPowerOffAfterDataOffTag); } + + /** + * Verifies the current thread is the same as the thread originally + * used in the initialization of this instance. Throws RuntimeException + * if not. + * + * @exception RuntimeException if the current thread is not + * the thread that originally obtained this PhoneBase instance. + */ + protected void checkCorrectThread() { + if (Thread.currentThread() != getLooper().getThread()) { + throw new RuntimeException( + "ServiceStateTracker must be used from within one thread"); + } + } } |