Search in sources :

Example 21 with AsyncResultCallback

use of com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardController method getDefaultSmdpAddress.

@Override
public void getDefaultSmdpAddress(String callingPackage, String cardId, IGetDefaultSmdpAddressCallback 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("getDefaultSmdpAddress callback failure.", exception);
        }
        return;
    }
    AsyncResultCallback<String> cardCb = new AsyncResultCallback<String>() {

        @Override
        public void onResult(String result) {
            try {
                callback.onComplete(EuiccCardManager.RESULT_OK, result);
            } catch (RemoteException exception) {
                loge("getDefaultSmdpAddress callback failure.", exception);
            }
        }

        @Override
        public void onException(Throwable e) {
            try {
                loge("getDefaultSmdpAddress callback onException: ", e);
                callback.onComplete(getResultCode(e), null);
            } catch (RemoteException exception) {
                loge("getDefaultSmdpAddress callback failure.", exception);
            }
        }
    };
    card.getDefaultSmdpAddress(cardCb, mEuiccMainThreadHandler);
}
Also used : EuiccCard(com.android.internal.telephony.uicc.euicc.EuiccCard) RemoteException(android.os.RemoteException) AsyncResultCallback(com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback)

Example 22 with AsyncResultCallback

use of com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardController method resetMemory.

@Override
public void resetMemory(String callingPackage, String cardId, @EuiccCardManager.ResetOption int options, IResetMemoryCallback 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("resetMemory callback failure.", exception);
        }
        return;
    }
    AsyncResultCallback<Void> cardCb = new AsyncResultCallback<Void>() {

        @Override
        public void onResult(Void result) {
            Log.i(TAG, "Request subscription info list refresh after reset memory.");
            SubscriptionController.getInstance().requestEmbeddedSubscriptionInfoListRefresh(mUiccController.convertToPublicCardId(cardId));
            try {
                callback.onComplete(EuiccCardManager.RESULT_OK);
            } catch (RemoteException exception) {
                loge("resetMemory callback failure.", exception);
            }
        }

        @Override
        public void onException(Throwable e) {
            try {
                loge("resetMemory callback onException: ", e);
                callback.onComplete(getResultCode(e));
            } catch (RemoteException exception) {
                loge("resetMemory callback failure.", exception);
            }
        }
    };
    card.resetMemory(options, cardCb, mEuiccMainThreadHandler);
}
Also used : EuiccCard(com.android.internal.telephony.uicc.euicc.EuiccCard) RemoteException(android.os.RemoteException) AsyncResultCallback(com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback)

Example 23 with AsyncResultCallback

use of com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCard method loadEidAndNotifyRegistrants.

// For RadioConfig<1.2 we don't know the EID when constructing the EuiccCard, so callers may
// need to register to be notified when we have the EID
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
protected void loadEidAndNotifyRegistrants() {
    Handler euiccMainThreadHandler = new Handler();
    AsyncResultCallback<String> cardCb = new AsyncResultCallback<String>() {

        @Override
        public void onResult(String result) {
            if (mEidReadyRegistrants != null) {
                mEidReadyRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
            }
        }

        @Override
        public void onException(Throwable e) {
            // Still notifying registrants even getting eid fails.
            if (mEidReadyRegistrants != null) {
                mEidReadyRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
            }
            mEid = "";
            mCardId = "";
            Rlog.e(LOG_TAG, "Failed loading eid", e);
        }
    };
    getEid(cardCb, euiccMainThreadHandler);
}
Also used : Handler(android.os.Handler) AsyncResult(android.os.AsyncResult) AsyncResultCallback(com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback) VisibleForTesting(com.android.internal.annotations.VisibleForTesting)

Aggregations

AsyncResultCallback (com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback)23 RemoteException (android.os.RemoteException)22 EuiccCard (com.android.internal.telephony.uicc.euicc.EuiccCard)22 EuiccProfileInfo (android.service.euicc.EuiccProfileInfo)3 EuiccNotification (android.telephony.euicc.EuiccNotification)3 AsyncResult (android.os.AsyncResult)1 Handler (android.os.Handler)1 EuiccRulesAuthTable (android.telephony.euicc.EuiccRulesAuthTable)1 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)1