Search in sources :

Example 46 with ImsCall

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

the class TelephonyTester method handleTestConferenceEventPackage.

/**
 * Handles request to send a test conference event package to the active Ims call.
 *
 * @see com.android.internal.telephony.test.TestConferenceEventPackageParser
 * @param context The context.
 * @param fileName The name of the test conference event package file to read.
 */
private void handleTestConferenceEventPackage(Context context, String fileName, boolean isBypassingImsCall) {
    // Attempt to get the active IMS call before parsing the test XML file.
    ImsPhone imsPhone = (ImsPhone) mPhone;
    if (imsPhone == null) {
        return;
    }
    ImsPhoneCallTracker tracker = (ImsPhoneCallTracker) imsPhone.getCallTracker();
    File packageFile = new File(context.getFilesDir(), fileName);
    final FileInputStream is;
    try {
        is = new FileInputStream(packageFile);
    } catch (FileNotFoundException ex) {
        log("Test conference event package file not found: " + packageFile.getAbsolutePath());
        return;
    }
    TestConferenceEventPackageParser parser = new TestConferenceEventPackageParser(is);
    ImsConferenceState imsConferenceState = parser.parse();
    if (imsConferenceState == null) {
        return;
    }
    if (isBypassingImsCall) {
        tracker.injectTestConferenceState(imsConferenceState);
    } else {
        ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
        if (imsPhoneCall == null) {
            return;
        }
        ImsCall imsCall = imsPhoneCall.getImsCall();
        if (imsCall == null) {
            return;
        }
        imsCall.conferenceStateUpdated(imsConferenceState);
    }
}
Also used : TestConferenceEventPackageParser(com.android.internal.telephony.test.TestConferenceEventPackageParser) ImsPhoneCallTracker(com.android.internal.telephony.imsphone.ImsPhoneCallTracker) ImsCall(com.android.ims.ImsCall) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall) FileNotFoundException(java.io.FileNotFoundException) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) File(java.io.File) FileInputStream(java.io.FileInputStream) ImsConferenceState(android.telephony.ims.ImsConferenceState)

Example 47 with ImsCall

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

the class TelephonyTester method handleHandoverFailedIntent.

private void handleHandoverFailedIntent() {
    // Attempt to get the active IMS call
    ImsPhone imsPhone = (ImsPhone) mPhone;
    if (imsPhone == null) {
        return;
    }
    ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
    if (imsPhoneCall == null) {
        return;
    }
    ImsCall imsCall = imsPhoneCall.getImsCall();
    if (imsCall == null) {
        return;
    }
    imsCall.getImsCallSessionListenerProxy().callSessionHandoverFailed(imsCall.getCallSession(), TelephonyManager.NETWORK_TYPE_LTE, TelephonyManager.NETWORK_TYPE_IWLAN, new ImsReasonInfo());
}
Also used : ImsCall(com.android.ims.ImsCall) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone) ImsReasonInfo(android.telephony.ims.ImsReasonInfo)

Example 48 with ImsCall

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

the class TelephonyTester method testImsECall.

void testImsECall() {
    // Attempt to get the active IMS call before parsing the test XML file.
    ImsPhone imsPhone = (ImsPhone) mPhone;
    if (imsPhone == null) {
        return;
    }
    ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
    if (imsPhoneCall == null) {
        return;
    }
    ImsCall imsCall = imsPhoneCall.getImsCall();
    if (imsCall == null) {
        return;
    }
    ImsCallProfile callProfile = imsCall.getCallProfile();
    Bundle extras = callProfile.getCallExtras();
    if (extras == null) {
        extras = new Bundle();
    }
    extras.putBoolean(ImsCallProfile.EXTRA_EMERGENCY_CALL, true);
    callProfile.mCallExtras = extras;
    imsCall.getImsCallSessionListenerProxy().callSessionUpdated(imsCall.getSession(), callProfile);
}
Also used : ImsCallProfile(android.telephony.ims.ImsCallProfile) ImsCall(com.android.ims.ImsCall) Bundle(android.os.Bundle) ImsPhoneCall(com.android.internal.telephony.imsphone.ImsPhoneCall) ImsPhone(com.android.internal.telephony.imsphone.ImsPhone)

Aggregations

ImsCall (com.android.ims.ImsCall)48 ImsException (com.android.ims.ImsException)19 SmallTest (android.test.suitebuilder.annotation.SmallTest)16 CallStateException (com.android.internal.telephony.CallStateException)16 TelephonyTest (com.android.internal.telephony.TelephonyTest)16 Test (org.junit.Test)16 ImsCallProfile (android.telephony.ims.ImsCallProfile)8 FlakyTest (androidx.test.filters.FlakyTest)8 RemoteException (android.os.RemoteException)6 Connection (com.android.internal.telephony.Connection)5 ImsPhoneCall (com.android.internal.telephony.imsphone.ImsPhoneCall)5 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)4 ImsReasonInfo (android.telephony.ims.ImsReasonInfo)3 ImsMultiEndpoint (com.android.ims.ImsMultiEndpoint)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 Bundle (android.os.Bundle)2 PersistableBundle (android.os.PersistableBundle)2 TestConferenceEventPackageParser (com.android.internal.telephony.test.TestConferenceEventPackageParser)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2