Search in sources :

Example 6 with UiccCard

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

the class SMSDispatcher method getCarrierAppPackageName.

@UnsupportedAppUsage
protected String getCarrierAppPackageName() {
    UiccCard card = UiccController.getInstance().getUiccCard(mPhone.getPhoneId());
    if (card == null) {
        return null;
    }
    List<String> carrierPackages = card.getCarrierPackageNamesForIntent(mContext.getPackageManager(), new Intent(CarrierMessagingService.SERVICE_INTERFACE));
    if (carrierPackages != null && carrierPackages.size() == 1) {
        return carrierPackages.get(0);
    }
    // for a carrierImsPackage that implements CarrierMessagingService.
    return CarrierSmsUtils.getCarrierImsPackageForIntent(mContext, mPhone, new Intent(CarrierMessagingService.SERVICE_INTERFACE));
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) UnsupportedAppUsage(android.compat.annotation.UnsupportedAppUsage)

Example 7 with UiccCard

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

the class ServiceStateTracker method queueNextSignalStrengthPoll.

private void queueNextSignalStrengthPoll() {
    if (mDontPollSignalStrength) {
        // we don't have to ask it
        return;
    }
    // if there is no SIM present, do not poll signal strength
    UiccCard uiccCard = UiccController.getInstance().getUiccCard(getPhoneId());
    if (uiccCard == null || uiccCard.getCardState() == CardState.CARDSTATE_ABSENT) {
        log("Not polling signal strength due to absence of SIM");
        return;
    }
    Message msg;
    msg = obtainMessage();
    msg.what = EVENT_POLL_SIGNAL_STRENGTH;
    long nextTime;
    // TODO Don't poll signal strength if screen is off
    sendMessageDelayed(msg, POLL_PERIOD_MILLIS);
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) Message(android.os.Message)

Example 8 with UiccCard

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

the class SimSlotState method getCurrentState.

/**
 * Returns the current SIM state.
 */
public static SimSlotState getCurrentState() {
    int numActiveSlots = 0;
    int numActiveSims = 0;
    int numActiveEsims = 0;
    UiccController uiccController = UiccController.getInstance();
    // since we cannot hold lock insider UiccController, using getUiccSlots() for length only
    for (int i = 0; i < uiccController.getUiccSlots().length; i++) {
        UiccSlot slot = uiccController.getUiccSlot(i);
        if (slot != null && slot.isActive()) {
            numActiveSlots++;
            // avoid CardState.isCardPresent() since this should not include restricted cards
            if (slot.getCardState() == CardState.CARDSTATE_PRESENT) {
                if (slot.isEuicc()) {
                    // need to check active profiles besides the presence of eSIM cards
                    UiccCard card = slot.getUiccCard();
                    if (card != null && card.getNumApplications() > 0) {
                        numActiveSims++;
                        numActiveEsims++;
                    }
                } else {
                    // physical SIMs do not always have non-null card
                    numActiveSims++;
                }
            }
        }
    }
    return new SimSlotState(numActiveSlots, numActiveSims, numActiveEsims);
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) UiccController(com.android.internal.telephony.uicc.UiccController) UiccSlot(com.android.internal.telephony.uicc.UiccSlot)

Example 9 with UiccCard

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

the class CarrierServicesSmsFilter method getCarrierAppPackageForFiltering.

private Optional<String> getCarrierAppPackageForFiltering() {
    List<String> carrierPackages = null;
    UiccCard card = UiccController.getInstance().getUiccCard(mPhone.getPhoneId());
    if (card != null) {
        carrierPackages = card.getCarrierPackageNamesForIntent(mContext.getPackageManager(), new Intent(CarrierMessagingService.SERVICE_INTERFACE));
    } else {
        loge("getCarrierAppPackageForFiltering: UiccCard not initialized");
    }
    if (carrierPackages != null && carrierPackages.size() == 1) {
        log("getCarrierAppPackageForFiltering: Found carrier package: " + carrierPackages.get(0));
        return Optional.of(carrierPackages.get(0));
    }
    // It is possible that carrier app is not present as a CarrierPackage, but instead as a
    // system app
    List<String> systemPackages = getSystemAppForIntent(new Intent(CarrierMessagingService.SERVICE_INTERFACE));
    if (systemPackages != null && systemPackages.size() == 1) {
        log("getCarrierAppPackageForFiltering: Found system package: " + systemPackages.get(0));
        return Optional.of(systemPackages.get(0));
    }
    logv("getCarrierAppPackageForFiltering: Unable to find carrierPackages: " + carrierPackages + " or systemPackages: " + systemPackages);
    return Optional.empty();
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) Intent(android.content.Intent)

Example 10 with UiccCard

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

the class SubscriptionInfoUpdater method getCardIdFromPhoneId.

protected int getCardIdFromPhoneId(int phoneId) {
    UiccController uiccController = UiccController.getInstance();
    UiccCard card = uiccController.getUiccCardForPhone(phoneId);
    if (card != null) {
        return uiccController.convertToPublicCardId(card.getCardId());
    }
    return TelephonyManager.UNINITIALIZED_CARD_ID;
}
Also used : UiccCard(com.android.internal.telephony.uicc.UiccCard) UiccController(com.android.internal.telephony.uicc.UiccController)

Aggregations

UiccCard (com.android.internal.telephony.uicc.UiccCard)12 ContentResolver (android.content.ContentResolver)2 ContentValues (android.content.ContentValues)2 Intent (android.content.Intent)2 Uri (android.net.Uri)2 UiccController (com.android.internal.telephony.uicc.UiccController)2 PendingIntent (android.app.PendingIntent)1 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)1 Cursor (android.database.Cursor)1 Message (android.os.Message)1 DataEnabledOverride (com.android.internal.telephony.dataconnection.DataEnabledOverride)1 CardState (com.android.internal.telephony.uicc.IccCardStatus.CardState)1 UiccCardApplication (com.android.internal.telephony.uicc.UiccCardApplication)1 UiccProfile (com.android.internal.telephony.uicc.UiccProfile)1 UiccSlot (com.android.internal.telephony.uicc.UiccSlot)1