use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneMmiCode method onQueryCfComplete.
private void onQueryCfComplete(AsyncResult ar) {
StringBuilder sb = new StringBuilder(getScString());
sb.append("\n");
if (ar.exception != null) {
mState = State.FAILED;
if (ar.exception instanceof ImsException) {
ImsException error = (ImsException) ar.exception;
if (error.getMessage() != null) {
sb.append(error.getMessage());
} else {
sb.append(getErrorMessage(ar));
}
} else {
sb.append(getErrorMessage(ar));
}
} else {
CallForwardInfo[] infos;
infos = (CallForwardInfo[]) ar.result;
if (infos.length == 0) {
// Assume the default is not active
sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
// Set unconditional CFF in SIM to false
if (mIccRecords != null) {
mPhone.setVoiceCallForwardingFlag(1, false, null);
}
} else {
SpannableStringBuilder tb = new SpannableStringBuilder();
for (int serviceClassMask = 1; serviceClassMask <= SERVICE_CLASS_MAX; serviceClassMask <<= 1) {
for (int i = 0, s = infos.length; i < s; i++) {
if ((serviceClassMask & infos[i].serviceClass) != 0) {
tb.append(makeCFQueryResultMessage(infos[i], serviceClassMask));
tb.append("\n");
}
}
}
sb.append(tb);
}
mState = State.COMPLETE;
}
mMessage = sb;
Rlog.d(LOG_TAG, "onQueryCfComplete: mmi=" + this);
mPhone.onMMIDone(this);
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTrackerTest method testTTYImsServiceUnavailable.
@FlakyTest
@Ignore
@Test
@SmallTest
public void testTTYImsServiceUnavailable() throws ImsException {
doThrow(new ImsException("Test Exception", ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN)).when(mImsManager).setUiTTYMode(nullable(Context.class), anyInt(), nullable(Message.class));
// Remove retry timeout delay
// ms
mCTUT.mRetryTimeout = () -> 0;
mCTUT.setUiTTYMode(0, new Message());
// wait for handler to process ImsService connection retry
waitForHandlerAction(mCTHander, 100);
// Make sure that open is called in ImsPhoneCallTracker to re-establish connection to
// ImsService
verify(mImsManager, times(2)).open(anyInt(), nullable(PendingIntent.class), nullable(ImsConnectionStateListener.class));
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method getCallBarring.
public void getCallBarring(String facility, Message onComplete) {
if (DBG)
Rlog.d(LOG_TAG, "getCallBarring facility=" + facility);
Message resp;
resp = obtainMessage(EVENT_GET_CALL_BARRING_DONE, onComplete);
try {
ImsUtInterface ut = mCT.getUtInterface();
ut.queryCallBarring(getCBTypeFromFacility(facility), resp);
} catch (ImsException e) {
sendErrorResponse(onComplete, e);
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method setCallBarring.
public void setCallBarring(String facility, boolean lockState, String password, Message onComplete) {
if (DBG)
Rlog.d(LOG_TAG, "setCallBarring facility=" + facility + ", lockState=" + lockState);
Message resp;
resp = obtainMessage(EVENT_SET_CALL_BARRING_DONE, onComplete);
int action;
if (lockState) {
action = CommandsInterface.CF_ACTION_ENABLE;
} else {
action = CommandsInterface.CF_ACTION_DISABLE;
}
try {
ImsUtInterface ut = mCT.getUtInterface();
// password is not required with Ut interface
ut.updateCallBarring(getCBTypeFromFacility(facility), action, resp, null);
} catch (ImsException e) {
sendErrorResponse(onComplete, e);
}
}
use of com.android.ims.ImsException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method setOutgoingCallerIdDisplay.
@Override
public void setOutgoingCallerIdDisplay(int clirMode, Message onComplete) {
if (DBG)
Rlog.d(LOG_TAG, "setCLIR action= " + clirMode);
Message resp;
// Packing CLIR value in the message. This will be required for
// SharedPreference caching, if the message comes back as part of
// a success response.
resp = obtainMessage(EVENT_SET_CLIR_DONE, clirMode, 0, onComplete);
try {
ImsUtInterface ut = mCT.getUtInterface();
ut.updateCLIR(clirMode, resp);
} catch (ImsException e) {
sendErrorResponse(onComplete, e);
}
}
Aggregations