Search in sources :

Example 1 with ImsSsInfo

use of com.android.ims.ImsSsInfo in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhone method handleMessage.

@Override
public void handleMessage(Message msg) {
    AsyncResult ar = (AsyncResult) msg.obj;
    if (DBG)
        Rlog.d(LOG_TAG, "handleMessage what=" + msg.what);
    switch(msg.what) {
        case EVENT_SET_CALL_FORWARD_DONE:
            IccRecords r = mDefaultPhone.getIccRecords();
            Cf cf = (Cf) ar.userObj;
            if (cf.mIsCfu && ar.exception == null && r != null) {
                setVoiceCallForwardingFlag(r, 1, msg.arg1 == 1, cf.mSetCfNumber);
            }
            sendResponse(cf.mOnComplete, null, ar.exception);
            break;
        case EVENT_GET_CALL_FORWARD_DONE:
            CallForwardInfo[] cfInfos = null;
            if (ar.exception == null) {
                cfInfos = handleCfQueryResult((ImsCallForwardInfo[]) ar.result);
            }
            sendResponse((Message) ar.userObj, cfInfos, ar.exception);
            break;
        case EVENT_GET_CALL_BARRING_DONE:
        case EVENT_GET_CALL_WAITING_DONE:
            int[] ssInfos = null;
            if (ar.exception == null) {
                if (msg.what == EVENT_GET_CALL_BARRING_DONE) {
                    ssInfos = handleCbQueryResult((ImsSsInfo[]) ar.result);
                } else if (msg.what == EVENT_GET_CALL_WAITING_DONE) {
                    ssInfos = handleCwQueryResult((ImsSsInfo[]) ar.result);
                }
            }
            sendResponse((Message) ar.userObj, ssInfos, ar.exception);
            break;
        case EVENT_GET_CLIR_DONE:
            Bundle ssInfo = (Bundle) ar.result;
            int[] clirInfo = null;
            if (ssInfo != null) {
                clirInfo = ssInfo.getIntArray(ImsPhoneMmiCode.UT_BUNDLE_KEY_CLIR);
            }
            sendResponse((Message) ar.userObj, clirInfo, ar.exception);
            break;
        case EVENT_SET_CLIR_DONE:
            if (ar.exception == null) {
                saveClirSetting(msg.arg1);
            }
        // (Intentional fallthrough)
        case EVENT_SET_CALL_BARRING_DONE:
        case EVENT_SET_CALL_WAITING_DONE:
            sendResponse((Message) ar.userObj, null, ar.exception);
            break;
        case EVENT_DEFAULT_PHONE_DATA_STATE_CHANGED:
            if (DBG)
                Rlog.d(LOG_TAG, "EVENT_DEFAULT_PHONE_DATA_STATE_CHANGED");
            updateDataServiceState();
            break;
        case EVENT_SERVICE_STATE_CHANGED:
            if (VDBG)
                Rlog.d(LOG_TAG, "EVENT_SERVICE_STATE_CHANGED");
            ar = (AsyncResult) msg.obj;
            ServiceState newServiceState = (ServiceState) ar.result;
            // only update if roaming status changed
            if (mRoaming != newServiceState.getRoaming()) {
                if (DBG)
                    Rlog.d(LOG_TAG, "Roaming state changed");
                updateRoamingState(newServiceState.getRoaming());
            }
            break;
        case EVENT_VOICE_CALL_ENDED:
            if (DBG)
                Rlog.d(LOG_TAG, "Voice call ended. Handle pending updateRoamingState.");
            mCT.unregisterForVoiceCallEnded(this);
            // only update if roaming status changed
            boolean newRoaming = getCurrentRoaming();
            if (mRoaming != newRoaming) {
                updateRoamingState(newRoaming);
            }
            break;
        default:
            super.handleMessage(msg);
            break;
    }
}
Also used : ServiceState(android.telephony.ServiceState) IccRecords(com.android.internal.telephony.uicc.IccRecords) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ImsSsInfo(com.android.ims.ImsSsInfo) ImsCallForwardInfo(com.android.ims.ImsCallForwardInfo) CallForwardInfo(com.android.internal.telephony.CallForwardInfo) AsyncResult(android.os.AsyncResult)

