Search in sources :

Example 61 with AsyncResult

use of android.os.AsyncResult 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));
}
Also used : EuiccCard(com.android.internal.telephony.uicc.euicc.EuiccCard) AsyncResult(android.os.AsyncResult)

Example 62 with AsyncResult

use of android.os.AsyncResult in project android_frameworks_opt_telephony by LineageOS.

the class IccRecords method registerForImsiReady.

public void registerForImsiReady(Handler h, int what, Object obj) {
    if (mDestroyed.get()) {
        return;
    }
    Registrant r = new Registrant(h, what, obj);
    mImsiReadyRegistrants.add(r);
    if (getIMSI() != null) {
        r.notifyRegistrant(new AsyncResult(null, null, null));
    }
}
Also used : Registrant(android.os.Registrant) AsyncResult(android.os.AsyncResult)

Example 63 with AsyncResult

use of android.os.AsyncResult in project android_frameworks_opt_telephony by LineageOS.

the class IccRecords method registerForSpnUpdate.

public void registerForSpnUpdate(Handler h, int what, Object obj) {
    if (mDestroyed.get()) {
        return;
    }
    Registrant r = new Registrant(h, what, obj);
    mSpnUpdatedRegistrants.add(r);
    if (!TextUtils.isEmpty(mSpn)) {
        r.notifyRegistrant(new AsyncResult(null, null, null));
    }
}
Also used : Registrant(android.os.Registrant) AsyncResult(android.os.AsyncResult)

Example 64 with AsyncResult

use of android.os.AsyncResult in project android_frameworks_opt_telephony by LineageOS.

the class IccRecords method registerForRecordsOverride.

public void registerForRecordsOverride(Handler h, int what, Object obj) {
    if (mDestroyed.get()) {
        return;
    }
    Registrant r = new Registrant(h, what, obj);
    mRecordsOverrideRegistrants.add(r);
    if (getRecordsLoaded()) {
        r.notifyRegistrant(new AsyncResult(null, null, null));
    }
}
Also used : Registrant(android.os.Registrant) AsyncResult(android.os.AsyncResult)

Example 65 with AsyncResult

use of android.os.AsyncResult in project android_frameworks_opt_telephony by LineageOS.

the class AdnRecordCache method clearWaiters.

private void clearWaiters() {
    int size = mAdnLikeWaiters.size();
    for (int i = 0; i < size; i++) {
        ArrayList<Message> waiters = mAdnLikeWaiters.valueAt(i);
        AsyncResult ar = new AsyncResult(null, null, new RuntimeException("AdnCache reset"));
        notifyWaiters(waiters, ar);
    }
    mAdnLikeWaiters.clear();
}
Also used : Message(android.os.Message) AsyncResult(android.os.AsyncResult)

Aggregations

AsyncResult (android.os.AsyncResult)267 Test (org.junit.Test)60 Message (android.os.Message)57 TelephonyTest (com.android.internal.telephony.TelephonyTest)45 SmallTest (android.test.suitebuilder.annotation.SmallTest)26 ArrayList (java.util.ArrayList)21 Registrant (android.os.Registrant)19 FlakyTest (androidx.test.filters.FlakyTest)17 Intent (android.content.Intent)13 CellInfo (android.telephony.CellInfo)12 MediumTest (android.test.suitebuilder.annotation.MediumTest)12 SmallTest (androidx.test.filters.SmallTest)11 NetworkRegistrationInfo (android.telephony.NetworkRegistrationInfo)9 List (java.util.List)7 Mockito.anyString (org.mockito.Mockito.anyString)6 InvocationOnMock (org.mockito.invocation.InvocationOnMock)6 FlakyTest (android.support.test.filters.FlakyTest)5 MediumTest (android.support.test.filters.MediumTest)5 LteVopsSupportInfo (android.telephony.LteVopsSupportInfo)5 SmsMessage (android.telephony.SmsMessage)5