use of com.android.internal.telephony.uicc.euicc.EuiccCard in project android_frameworks_opt_telephony by LineageOS.
the class UiccController method onGetIccCardStatusDone.
private synchronized void onGetIccCardStatusDone(AsyncResult ar, Integer index) {
if (ar.exception != null) {
Rlog.e(LOG_TAG, "Error getting ICC status. " + "RIL_REQUEST_GET_ICC_STATUS should " + "never return an error", ar.exception);
return;
}
if (!isValidPhoneIndex(index)) {
Rlog.e(LOG_TAG, "onGetIccCardStatusDone: invalid index : " + index);
return;
}
IccCardStatus status = (IccCardStatus) ar.result;
logWithLocalLog("onGetIccCardStatusDone: phoneId " + index + " IccCardStatus: " + status);
int slotId = status.physicalSlotIndex;
if (VDBG)
log("onGetIccCardStatusDone: phoneId " + index + " physicalSlotIndex " + slotId);
if (slotId == INVALID_SLOT_ID) {
slotId = index;
}
if (eidIsNotSupported(status)) {
// we will never get EID from the HAL, so set mDefaultEuiccCardId to UNSUPPORTED_CARD_ID
if (DBG)
log("eid is not supported");
mDefaultEuiccCardId = UNSUPPORTED_CARD_ID;
}
mPhoneIdToSlotId[index] = slotId;
if (VDBG)
logPhoneIdToSlotIdMapping();
if (mUiccSlots[slotId] == null) {
if (VDBG) {
log("Creating mUiccSlots[" + slotId + "]; mUiccSlots.length = " + mUiccSlots.length);
}
mUiccSlots[slotId] = new UiccSlot(mContext, true);
}
mUiccSlots[slotId].update(mCis[index], status, index, slotId);
UiccCard card = mUiccSlots[slotId].getUiccCard();
if (card == null) {
if (DBG)
log("mUiccSlots[" + slotId + "] has no card. Notifying IccChangedRegistrants");
mIccChangedRegistrants.notifyRegistrants(new AsyncResult(null, index, null));
return;
}
String cardString = null;
boolean isEuicc = mUiccSlots[slotId].isEuicc();
if (isEuicc) {
cardString = ((EuiccCard) card).getEid();
} else {
cardString = card.getIccId();
}
if (cardString != null) {
addCardId(cardString);
}
// If so, just register for EID loaded and skip this stuff
if (isEuicc && mDefaultEuiccCardId != UNSUPPORTED_CARD_ID) {
if (cardString == null) {
((EuiccCard) card).registerForEidReady(this, EVENT_EID_READY, index);
} else {
// APDU
if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) {
mDefaultEuiccCardId = convertToPublicCardId(cardString);
logWithLocalLog("IccCardStatus eid=" + cardString + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId);
}
}
}
if (DBG)
log("Notifying IccChangedRegistrants");
mIccChangedRegistrants.notifyRegistrants(new AsyncResult(null, index, null));
}
use of com.android.internal.telephony.uicc.euicc.EuiccCard in project android_frameworks_opt_telephony by LineageOS.
the class UiccController method onEidReady.
// for HAL 1.2-1.3 we register for EID ready, set mCardStrings and mDefaultEuiccCardId here.
// Note that if there are multiple eUICCs on HAL 1.2-1.3, the default eUICC is the one whose EID
// is first loaded
private void onEidReady(AsyncResult ar, Integer index) {
if (ar.exception != null) {
Rlog.e(LOG_TAG, "onEidReady: exception: " + ar.exception);
return;
}
if (!isValidPhoneIndex(index)) {
Rlog.e(LOG_TAG, "onEidReady: invalid index: " + index);
return;
}
int slotId = mPhoneIdToSlotId[index];
EuiccCard card = (EuiccCard) mUiccSlots[slotId].getUiccCard();
if (card == null) {
Rlog.e(LOG_TAG, "onEidReady: UiccCard in slot " + slotId + " is null");
return;
}
// set mCardStrings and the defaultEuiccCardId using the now available EID
String eid = card.getEid();
addCardId(eid);
if (mDefaultEuiccCardId == UNINITIALIZED_CARD_ID || mDefaultEuiccCardId == TEMPORARILY_UNSUPPORTED_CARD_ID) {
if (!mUiccSlots[slotId].isRemovable()) {
mDefaultEuiccCardId = convertToPublicCardId(eid);
logWithLocalLog("onEidReady: eid=" + eid + " slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId);
} else if (!mHasActiveBuiltInEuicc) {
// we only set a removable eUICC to the default if there are no active non-removable
// eUICCs
mDefaultEuiccCardId = convertToPublicCardId(eid);
logWithLocalLog("onEidReady: eid=" + eid + " from removable eUICC in slot=" + slotId + " mDefaultEuiccCardId=" + mDefaultEuiccCardId);
}
}
card.unregisterForEidReady(this);
}
use of com.android.internal.telephony.uicc.euicc.EuiccCard in project android_frameworks_opt_telephony by LineageOS.
the class EuiccCardController method retrieveNotification.
@Override
public void retrieveNotification(String callingPackage, String cardId, int seqNumber, IRetrieveNotificationCallback callback) {
try {
checkCallingPackage(callingPackage);
} catch (SecurityException se) {
try {
callback.onComplete(EuiccCardManager.RESULT_CALLER_NOT_ALLOWED, null);
} catch (RemoteException re) {
loge("callback onComplete failure after checkCallingPackage.", re);
}
return;
}
EuiccCard card = getEuiccCard(cardId);
if (card == null) {
try {
callback.onComplete(EuiccCardManager.RESULT_EUICC_NOT_FOUND, null);
} catch (RemoteException exception) {
loge("retrieveNotification callback failure.", exception);
}
return;
}
AsyncResultCallback<EuiccNotification> cardCb = new AsyncResultCallback<EuiccNotification>() {
@Override
public void onResult(EuiccNotification result) {
try {
callback.onComplete(EuiccCardManager.RESULT_OK, result);
} catch (RemoteException exception) {
loge("retrieveNotification callback failure.", exception);
}
}
@Override
public void onException(Throwable e) {
try {
loge("retrieveNotification callback onException: ", e);
callback.onComplete(getResultCode(e), null);
} catch (RemoteException exception) {
loge("retrieveNotification callback failure.", exception);
}
}
};
card.retrieveNotification(seqNumber, cardCb, mEuiccMainThreadHandler);
}
use of com.android.internal.telephony.uicc.euicc.EuiccCard in project android_frameworks_opt_telephony by LineageOS.
the class EuiccCardController method getEuiccInfo1.
@Override
public void getEuiccInfo1(String callingPackage, String cardId, IGetEuiccInfo1Callback callback) {
try {
checkCallingPackage(callingPackage);
} catch (SecurityException se) {
try {
callback.onComplete(EuiccCardManager.RESULT_CALLER_NOT_ALLOWED, null);
} catch (RemoteException re) {
loge("callback onComplete failure after checkCallingPackage.", re);
}
return;
}
EuiccCard card = getEuiccCard(cardId);
if (card == null) {
try {
callback.onComplete(EuiccCardManager.RESULT_EUICC_NOT_FOUND, null);
} catch (RemoteException exception) {
loge("getEuiccInfo1 callback failure.", exception);
}
return;
}
AsyncResultCallback<byte[]> cardCb = new AsyncResultCallback<byte[]>() {
@Override
public void onResult(byte[] result) {
try {
callback.onComplete(EuiccCardManager.RESULT_OK, result);
} catch (RemoteException exception) {
loge("getEuiccInfo1 callback failure.", exception);
}
}
@Override
public void onException(Throwable e) {
try {
loge("getEuiccInfo1 callback onException: ", e);
callback.onComplete(getResultCode(e), null);
} catch (RemoteException exception) {
loge("getEuiccInfo1 callback failure.", exception);
}
}
};
card.getEuiccInfo1(cardCb, mEuiccMainThreadHandler);
}
use of com.android.internal.telephony.uicc.euicc.EuiccCard in project android_frameworks_opt_telephony by LineageOS.
the class EuiccCardController method disableProfile.
@Override
public void disableProfile(String callingPackage, String cardId, String iccid, boolean refresh, IDisableProfileCallback callback) {
try {
checkCallingPackage(callingPackage);
} catch (SecurityException se) {
try {
callback.onComplete(EuiccCardManager.RESULT_CALLER_NOT_ALLOWED);
} catch (RemoteException re) {
loge("callback onComplete failure after checkCallingPackage.", re);
}
return;
}
EuiccCard card = getEuiccCard(cardId);
if (card == null) {
try {
callback.onComplete(EuiccCardManager.RESULT_EUICC_NOT_FOUND);
} catch (RemoteException exception) {
loge("disableProfile callback failure.", exception);
}
return;
}
AsyncResultCallback<Void> cardCb = new AsyncResultCallback<Void>() {
@Override
public void onResult(Void result) {
try {
callback.onComplete(EuiccCardManager.RESULT_OK);
} catch (RemoteException exception) {
loge("disableProfile callback failure.", exception);
}
}
@Override
public void onException(Throwable e) {
try {
loge("disableProfile callback onException: ", e);
callback.onComplete(getResultCode(e));
} catch (RemoteException exception) {
loge("disableProfile callback failure.", exception);
}
}
};
card.disableProfile(iccid, refresh, cardCb, mEuiccMainThreadHandler);
}
Aggregations