Example 2 with ImsSsInfo

use of com.android.ims.ImsSsInfo in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneMmiCode method onIcbQueryComplete.

private void onIcbQueryComplete(AsyncResult ar) {
    Rlog.d(LOG_TAG, "onIcbQueryComplete mmi=" + this);
    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 {
        ImsSsInfo[] infos = (ImsSsInfo[]) ar.result;
        if (infos.length == 0) {
            sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
        } else {
            for (int i = 0, s = infos.length; i < s; i++) {
                if (infos[i].mIcbNum != null) {
                    sb.append("Num: " + infos[i].mIcbNum + " status: " + infos[i].mStatus + "\n");
                } else if (infos[i].mStatus == 1) {
                    sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled));
                } else {
                    sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
                }
            }
        }
        mState = State.COMPLETE;
    }
    mMessage = sb;
    mPhone.onMMIDone(this);
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) ImsSsInfo(com.android.ims.ImsSsInfo) ImsException(com.android.ims.ImsException)

Example 3 with ImsSsInfo

use of com.android.ims.ImsSsInfo in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneMmiCode method onSuppSvcQueryComplete.

private void onSuppSvcQueryComplete(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 {
        mState = State.FAILED;
        ImsSsInfo ssInfo = null;
        if (ar.result instanceof Bundle) {
            Rlog.d(LOG_TAG, "onSuppSvcQueryComplete: Received CLIP/COLP/COLR Response.");
            // Response for CLIP, COLP and COLR queries.
            Bundle ssInfoResp = (Bundle) ar.result;
            ssInfo = (ImsSsInfo) ssInfoResp.getParcelable(UT_BUNDLE_KEY_SSINFO);
            if (ssInfo != null) {
                Rlog.d(LOG_TAG, "onSuppSvcQueryComplete: ImsSsInfo mStatus = " + ssInfo.mStatus);
                if (ssInfo.mStatus == ImsSsInfo.DISABLED) {
                    sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
                    mState = State.COMPLETE;
                } else if (ssInfo.mStatus == ImsSsInfo.ENABLED) {
                    sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled));
                    mState = State.COMPLETE;
                } else {
                    sb.append(mContext.getText(com.android.internal.R.string.mmiError));
                }
            } else {
                sb.append(mContext.getText(com.android.internal.R.string.mmiError));
            }
        } else {
            Rlog.d(LOG_TAG, "onSuppSvcQueryComplete: Received Call Barring Response.");
            // Response for Call Barring queries.
            int[] cbInfos = (int[]) ar.result;
            if (cbInfos[0] == 1) {
                sb.append(mContext.getText(com.android.internal.R.string.serviceEnabled));
                mState = State.COMPLETE;
            } else {
                sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
                mState = State.COMPLETE;
            }
        }
    }
    mMessage = sb;
    Rlog.d(LOG_TAG, "onSuppSvcQueryComplete mmi=" + this);
    mPhone.onMMIDone(this);
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) Bundle(android.os.Bundle) ImsSsInfo(com.android.ims.ImsSsInfo) ImsException(com.android.ims.ImsException)

Aggregations

ImsSsInfo (com.android.ims.ImsSsInfo)3 Bundle (android.os.Bundle)2 SpannableStringBuilder (android.text.SpannableStringBuilder)2 ImsException (com.android.ims.ImsException)2 AsyncResult (android.os.AsyncResult)1 PersistableBundle (android.os.PersistableBundle)1 ServiceState (android.telephony.ServiceState)1 ImsCallForwardInfo (com.android.ims.ImsCallForwardInfo)1 CallForwardInfo (com.android.internal.telephony.CallForwardInfo)1 IccRecords (com.android.internal.telephony.uicc.IccRecords)1