diff options
author | Wink Saville <wink@google.com> | 2011-05-26 18:21:29 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-05-26 18:21:29 -0700 |
commit | 37a4069ff957ee64caba52b3f9f5d4ac70f4ea7b (patch) | |
tree | eaa37934db960d6edb55376109ca55642984a509 /telephony | |
parent | 5c2e4d20df934728f39312741ef3390fd87795ce (diff) | |
parent | e55e5e7c406bdedc67c6e536c981146e2b335b43 (diff) | |
download | frameworks_base-37a4069ff957ee64caba52b3f9f5d4ac70f4ea7b.zip frameworks_base-37a4069ff957ee64caba52b3f9f5d4ac70f4ea7b.tar.gz frameworks_base-37a4069ff957ee64caba52b3f9f5d4ac70f4ea7b.tar.bz2 |
am e55e5e7c: Merge "Derive ICC status from multiple application status for UICC" into honeycomb-LTE
* commit 'e55e5e7c406bdedc67c6e536c981146e2b335b43':
Derive ICC status from multiple application status for UICC
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/IccCard.java | 93 |
1 files changed, 59 insertions, 34 deletions
diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index a516b49..f2506da 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -722,52 +722,77 @@ public abstract class IccCard { currentRadioState == RadioState.RUIM_READY || (currentRadioState == RadioState.NV_READY && (mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE))) { - int index; + + State csimState = + getAppState(mIccCardStatus.getCdmaSubscriptionAppIndex()); + State usimState = + getAppState(mIccCardStatus.getGsmUmtsSubscriptionAppIndex()); + + if(mDbg) log("USIM=" + usimState + " CSIM=" + csimState); + + if (mPhone.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) { + // UICC card contains both USIM and CSIM + // Return consolidated status + return getConsolidatedState(csimState, usimState, csimState); + } // check for CDMA radio technology if (currentRadioState == RadioState.RUIM_LOCKED_OR_ABSENT || currentRadioState == RadioState.RUIM_READY) { - index = mIccCardStatus.getCdmaSubscriptionAppIndex(); - } - else { - index = mIccCardStatus.getGsmUmtsSubscriptionAppIndex(); + return csimState; } + return usimState; + } - IccCardApplication app; - if (index >= 0 && index < IccCardStatus.CARD_MAX_APPS) { - app = mIccCardStatus.getApplication(index); - } else { - Log.e(mLogTag, "[IccCard] Invalid Subscription Application index:" + index); - return IccCard.State.ABSENT; - } + return IccCard.State.ABSENT; + } - if (app == null) { - Log.e(mLogTag, "[IccCard] Subscription Application in not present"); - return IccCard.State.ABSENT; - } + private State getAppState(int appIndex) { + IccCardApplication app; + if (appIndex >= 0 && appIndex < IccCardStatus.CARD_MAX_APPS) { + app = mIccCardStatus.getApplication(appIndex); + } else { + Log.e(mLogTag, "[IccCard] Invalid Subscription Application index:" + appIndex); + return IccCard.State.ABSENT; + } - // check if PIN required - if (app.app_state.isPinRequired()) { - return IccCard.State.PIN_REQUIRED; - } - if (app.app_state.isPukRequired()) { - return IccCard.State.PUK_REQUIRED; - } - if (app.app_state.isSubscriptionPersoEnabled()) { - return IccCard.State.NETWORK_LOCKED; - } - if (app.app_state.isAppReady()) { - return IccCard.State.READY; - } - if (app.app_state.isAppNotReady()) { - return IccCard.State.NOT_READY; - } - return IccCard.State.NOT_READY; + if (app == null) { + Log.e(mLogTag, "[IccCard] Subscription Application in not present"); + return IccCard.State.ABSENT; } - return IccCard.State.ABSENT; + // check if PIN required + if (app.app_state.isPinRequired()) { + return IccCard.State.PIN_REQUIRED; + } + if (app.app_state.isPukRequired()) { + return IccCard.State.PUK_REQUIRED; + } + if (app.app_state.isSubscriptionPersoEnabled()) { + return IccCard.State.NETWORK_LOCKED; + } + if (app.app_state.isAppReady()) { + return IccCard.State.READY; + } + if (app.app_state.isAppNotReady()) { + return IccCard.State.NOT_READY; + } + return IccCard.State.NOT_READY; } + private State getConsolidatedState(State left, State right, State preferredState) { + // Check if either is absent. + if (right == IccCard.State.ABSENT) return left; + if (left == IccCard.State.ABSENT) return right; + + // Disregards if either is NOT_READY + if (right == IccCard.State.NOT_READY) return left; + if (left == IccCard.State.NOT_READY) return right; + + // At this point, FW currently just assumes the status will be + // consistent across the applications... + return preferredState; + } public boolean isApplicationOnIcc(IccCardApplication.AppType type) { if (mIccCardStatus == null) return false; |