Search in sources :

Example 31 with ImsException

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);
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) ImsException(com.android.ims.ImsException) CallForwardInfo(com.android.internal.telephony.CallForwardInfo) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 32 with ImsException

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));
}
Also used : Context(android.content.Context) Message(android.os.Message) ImsException(com.android.ims.ImsException) PendingIntent(android.app.PendingIntent) ImsConnectionStateListener(com.android.ims.ImsConnectionStateListener) FlakyTest(android.support.test.filters.FlakyTest) Ignore(org.junit.Ignore) TelephonyTest(com.android.internal.telephony.TelephonyTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 33 with ImsException

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);
    }
}
Also used : Message(android.os.Message) ImsUtInterface(com.android.ims.ImsUtInterface) ImsException(com.android.ims.ImsException)

Example 34 with ImsException

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);
    }
}
Also used : Message(android.os.Message) ImsUtInterface(com.android.ims.ImsUtInterface) ImsException(com.android.ims.ImsException)

Example 35 with ImsException

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);
    }
}
Also used : Message(android.os.Message) ImsUtInterface(com.android.ims.ImsUtInterface) ImsException(com.android.ims.ImsException)

Aggregations

ImsException (com.android.ims.ImsException)37 Message (android.os.Message)9 ImsUtInterface (com.android.ims.ImsUtInterface)8 ImsCall (com.android.ims.ImsCall)7 ImsConfig (com.android.ims.ImsConfig)7 SpannableStringBuilder (android.text.SpannableStringBuilder)6 CallStateException (com.android.internal.telephony.CallStateException)6 ImsCallProfile (com.android.ims.ImsCallProfile)4 Context (android.content.Context)3 PendingIntent (android.app.PendingIntent)2 Bundle (android.os.Bundle)2 FlakyTest (android.support.test.filters.FlakyTest)2 SmallTest (android.test.suitebuilder.annotation.SmallTest)2 ImsConnectionStateListener (com.android.ims.ImsConnectionStateListener)2 ImsSsInfo (com.android.ims.ImsSsInfo)2 CommandException (com.android.internal.telephony.CommandException)2 TelephonyTest (com.android.internal.telephony.TelephonyTest)2 Test (org.junit.Test)2 Intent (android.content.Intent)1 AsyncResult (android.os.AsyncResult)1