use of com.android.internal.telephony.uicc.UiccCardApplication in project android_frameworks_opt_telephony by LineageOS.
the class CatService method getInstance.
/**
* Used for instantiating the Service from the Card.
*
* @param ci CommandsInterface object
* @param context phone app context
* @param ic Icc card
* @param slotId to know the index of card
* @return The only Service object in the system
*/
public static CatService getInstance(CommandsInterface ci, Context context, UiccProfile uiccProfile, int slotId) {
UiccCardApplication ca = null;
IccFileHandler fh = null;
IccRecords ir = null;
if (uiccProfile != null) {
/* Since Cat is not tied to any application, but rather is Uicc application
* in itself - just get first FileHandler and IccRecords object
*/
ca = uiccProfile.getApplicationIndex(0);
if (ca != null) {
fh = ca.getIccFileHandler();
ir = ca.getIccRecords();
}
}
synchronized (sInstanceLock) {
if (sInstance == null) {
int simCount = TelephonyManager.getDefault().getSupportedModemCount();
sInstance = new CatService[simCount];
for (int i = 0; i < simCount; i++) {
sInstance[i] = null;
}
}
if (sInstance[slotId] == null) {
if (ci == null || ca == null || ir == null || context == null || fh == null || uiccProfile == null) {
return null;
}
sInstance[slotId] = new CatService(ci, ca, ir, context, fh, uiccProfile, slotId);
} else if ((ir != null) && (mIccRecords != ir)) {
if (mIccRecords != null) {
mIccRecords.unregisterForRecordsLoaded(sInstance[slotId]);
}
mIccRecords = ir;
mUiccApplication = ca;
mIccRecords.registerForRecordsLoaded(sInstance[slotId], MSG_ID_ICC_RECORDS_LOADED, null);
CatLog.d(sInstance[slotId], "registerForRecordsLoaded slotid=" + slotId + " instance:" + sInstance[slotId]);
}
return sInstance[slotId];
}
}
use of com.android.internal.telephony.uicc.UiccCardApplication in project android_frameworks_opt_telephony by LineageOS.
the class CatService method update.
public void update(CommandsInterface ci, Context context, UiccProfile uiccProfile) {
UiccCardApplication ca = null;
IccRecords ir = null;
if (uiccProfile != null) {
/* Since Cat is not tied to any application, but rather is Uicc application
* in itself - just get first FileHandler and IccRecords object
*/
ca = uiccProfile.getApplicationIndex(0);
if (ca != null) {
ir = ca.getIccRecords();
}
}
synchronized (sInstanceLock) {
if ((ir != null) && (mIccRecords != ir)) {
if (mIccRecords != null) {
mIccRecords.unregisterForRecordsLoaded(this);
}
CatLog.d(this, "Reinitialize the Service with SIMRecords and UiccCardApplication");
mIccRecords = ir;
mUiccApplication = ca;
// re-Register for SIM ready event.
mIccRecords.registerForRecordsLoaded(this, MSG_ID_ICC_RECORDS_LOADED, null);
CatLog.d(this, "registerForRecordsLoaded slotid=" + mSlotId + " instance:" + this);
}
}
}
use of com.android.internal.telephony.uicc.UiccCardApplication in project android_frameworks_opt_telephony by LineageOS.
the class GsmSMSDispatcher method onUpdateIccAvailability.
private void onUpdateIccAvailability() {
if (mUiccController == null) {
return;
}
UiccCardApplication newUiccApplication = getUiccCardApplication();
UiccCardApplication app = mUiccApplication.get();
if (app != newUiccApplication) {
if (app != null) {
Rlog.d(TAG, "Removing stale icc objects.");
if (mIccRecords.get() != null) {
mIccRecords.get().unregisterForNewSms(this);
}
mIccRecords.set(null);
mUiccApplication.set(null);
}
if (newUiccApplication != null) {
Rlog.d(TAG, "New Uicc application found");
mUiccApplication.set(newUiccApplication);
mIccRecords.set(newUiccApplication.getIccRecords());
if (mIccRecords.get() != null) {
mIccRecords.get().registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
}
}
}
}
use of com.android.internal.telephony.uicc.UiccCardApplication in project android_frameworks_opt_telephony by LineageOS.
the class CatService method getInstance.
/**
* Used for instantiating the Service from the Card.
*
* @param ci CommandsInterface object
* @param context phone app context
* @param ic Icc card
* @param slotId to know the index of card
* @return The only Service object in the system
*/
public static CatService getInstance(CommandsInterface ci, Context context, UiccCard ic, int slotId) {
UiccCardApplication ca = null;
IccFileHandler fh = null;
IccRecords ir = null;
if (ic != null) {
/* Since Cat is not tied to any application, but rather is Uicc application
* in itself - just get first FileHandler and IccRecords object
*/
ca = ic.getApplicationIndex(0);
if (ca != null) {
fh = ca.getIccFileHandler();
ir = ca.getIccRecords();
}
}
synchronized (sInstanceLock) {
if (sInstance == null) {
int simCount = TelephonyManager.getDefault().getSimCount();
sInstance = new CatService[simCount];
for (int i = 0; i < simCount; i++) {
sInstance[i] = null;
}
}
if (sInstance[slotId] == null) {
if (ci == null || ca == null || ir == null || context == null || fh == null || ic == null) {
return null;
}
sInstance[slotId] = new CatService(ci, ca, ir, context, fh, ic, slotId);
} else if ((ir != null) && (mIccRecords != ir)) {
if (mIccRecords != null) {
mIccRecords.unregisterForRecordsLoaded(sInstance[slotId]);
}
mIccRecords = ir;
mUiccApplication = ca;
mIccRecords.registerForRecordsLoaded(sInstance[slotId], MSG_ID_ICC_RECORDS_LOADED, null);
CatLog.d(sInstance[slotId], "registerForRecordsLoaded slotid=" + slotId + " instance:" + sInstance[slotId]);
}
return sInstance[slotId];
}
}
use of com.android.internal.telephony.uicc.UiccCardApplication in project android_frameworks_opt_telephony by LineageOS.
the class GsmCdmaPhone method onUpdateIccAvailability.
// todo: check if ICC availability needs to be handled here. mSimRecords should not be needed
// now because APIs can be called directly on UiccProfile, and that should handle the requests
// correctly based on supported apps, voice RAT, etc.
@Override
protected void onUpdateIccAvailability() {
if (mUiccController == null) {
return;
}
UiccCardApplication newUiccApplication = null;
// Update mIsimUiccRecords
if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) {
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_IMS);
IsimUiccRecords newIsimUiccRecords = null;
if (newUiccApplication != null) {
newIsimUiccRecords = (IsimUiccRecords) newUiccApplication.getIccRecords();
if (DBG)
logd("New ISIM application found");
}
mIsimUiccRecords = newIsimUiccRecords;
}
// Update mSimRecords
if (mSimRecords != null) {
mSimRecords.unregisterForRecordsLoaded(this);
}
if (isPhoneTypeCdmaLte() || isPhoneTypeCdma()) {
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP);
SIMRecords newSimRecords = null;
if (newUiccApplication != null) {
newSimRecords = (SIMRecords) newUiccApplication.getIccRecords();
}
mSimRecords = newSimRecords;
if (mSimRecords != null) {
mSimRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
}
} else {
mSimRecords = null;
}
// Update mIccRecords, mUiccApplication, mIccPhoneBookIntManager
newUiccApplication = getUiccCardApplication();
if (!isPhoneTypeGsm() && newUiccApplication == null) {
logd("can't find 3GPP2 application; trying APP_FAM_3GPP");
newUiccApplication = mUiccController.getUiccCardApplication(mPhoneId, UiccController.APP_FAM_3GPP);
}
UiccCardApplication app = mUiccApplication.get();
if (app != newUiccApplication) {
if (app != null) {
if (DBG)
logd("Removing stale icc objects.");
if (mIccRecords.get() != null) {
unregisterForIccRecordEvents();
mIccPhoneBookIntManager.updateIccRecords(null);
}
mIccRecords.set(null);
mUiccApplication.set(null);
}
if (newUiccApplication != null) {
if (DBG) {
logd("New Uicc application found. type = " + newUiccApplication.getType());
}
final IccRecords iccRecords = newUiccApplication.getIccRecords();
mUiccApplication.set(newUiccApplication);
mIccRecords.set(iccRecords);
registerForIccRecordEvents();
mIccPhoneBookIntManager.updateIccRecords(iccRecords);
if (iccRecords != null) {
final String simOperatorNumeric = iccRecords.getOperatorNumeric();
if (DBG) {
logd("New simOperatorNumeric = " + simOperatorNumeric);
}
if (!TextUtils.isEmpty(simOperatorNumeric)) {
TelephonyManager.from(mContext).setSimOperatorNumericForPhone(mPhoneId, simOperatorNumeric);
}
}
updateCurrentCarrierInProvider();
}
}
reapplyUiccAppsEnablementIfNeeded(ENABLE_UICC_APPS_MAX_RETRIES);
}
Aggregations