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));
}
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);
}
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);
}
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();
}
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;
}
Aggregations