Search in sources :

Example 6 with RequestBuilder

use of com.android.internal.telephony.uicc.euicc.apdu.RequestBuilder in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCard method listNotifications.

/**
 * Lists all notifications of the given {@code notificationEvents}.
 *
 * @param events Bits of the event types ({@link EuiccNotification.Event}) to list.
 * @param callback The callback to get the result.
 * @param handler The handler to run the callback.
 * @since 2.0.0 [GSMA SGP.22]
 */
public void listNotifications(@EuiccNotification.Event int events, AsyncResultCallback<EuiccNotification[]> callback, Handler handler) {
    sendApdu(newRequestProvider((RequestBuilder requestBuilder) -> requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_LIST_NOTIFICATION).addChildAsBits(Tags.TAG_CTX_1, events).build().toHex())), response -> {
        Asn1Node root = parseResponseAndCheckSimpleError(response, EuiccCardErrorException.OPERATION_LIST_NOTIFICATIONS);
        List<Asn1Node> nodes = root.getChild(Tags.TAG_CTX_COMP_0).getChildren();
        EuiccNotification[] notifications = new EuiccNotification[nodes.size()];
        for (int i = 0; i < notifications.length; ++i) {
            notifications[i] = createNotification(nodes.get(i));
        }
        return notifications;
    }, callback, handler);
}
Also used : Asn1Node(com.android.internal.telephony.uicc.asn1.Asn1Node) RequestBuilder(com.android.internal.telephony.uicc.euicc.apdu.RequestBuilder) EuiccNotification(android.telephony.euicc.EuiccNotification)

Aggregations

Asn1Node (com.android.internal.telephony.uicc.asn1.Asn1Node)6 RequestBuilder (com.android.internal.telephony.uicc.euicc.apdu.RequestBuilder)6 EuiccProfileInfo (android.service.euicc.EuiccProfileInfo)2 EuiccNotification (android.telephony.euicc.EuiccNotification)2 Asn1Decoder (com.android.internal.telephony.uicc.asn1.Asn1Decoder)2 CarrierIdentifier (android.service.carrier.CarrierIdentifier)1 EuiccRulesAuthTable (android.telephony.euicc.EuiccRulesAuthTable)1