use of com.android.internal.telephony.CommandsInterface.RadioState in project android_frameworks_opt_telephony by LineageOS.
the class UiccCard method update.
public void update(Context c, CommandsInterface ci, IccCardStatus ics) {
synchronized (mLock) {
CardState oldState = mCardState;
mCardState = ics.mCardState;
mUniversalPinState = ics.mUniversalPinState;
mGsmUmtsSubscriptionAppIndex = ics.mGsmUmtsSubscriptionAppIndex;
mCdmaSubscriptionAppIndex = ics.mCdmaSubscriptionAppIndex;
mImsSubscriptionAppIndex = ics.mImsSubscriptionAppIndex;
mContext = c;
mCi = ci;
// update applications
if (DBG)
log(ics.mApplications.length + " applications");
for (int i = 0; i < mUiccApplications.length; i++) {
if (mUiccApplications[i] == null) {
// Create newly added Applications
if (i < ics.mApplications.length) {
mUiccApplications[i] = new UiccCardApplication(this, ics.mApplications[i], mContext, mCi);
}
} else if (i >= ics.mApplications.length) {
// Delete removed applications
mUiccApplications[i].dispose();
mUiccApplications[i] = null;
} else {
// Update the rest
mUiccApplications[i].update(ics.mApplications[i], mContext, mCi);
}
}
createAndUpdateCatServiceLocked();
// Reload the carrier privilege rules if necessary.
log("Before privilege rules: " + mCarrierPrivilegeRules + " : " + mCardState);
if (mCarrierPrivilegeRules == null && mCardState == CardState.CARDSTATE_PRESENT) {
mCarrierPrivilegeRules = new UiccCarrierPrivilegeRules(this, mHandler.obtainMessage(EVENT_CARRIER_PRIVILEGES_LOADED));
} else if (mCarrierPrivilegeRules != null && mCardState != CardState.CARDSTATE_PRESENT) {
mCarrierPrivilegeRules = null;
}
sanitizeApplicationIndexesLocked();
RadioState radioState = mCi.getRadioState();
if (DBG)
log("update: radioState=" + radioState + " mLastRadioState=" + mLastRadioState);
// No notifications while radio is off or we just powering up
if (radioState == RadioState.RADIO_ON && mLastRadioState == RadioState.RADIO_ON) {
if (oldState != CardState.CARDSTATE_ABSENT && mCardState == CardState.CARDSTATE_ABSENT) {
if (DBG)
log("update: notify card removed");
mAbsentRegistrants.notifyRegistrants();
mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_REMOVED, null));
} else if (oldState == CardState.CARDSTATE_ABSENT && mCardState != CardState.CARDSTATE_ABSENT) {
if (DBG)
log("update: notify card added");
mHandler.sendMessage(mHandler.obtainMessage(EVENT_CARD_ADDED, null));
}
}
if (needsSimActivation()) {
if (mCardState == CardState.CARDSTATE_PRESENT) {
if (!mDefaultAppsActivated) {
activateDefaultApps();
mDefaultAppsActivated = true;
}
} else {
// SIM removed, reset activation flag to make sure
// to re-run the activation at the next insertion
mDefaultAppsActivated = false;
}
}
mLastRadioState = radioState;
}
}
use of com.android.internal.telephony.CommandsInterface.RadioState in project XobotOS by xamarin.
the class IccCard method getIccCardState.
public State getIccCardState() {
if (mIccCardStatus == null) {
Log.e(mLogTag, "[IccCard] IccCardStatus is null");
return IccCard.State.ABSENT;
}
// this is common for all radio technologies
if (!mIccCardStatus.getCardState().isCardPresent()) {
return IccCard.State.ABSENT;
}
RadioState currentRadioState = mPhone.mCM.getRadioState();
// check radio technology
if (currentRadioState == RadioState.RADIO_OFF || currentRadioState == RadioState.RADIO_UNAVAILABLE || currentRadioState == RadioState.SIM_NOT_READY || currentRadioState == RadioState.RUIM_NOT_READY || currentRadioState == RadioState.NV_NOT_READY || currentRadioState == RadioState.NV_READY) {
return IccCard.State.NOT_READY;
}
if (currentRadioState == RadioState.SIM_LOCKED_OR_ABSENT || currentRadioState == RadioState.SIM_READY || currentRadioState == RadioState.RUIM_LOCKED_OR_ABSENT || currentRadioState == RadioState.RUIM_READY) {
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) {
// Return consolidated status
return getConsolidatedState(csimState, usimState, csimState);
}
// check for CDMA radio technology
if (currentRadioState == RadioState.RUIM_LOCKED_OR_ABSENT || currentRadioState == RadioState.RUIM_READY) {
return csimState;
}
return usimState;
}
return IccCard.State.ABSENT;
}
Aggregations