Search in sources :

Example 1 with ImsCallProfile

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

the class ImsCallTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp(getClass().getSimpleName());
    mTestCallProfile = new ImsCallProfile();
    mBundle = mTestCallProfile.mCallExtras;
}
Also used : ImsCallProfile(com.android.ims.ImsCallProfile) Before(org.junit.Before)

Example 2 with ImsCallProfile

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

the class ImsPhoneCallTracker method dialInternal.

private void dialInternal(ImsPhoneConnection conn, int clirMode, int videoState, Bundle intentExtras) {
    if (conn == null) {
        return;
    }
    if (conn.getAddress() == null || conn.getAddress().length() == 0 || conn.getAddress().indexOf(PhoneNumberUtils.WILD) >= 0) {
        // Phone number is invalid
        conn.setDisconnectCause(DisconnectCause.INVALID_NUMBER);
        sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
        return;
    }
    // Always unmute when initiating a new call
    setMute(false);
    int serviceType = mPhoneNumberUtilsProxy.isEmergencyNumber(conn.getAddress()) ? ImsCallProfile.SERVICE_TYPE_EMERGENCY : ImsCallProfile.SERVICE_TYPE_NORMAL;
    int callType = ImsCallProfile.getCallTypeFromVideoState(videoState);
    // TODO(vt): Is this sufficient?  At what point do we know the video state of the call?
    conn.setVideoState(videoState);
    try {
        String[] callees = new String[] { conn.getAddress() };
        ImsCallProfile profile = mImsManager.createCallProfile(mServiceId, serviceType, callType);
        profile.setCallExtraInt(ImsCallProfile.EXTRA_OIR, clirMode);
        // ImsCallProfile key.
        if (intentExtras != null) {
            if (intentExtras.containsKey(android.telecom.TelecomManager.EXTRA_CALL_SUBJECT)) {
                intentExtras.putString(ImsCallProfile.EXTRA_DISPLAY_TEXT, cleanseInstantLetteringMessage(intentExtras.getString(android.telecom.TelecomManager.EXTRA_CALL_SUBJECT)));
            }
            if (intentExtras.containsKey(ImsCallProfile.EXTRA_IS_CALL_PULL)) {
                profile.mCallExtras.putBoolean(ImsCallProfile.EXTRA_IS_CALL_PULL, intentExtras.getBoolean(ImsCallProfile.EXTRA_IS_CALL_PULL));
                int dialogId = intentExtras.getInt(ImsExternalCallTracker.EXTRA_IMS_EXTERNAL_CALL_ID);
                conn.setIsPulledCall(true);
                conn.setPulledDialogId(dialogId);
            }
            // Pack the OEM-specific call extras.
            profile.mCallExtras.putBundle(ImsCallProfile.EXTRA_OEM_EXTRAS, intentExtras);
        // NOTE: Extras to be sent over the network are packed into the
        // intentExtras individually, with uniquely defined keys.
        // These key-value pairs are processed by IMS Service before
        // being sent to the lower layers/to the network.
        }
        ImsCall imsCall = mImsManager.makeCall(mServiceId, profile, callees, mImsCallListener);
        conn.setImsCall(imsCall);
        mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), imsCall.getSession());
        setVideoCallProvider(conn, imsCall);
        conn.setAllowAddCallDuringVideoCall(mAllowAddCallDuringVideoCall);
    } catch (ImsException e) {
        loge("dialInternal : " + e);
        conn.setDisconnectCause(DisconnectCause.ERROR_UNSPECIFIED);
        sendEmptyMessageDelayed(EVENT_HANGUP_PENDINGMO, TIMEOUT_HANGUP_PENDINGMO);
        retryGetImsService();
    } catch (RemoteException e) {
    }
}
Also used : ImsCallProfile(com.android.ims.ImsCallProfile) ImsCall(com.android.ims.ImsCall) ImsException(com.android.ims.ImsException) RemoteException(android.os.RemoteException) ImsMultiEndpoint(com.android.ims.ImsMultiEndpoint)

Example 3 with ImsCallProfile

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

the class ImsPhoneCallTracker method sendUSSD.

