Search in sources :

Example 6 with UiccCardApplication

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];
    }
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) IccFileHandler(com.android.internal.telephony.uicc.IccFileHandler) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 7 with UiccCardApplication

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);
        }
    }
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 8 with UiccCardApplication

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);
            }
        }
    }
}
Also used : UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 9 with UiccCardApplication

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];
    }
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) IccFileHandler(com.android.internal.telephony.uicc.IccFileHandler) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Example 10 with UiccCardApplication

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);
}
Also used : IccRecords(com.android.internal.telephony.uicc.IccRecords) SIMRecords(com.android.internal.telephony.uicc.SIMRecords) IsimUiccRecords(com.android.internal.telephony.uicc.IsimUiccRecords) UiccCardApplication(com.android.internal.telephony.uicc.UiccCardApplication)

Aggregations

UiccCardApplication (com.android.internal.telephony.uicc.UiccCardApplication)14 IccRecords (com.android.internal.telephony.uicc.IccRecords)6 IccFileHandler (com.android.internal.telephony.uicc.IccFileHandler)3 SIMRecords (com.android.internal.telephony.uicc.SIMRecords)3 UnsupportedAppUsage (android.compat.annotation.UnsupportedAppUsage)2 RuimRecords (com.android.internal.telephony.uicc.RuimRecords)2 NonNull (android.annotation.NonNull)1 CarrierConfigManager (android.telephony.CarrierConfigManager)1 CarrierDisplayNameResolver (com.android.internal.telephony.cdnr.CarrierDisplayNameResolver)1 AppState (com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState)1 IsimUiccRecords (com.android.internal.telephony.uicc.IsimUiccRecords)1 UiccCard (com.android.internal.telephony.uicc.UiccCard)1 Before (org.junit.Before)1