Search in sources :

Example 1 with EuiccNotification

use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardTest method testListNotifications.

@Test
public void testListNotifications() {
    int channel = mockLogicalChannelResponses("BF282BA029" + // Notification #1
    "BF2F118001010C08736D64702E636F6D81020410" + // Notification #2
    "BF2F128001020C09736D6470322E636F6D81020420" + "9000");
    ResultCaptor<EuiccNotification[]> resultCaptor = new ResultCaptor<>();
    mEuiccCard.listNotifications(EuiccNotification.EVENT_DELETE | EuiccNotification.EVENT_DISABLE, resultCaptor, mHandler);
    processAllMessages();
    assertArrayEquals(new EuiccNotification[] { new EuiccNotification(1, "smdp.com", EuiccNotification.EVENT_DELETE, null), new EuiccNotification(2, "smdp2.com", EuiccNotification.EVENT_DISABLE, null) }, resultCaptor.result);
    verifyStoreData(channel, "BF280481020430");
}
Also used : EuiccNotification(android.telephony.euicc.EuiccNotification) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Example 2 with EuiccNotification

use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardTest method testRetrieveNotificationList.

@Test
public void testRetrieveNotificationList() {
    int channel = mockLogicalChannelResponses("BF2B2FA02D" + // Notification #1
    "3014BF2F118001010C08736D64702E636F6D81020410" + // Notification #2
    "3015BF2F128001020C09736D6470322E636F6D81020420" + "9000");
    ResultCaptor<EuiccNotification[]> resultCaptor = new ResultCaptor<>();
    mEuiccCard.retrieveNotificationList(EuiccNotification.EVENT_DELETE | EuiccNotification.EVENT_DISABLE, resultCaptor, mHandler);
    processAllMessages();
    assertArrayEquals(new EuiccNotification[] { new EuiccNotification(1, "smdp.com", EuiccNotification.EVENT_DELETE, IccUtils.hexStringToBytes("3014BF2F118001010C08736D64702E636F6D81020410")), new EuiccNotification(2, "smdp2.com", EuiccNotification.EVENT_DISABLE, IccUtils.hexStringToBytes("3015BF2F128001020C09736D6470322E636F6D81020420")) }, resultCaptor.result);
    verifyStoreData(channel, "BF2B06A00481020430");
}
Also used : EuiccNotification(android.telephony.euicc.EuiccNotification) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Example 3 with EuiccNotification

use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardTest method testRetrieveNotification.

@Test
public void testRetrieveNotification() {
    int channel = mockLogicalChannelResponses("BF2B18A016" + // Notification
    "3014BF2F118001010C08736D64702E636F6D81020410" + "9000");
    ResultCaptor<EuiccNotification> resultCaptor = new ResultCaptor<>();
    mEuiccCard.retrieveNotification(5, resultCaptor, mHandler);
    processAllMessages();
    assertEquals(new EuiccNotification(1, "smdp.com", EuiccNotification.EVENT_DELETE, IccUtils.hexStringToBytes("3014BF2F118001010C08736D64702E636F6D81020410")), resultCaptor.result);
    verifyStoreData(channel, "BF2B05A003800105");
}
Also used : EuiccNotification(android.telephony.euicc.EuiccNotification) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test)

Example 4 with EuiccNotification

use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardController method retrieveNotification.

@Override
public void retrieveNotification(String callingPackage, String cardId, int seqNumber, IRetrieveNotificationCallback 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("retrieveNotification 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("retrieveNotification callback failure.", exception);
            }
        }

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

Example 5 with EuiccNotification

use of android.telephony.euicc.EuiccNotification in project android_frameworks_opt_telephony by LineageOS.

the class EuiccCardController method listNotifications.

@Override
public void listNotifications(String callingPackage, String cardId, @EuiccNotification.Event int events, IListNotificationsCallback 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("listNotifications 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("listNotifications callback failure.", exception);
            }
        }

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

Aggregations

EuiccNotification (android.telephony.euicc.EuiccNotification)9 Test (org.junit.Test)4 RemoteException (android.os.RemoteException)3 TelephonyTest (com.android.internal.telephony.TelephonyTest)3 EuiccCard (com.android.internal.telephony.uicc.euicc.EuiccCard)3 AsyncResultCallback (com.android.internal.telephony.uicc.euicc.async.AsyncResultCallback)3 Asn1Node (com.android.internal.telephony.uicc.asn1.Asn1Node)2 RequestBuilder (com.android.internal.telephony.uicc.euicc.apdu.RequestBuilder)2