public void sendUSSD(String ussdString, Message response) {
    if (DBG)
        log("sendUSSD");
    try {
        if (mUssdSession != null) {
            mUssdSession.sendUssd(ussdString);
            AsyncResult.forMessage(response, null, null);
            response.sendToTarget();
            return;
        }
        if (mImsManager == null) {
            mPhone.sendErrorResponse(response, getImsManagerIsNullException());
            return;
        }
        String[] callees = new String[] { ussdString };
        ImsCallProfile profile = mImsManager.createCallProfile(mServiceId, ImsCallProfile.SERVICE_TYPE_NORMAL, ImsCallProfile.CALL_TYPE_VOICE);
        profile.setCallExtraInt(ImsCallProfile.EXTRA_DIALSTRING, ImsCallProfile.DIALSTRING_USSD);
        mUssdSession = mImsManager.makeCall(mServiceId, profile, callees, mImsUssdListener);
    } catch (ImsException e) {
        loge("sendUSSD : " + e);
        mPhone.sendErrorResponse(response, e);
        retryGetImsService();
    }
}
Also used : ImsCallProfile(com.android.ims.ImsCallProfile) ImsException(com.android.ims.ImsException)

Example 4 with ImsCallProfile

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

the class ImsPhoneConnection method updateExtras.

/**
 * Check for a change in call extras of {@link ImsCall}, and
 * update the {@link ImsPhoneConnection} accordingly.
 *
 * @param imsCall The call to check for changes in extras.
 * @return Whether the extras fields have been changed.
 */
boolean updateExtras(ImsCall imsCall) {
    if (imsCall == null) {
        return false;
    }
    final ImsCallProfile callProfile = imsCall.getCallProfile();
    final Bundle extras = callProfile != null ? callProfile.mCallExtras : null;
    if (extras == null && DBG) {
        Rlog.d(LOG_TAG, "Call profile extras are null.");
    }
    final boolean changed = !areBundlesEqual(extras, mExtras);
    if (changed) {
        updateWifiStateFromExtras(extras);
        mExtras.clear();
        mExtras.putAll(extras);
        setConnectionExtras(mExtras);
    }
    return changed;
}
Also used : ImsCallProfile(com.android.ims.ImsCallProfile) Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle)

Example 5 with ImsCallProfile

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

the class ImsPhoneConnection method updateAddressDisplay.

/**
 * Check for a change in the address display related fields for the {@link ImsCall}, and
 * update the {@link ImsPhoneConnection} with this information.
 *
 * @param imsCall The call to check for changes in address display fields.
 * @return Whether the address display fields have been changed.
 */
public boolean updateAddressDisplay(ImsCall imsCall) {
    if (imsCall == null) {
        return false;
    }
    boolean changed = false;
    ImsCallProfile callProfile = imsCall.getCallProfile();
    if (callProfile != null && isIncoming()) {
        // Only look for changes to the address for incoming calls.  The originating identity
        // can change for outgoing calls due to, for example, a call being forwarded to
        // voicemail.  This address change does not need to be presented to the user.
        String address = callProfile.getCallExtra(ImsCallProfile.EXTRA_OI);
        String name = callProfile.getCallExtra(ImsCallProfile.EXTRA_CNA);
        int nump = ImsCallProfile.OIRToPresentation(callProfile.getCallExtraInt(ImsCallProfile.EXTRA_OIR));
        int namep = ImsCallProfile.OIRToPresentation(callProfile.getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
        if (Phone.DEBUG_PHONE) {
            Rlog.d(LOG_TAG, "updateAddressDisplay: callId = " + getTelecomCallId() + " address = " + Rlog.pii(LOG_TAG, address) + " name = " + name + " nump = " + nump + " namep = " + namep);
        }
        if (!mIsMergeInProcess) {
            // to the call address while a merge is in process.
            if (!equalsBaseDialString(mAddress, address)) {
                mAddress = address;
                changed = true;
            }
            if (TextUtils.isEmpty(name)) {
                if (!TextUtils.isEmpty(mCnapName)) {
                    mCnapName = "";
                    changed = true;
                }
            } else if (!name.equals(mCnapName)) {
                mCnapName = name;
                changed = true;
            }
            if (mNumberPresentation != nump) {
                mNumberPresentation = nump;
                changed = true;
            }
            if (mCnapNamePresentation != namep) {
                mCnapNamePresentation = namep;
                changed = true;
            }
        }
    }
    return changed;
}
Also used : ImsCallProfile(com.android.ims.ImsCallProfile)

Aggregations

ImsCallProfile (com.android.ims.ImsCallProfile)6 ImsException (com.android.ims.ImsException)3 Bundle (android.os.Bundle)1 PersistableBundle (android.os.PersistableBundle)1 RemoteException (android.os.RemoteException)1 ImsCall (com.android.ims.ImsCall)1 ImsMultiEndpoint (com.android.ims.ImsMultiEndpoint)1 Before (org.junit.Before)1