Search in sources :

Example 1 with UiccSlot

use of com.android.internal.telephony.uicc.UiccSlot in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaPhone method enableUiccApplications.

// Enable or disable uicc applications.
@Override
public void enableUiccApplications(boolean enable, Message onCompleteMessage) {
    // First check if card is present. Otherwise mUiccApplicationsDisabled doesn't make
    // any sense.
    UiccSlot slot = mUiccController.getUiccSlotForPhone(mPhoneId);
    if (slot == null || slot.getCardState() != IccCardStatus.CardState.CARDSTATE_PRESENT) {
        if (onCompleteMessage != null) {
            AsyncResult.forMessage(onCompleteMessage, null, new IllegalStateException("No SIM card is present"));
            onCompleteMessage.sendToTarget();
        }
        return;
    }
    mCi.enableUiccApplications(enable, onCompleteMessage);
}
Also used : UiccSlot(com.android.internal.telephony.uicc.UiccSlot)

Example 2 with UiccSlot

use of com.android.internal.telephony.uicc.UiccSlot in project android_frameworks_opt_telephony by LineageOS.

the class GsmCdmaPhone method reapplyUiccAppsEnablementIfNeeded.

private void reapplyUiccAppsEnablementIfNeeded(int retries) {
    UiccSlot slot = mUiccController.getUiccSlotForPhone(mPhoneId);
    // If no card is present or we don't have mUiccApplicationsEnabled yet, do nothing.
    if (slot == null || slot.getCardState() != IccCardStatus.CardState.CARDSTATE_PRESENT || mUiccApplicationsEnabled == null) {
        return;
    }
    String iccId = slot.getIccId();
    if (iccId == null)
        return;
    SubscriptionInfo info = SubscriptionController.getInstance().getSubInfoForIccId(IccUtils.stripTrailingFs(iccId));
    // If info is null, it could be a new subscription. By default we enable it.
    boolean expectedValue = info == null ? true : info.areUiccApplicationsEnabled();
    // configured state.
    if (expectedValue != mUiccApplicationsEnabled) {
        mCi.enableUiccApplications(expectedValue, Message.obtain(this, EVENT_REAPPLY_UICC_APPS_ENABLEMENT_DONE, new Pair<Boolean, Integer>(expectedValue, retries)));
    }
}
Also used : SubscriptionInfo(android.telephony.SubscriptionInfo) UiccSlot(com.android.internal.telephony.uicc.UiccSlot) Pair(android.util.Pair)

Example 3 with UiccSlot

use of com.android.internal.telephony.uicc.UiccSlot in project android_frameworks_opt_telephony by LineageOS.

the class SubscriptionInfoUpdater method areUiccAppsDisabledOnCard.

private boolean areUiccAppsDisabledOnCard(int phoneId) {
    // When uicc apps are disabled(supported in IRadio 1.5), we will still get IccId from
    // cardStatus (since IRadio 1.2). Amd upon cardStatus change we'll receive another
    // handleSimNotReady so this will be evaluated again.
    UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId);
    if (slot == null || slot.getIccId() == null)
        return false;
    SubscriptionInfo info = SubscriptionController.getInstance().getSubInfoForIccId(IccUtils.stripTrailingFs(slot.getIccId()));
    return info != null && !info.areUiccApplicationsEnabled();
}
Also used : SubscriptionInfo(android.telephony.SubscriptionInfo) UiccSlot(com.android.internal.telephony.uicc.UiccSlot)

Example 4 with UiccSlot

use of com.android.internal.telephony.uicc.UiccSlot in project android_frameworks_opt_telephony by LineageOS.

the class SubscriptionInfoUpdater method handleSimNotReady.

protected void handleSimNotReady(int phoneId) {
    logd("handleSimNotReady: phoneId: " + phoneId);
    boolean isFinalState = false;
    IccCard iccCard = PhoneFactory.getPhone(phoneId).getIccCard();
    boolean uiccAppsDisabled = areUiccAppsDisabledOnCard(phoneId);
    if (iccCard.isEmptyProfile() || uiccAppsDisabled) {
        if (uiccAppsDisabled) {
            UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(phoneId);
            sInactiveIccIds[phoneId] = IccUtils.stripTrailingFs(slot.getIccId());
        }
        isFinalState = true;
        // ICC_NOT_READY is a terminal state for
        // 1) It's an empty profile as there's no uicc applications. Or
        // 2) Its uicc applications are set to be disabled.
        // At this phase, the subscription list is accessible. Treating NOT_READY
        // as equivalent to ABSENT, once the rest of the system can handle it.
        sIccId[phoneId] = ICCID_STRING_FOR_NO_SIM;
        updateSubscriptionInfoByIccId(phoneId, false);
    }
    broadcastSimStateChanged(phoneId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY, null);
    broadcastSimCardStateChanged(phoneId, TelephonyManager.SIM_STATE_PRESENT);
    broadcastSimApplicationStateChanged(phoneId, TelephonyManager.SIM_STATE_NOT_READY);
    if (isFinalState) {
        updateCarrierServices(phoneId, IccCardConstants.INTENT_VALUE_ICC_NOT_READY);
    }
}
Also used : UiccSlot(com.android.internal.telephony.uicc.UiccSlot)

Example 5 with UiccSlot

use of com.android.internal.telephony.uicc.UiccSlot in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method isEsim.

private boolean isEsim() {
    int slotId = getSimSlotId();
    UiccSlot slot = mUiccController.getUiccSlot(slotId);
    if (slot != null) {
        return slot.isEuicc();
    } else {
        // should not happen, but assume we are not using eSIM
        loge("isEsim: slot %d is null", slotId);
        return false;
    }
}
Also used : UiccSlot(com.android.internal.telephony.uicc.UiccSlot)

Aggregations

UiccSlot (com.android.internal.telephony.uicc.UiccSlot)14 SubscriptionInfo (android.telephony.SubscriptionInfo)3 SmallTest (android.test.suitebuilder.annotation.SmallTest)3 FlakyTest (androidx.test.filters.FlakyTest)3 UiccController (com.android.internal.telephony.uicc.UiccController)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 ContentResolver (android.content.ContentResolver)2 UiccSlotInfo (android.telephony.UiccSlotInfo)2 MockContentResolver (android.test.mock.MockContentResolver)2 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)1 ContentValues (android.content.ContentValues)1 Pair (android.util.Pair)1 UiccCard (com.android.internal.telephony.uicc.UiccCard)1 EuiccCard (com.android.internal.telephony.uicc.euicc.EuiccCard)1