Search in sources :

Example 1 with ImsConferenceState

use of android.telephony.ims.ImsConferenceState in project android_frameworks_opt_telephony by LineageOS.

the class ImsPhoneCallTrackerTest method injectConferenceState.

private void injectConferenceState() {
    ImsPhoneConnection connection = mCTUT.getConnections().get(0);
    connection.addListener(mImsPhoneConnectionListener);
    ImsConferenceState state = new ImsConferenceState();
    // Yuck
    Bundle participant = new Bundle();
    participant.putString(ImsConferenceState.USER, "sip:6505551212@fakeims.com");
    participant.putString(ImsConferenceState.DISPLAY_TEXT, "yuck");
    participant.putString(ImsConferenceState.ENDPOINT, "sip:6505551212@fakeims.com");
    participant.putString(ImsConferenceState.STATUS, "connected");
    state.mParticipants.put("sip:6505551212@fakeims.com", participant);
    mImsCall.conferenceStateUpdated(state);
}
Also used : Bundle(android.os.Bundle) PersistableBundle(android.os.PersistableBundle) ImsConferenceState(android.telephony.ims.ImsConferenceState)

Example 2 with ImsConferenceState

use of android.telephony.ims.ImsConferenceState in project android_frameworks_opt_telephony by LineageOS.

the class TestConferenceEventPackageParser method parse.

/**
 * Parses the conference event package XML file and returns an
 * {@link ImsConferenceState} instance containing the participants described in
 * the XML file.
 *
 * @return The {@link ImsConferenceState} instance.
 */
public ImsConferenceState parse() {
    ImsConferenceState conferenceState = new ImsConferenceState();
    XmlPullParser parser;
    try {
        parser = Xml.newPullParser();
        parser.setInput(mInputStream, null);
        parser.nextTag();
        int outerDepth = parser.getDepth();
        while (XmlUtils.nextElementWithin(parser, outerDepth)) {
            if (parser.getName().equals(PARTICIPANT_TAG)) {
                Log.v(LOG_TAG, "Found participant.");
                Bundle participant = parseParticipant(parser);
                conferenceState.mParticipants.put(participant.getString(ImsConferenceState.ENDPOINT), participant);
            }
        }
    } catch (IOException | XmlPullParserException e) {
        Log.e(LOG_TAG, "Failed to read test conference event package from XML file", e);
        return null;
    } finally {
        try {
            mInputStream.close();
        } catch (IOException e) {
            Log.e(LOG_TAG, "Failed to close test conference event package InputStream", e);
            return null;
        }
    }
    return conferenceState;
}
Also used : Bundle(android.os.Bundle) XmlPullParser(org.xmlpull.v1.XmlPullParser) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) IOException(java.io.IOException) ImsConferenceState(android.telephony.ims.ImsConferenceState)

Example 3 with ImsConferenceState

use of android.telephony.ims.ImsConferenceState 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)

Aggregations

ImsConferenceState (android.telephony.ims.ImsConferenceState)3 Bundle (android.os.Bundle)2 PersistableBundle (android.os.PersistableBundle)1 ImsCall (com.android.ims.ImsCall)1 ImsPhone (com.android.internal.telephony.imsphone.ImsPhone)1 ImsPhoneCall (com.android.internal.telephony.imsphone.ImsPhoneCall)1 ImsPhoneCallTracker (com.android.internal.telephony.imsphone.ImsPhoneCallTracker)1 TestConferenceEventPackageParser (com.android.internal.telephony.test.TestConferenceEventPackageParser)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 XmlPullParser (org.xmlpull.v1.XmlPullParser)1 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)1