Search in sources :

Example 1 with ImsException

use of android.telephony.ims.ImsException in project robolectric by robolectric.

the class ShadowImsMmTelManagerTest method registerMmTelCapabilityCallback_imsNotSupported_imsExceptionThrown.

@Test
public void registerMmTelCapabilityCallback_imsNotSupported_imsExceptionThrown() {
    shadowImsMmTelManager.setImsAvailableOnDevice(false);
    try {
        shadowImsMmTelManager.registerMmTelCapabilityCallback(Runnable::run, new CapabilityCallback());
        assertWithMessage("Expected ImsException was not thrown").fail();
    } catch (ImsException e) {
        assertThat(e.getCode()).isEqualTo(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
        assertThat(e).hasMessageThat().contains("IMS not available on device.");
    }
}
Also used : CapabilityCallback(android.telephony.ims.ImsMmTelManager.CapabilityCallback) ImsException(android.telephony.ims.ImsException) Test(org.junit.Test)

Example 2 with ImsException

use of android.telephony.ims.ImsException in project android_packages_apps_Settings by omnirom.

the class SimStatusDialogController method registerImsRegistrationCallback.

private void registerImsRegistrationCallback(int subId) {
    if (!isImsRegistrationStateShowUp()) {
        return;
    }
    try {
        final ImsMmTelManager imsMmTelMgr = ImsMmTelManager.createForSubscriptionId(subId);
        imsMmTelMgr.registerImsRegistrationCallback(mDialog.getContext().getMainExecutor(), mImsRegStateCallback);
    } catch (ImsException exception) {
        Log.w(TAG, "fail to register IMS status for subId=" + subId, exception);
    }
}
Also used : ImsMmTelManager(android.telephony.ims.ImsMmTelManager) ImsException(android.telephony.ims.ImsException)

Aggregations

ImsException (android.telephony.ims.ImsException)2 ImsMmTelManager (android.telephony.ims.ImsMmTelManager)1 CapabilityCallback (android.telephony.ims.ImsMmTelManager.CapabilityCallback)1 Test (org.junit.Test)1