use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.
the class EuiccCardController method retrieveNotificationList.
@Override
public void retrieveNotificationList(String callingPackage, String cardId, @EuiccNotification.Event int events, IRetrieveNotificationListCallback 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("retrieveNotificationList callback failure.", exception);
}
return;
}
AsyncResultCallback<EuiccNotification[]> cardCb = new AsyncResultCallback<EuiccNotification[]>() {
@Override
public void onResult(EuiccNotification[] result) {
try {
callback.onComplete(EuiccCardManager.RESULT_OK, result);
} catch (RemoteException exception) {
loge("retrieveNotificationList callback failure.", exception);
}
}
@Override
public void onException(Throwable e) {
try {
loge("retrieveNotificationList callback onException: ", e);
callback.onComplete(getResultCode(e), null);
} catch (RemoteException exception) {
loge("retrieveNotificationList callback failure.", exception);
}
}
};
card.retrieveNotificationList(events, cardCb, mEuiccMainThreadHandler);
}
use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.
the class EuiccCard method retrieveNotificationList.
/**
* Retrieves contents of all notification of the given {@code events}.
*
* @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 retrieveNotificationList(@EuiccNotification.Event int events, AsyncResultCallback<EuiccNotification[]> callback, Handler handler) {
sendApdu(newRequestProvider((RequestBuilder requestBuilder) -> requestBuilder.addStoreData(Asn1Node.newBuilder(Tags.TAG_RETRIEVE_NOTIFICATIONS_LIST).addChild(Asn1Node.newBuilder(Tags.TAG_CTX_COMP_0).addChildAsBits(Tags.TAG_CTX_1, events)).build().toHex())), response -> {
Asn1Node root = parseResponse(response);
if (root.hasChild(Tags.TAG_CTX_1)) {
// SGP.22 v2.0 RetrieveNotificationsListResponse
int error = root.getChild(Tags.TAG_CTX_1).asInteger();
switch(error) {
case CODE_NO_RESULT_AVAILABLE:
return new EuiccNotification[0];
default:
throw new EuiccCardErrorException(EuiccCardErrorException.OPERATION_RETRIEVE_NOTIFICATION, error);
}
}
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);
}
use of android.telephony.euicc.EuiccNotification 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);
}
use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.
the class EuiccNotificationTest method testEqualsHashCode.
@Test
public void testEqualsHashCode() {
EuiccNotification n = new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, new byte[] { 1 });
assertTrue(n.equals(n));
assertFalse(n.equals(new Object()));
EuiccNotification t = null;
assertFalse(n.equals(t));
t = new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, new byte[] { 1 });
assertTrue(n.equals(t));
assertEquals(n.hashCode(), t.hashCode());
t = new EuiccNotification(2, "g.co", EuiccNotification.EVENT_DELETE, new byte[] { 1 });
assertFalse(n.equals(t));
assertNotEquals(n.hashCode(), t.hashCode());
t = new EuiccNotification(1, "x.co", EuiccNotification.EVENT_DELETE, new byte[] { 1 });
assertFalse(n.equals(t));
assertNotEquals(n.hashCode(), t.hashCode());
t = new EuiccNotification(1, "g.co", 0, new byte[] { 1 });
assertFalse(n.equals(t));
assertNotEquals(n.hashCode(), t.hashCode());
t = new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, null);
assertFalse(n.equals(t));
assertNotEquals(n.hashCode(), t.hashCode());
}
Aggregations