diff options
| author | Tyler Gunn <tgunn@google.com> | 2019-06-26 14:59:49 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-06-26 14:59:49 +0000 |
| commit | 021796f3584af7dd0e47e084b0598b6709b47548 (patch) | |
| tree | 94f5c76224067f74adbc84ab2e0d1b4b13efec6e | |
| parent | 0517d3d5e5ad0959b861758a4697b52120e41139 (diff) | |
| parent | 7e58c274b8cfd25ebebd218ea91c605ed6c6e12b (diff) | |
| download | platform_packages_services_Telephony-android10-dev.tar.gz platform_packages_services_Telephony-android10-dev.tar.bz2 platform_packages_services_Telephony-android10-dev.zip | |
Merge "Pass call direction for existing connections created in Telephony." into qt-devandroid10-dev
4 files changed, 24 insertions, 68 deletions
diff --git a/src/com/android/services/telephony/ConferenceParticipantConnection.java b/src/com/android/services/telephony/ConferenceParticipantConnection.java index 651ace56b..61dc0391e 100644 --- a/src/com/android/services/telephony/ConferenceParticipantConnection.java +++ b/src/com/android/services/telephony/ConferenceParticipantConnection.java @@ -69,7 +69,8 @@ public class ConferenceParticipantConnection extends Connection { address = null; } else { String countryIso = getCountryIso(parentConnection.getCall().getPhone()); - address = getParticipantAddress(participant.getHandle(), countryIso); + address = ConferenceParticipant.getParticipantAddress(participant.getHandle(), + countryIso); } setAddress(address, presentation); setVideoState(parentConnection.getVideoState()); @@ -165,64 +166,6 @@ public class ConferenceParticipantConnection extends Connection { } } - - - /** - * Attempts to build a tel: style URI from a conference participant. - * Conference event package data contains SIP URIs, so we try to extract the phone number and - * format into a typical tel: style URI. - * - * @param address The conference participant's address. - * @param countryIso The country ISO of the current subscription; used when formatting the - * participant phone number to E.164 format. - * @return The participant's address URI. - */ - @VisibleForTesting - public static Uri getParticipantAddress(Uri address, String countryIso) { - if (address == null) { - return address; - } - // Even if address is already in tel: format, still parse it and rebuild. - // This is to recognize tel URIs such as: - // tel:6505551212;phone-context=ims.mnc012.mcc034.3gppnetwork.org - - // Conference event package participants are identified using SIP URIs (see RFC3261). - // A valid SIP uri has the format: sip:user:password@host:port;uri-parameters?headers - // Per RFC3261, the "user" can be a telephone number. - // For example: sip:1650555121;phone-context=blah.com@host.com - // In this case, the phone number is in the user field of the URI, and the parameters can be - // ignored. - // - // A SIP URI can also specify a phone number in a format similar to: - // sip:+1-212-555-1212@something.com;user=phone - // In this case, the phone number is again in user field and the parameters can be ignored. - // We can get the user field in these instances by splitting the string on the @, ;, or : - // and looking at the first found item. - String number = address.getSchemeSpecificPart(); - if (TextUtils.isEmpty(number)) { - return address; - } - - String numberParts[] = number.split("[@;:]"); - if (numberParts.length == 0) { - return address; - } - number = numberParts[0]; - - // Attempt to format the number in E.164 format and use that as part of the TEL URI. - // RFC2806 recommends to format telephone numbers using E.164 since it is independent of - // how the dialing of said numbers takes place. - // If conversion to E.164 fails, the returned value is null. In that case, fallback to the - // number which was in the CEP data. - String formattedNumber = null; - if (!TextUtils.isEmpty(countryIso)) { - formattedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); - } - - return Uri.fromParts(PhoneAccount.SCHEME_TEL, - formattedNumber != null ? formattedNumber : number, null); - } - /** * Given a {@link Phone} instance, determines the country ISO associated with the phone's * subscription. diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java index 9b664875c..245f2e889 100644 --- a/src/com/android/services/telephony/ImsConference.java +++ b/src/com/android/services/telephony/ImsConference.java @@ -975,6 +975,10 @@ public class ImsConference extends Conference implements Holdable { connection.setConnectTimeMillis(participant.getConnectTime()); connection.setConnectionStartElapsedRealTime(participant.getConnectElapsedTime()); } + // Indicate whether this is an MT or MO call to Telecom; the participant has the cached + // data from the time of merge. + connection.setCallDirection(participant.getCallDirection()); + Log.i(this, "createConferenceParticipantConnection: participant=%s, connection=%s", participant, connection); diff --git a/tests/src/com/android/services/telephony/ConferenceParticipantConnectionTest.java b/tests/src/com/android/services/telephony/ConferenceParticipantConnectionTest.java index f4049453e..4336a20b7 100644 --- a/tests/src/com/android/services/telephony/ConferenceParticipantConnectionTest.java +++ b/tests/src/com/android/services/telephony/ConferenceParticipantConnectionTest.java @@ -16,7 +16,7 @@ package com.android.services.telephony; -import static com.android.services.telephony.ConferenceParticipantConnection.getParticipantAddress; +import static android.telecom.ConferenceParticipant.getParticipantAddress; import static org.junit.Assert.assertEquals; diff --git a/tests/src/com/android/services/telephony/ImsConferenceTest.java b/tests/src/com/android/services/telephony/ImsConferenceTest.java index 8d6797390..68b5b3b87 100644 --- a/tests/src/com/android/services/telephony/ImsConferenceTest.java +++ b/tests/src/com/android/services/telephony/ImsConferenceTest.java @@ -32,6 +32,7 @@ import static org.junit.Assert.assertFalse; import android.net.Uri; import android.os.Looper; +import android.telecom.Call; import android.telecom.Conference; import android.telecom.ConferenceParticipant; import android.telecom.Connection; @@ -85,12 +86,14 @@ public class ImsConferenceTest { Uri.parse("tel:6505551212"), "A", Uri.parse("sip:6505551212@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); ConferenceParticipant participant2 = new ConferenceParticipant( Uri.parse("tel:6505551213"), "A", Uri.parse("sip:6505551213@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); imsConference.handleConferenceParticipantsUpdate(mConferenceHost, Arrays.asList(participant1, participant2)); assertEquals(2, imsConference.getNumberOfParticipants()); @@ -145,12 +148,14 @@ public class ImsConferenceTest { Uri.parse("tel:6505551212"), "A", Uri.parse("sip:6505551212@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); ConferenceParticipant participant2 = new ConferenceParticipant( Uri.parse("tel:6505551213"), "A", Uri.parse("sip:6505551213@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); imsConference.handleConferenceParticipantsUpdate(mConferenceHost, Arrays.asList(participant1, participant2)); assertEquals(2, imsConference.getNumberOfParticipants()); @@ -191,12 +196,14 @@ public class ImsConferenceTest { Uri.parse("tel:6505551212"), "A", Uri.parse("sip:6505551212@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); ConferenceParticipant participant2 = new ConferenceParticipant( Uri.parse("tel:6505551213"), "A", Uri.parse("sip:6505551213@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); imsConference.handleConferenceParticipantsUpdate(mConferenceHost, Arrays.asList(participant1, participant2)); assertEquals(2, imsConference.getNumberOfParticipants()); @@ -226,12 +233,14 @@ public class ImsConferenceTest { Uri.parse("tel:6505551212"), "A", Uri.parse("sip:6505551212@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); ConferenceParticipant participant2 = new ConferenceParticipant( Uri.parse("tel:6505551213"), "A", Uri.parse("sip:6505551213@testims.com"), - Connection.STATE_ACTIVE); + Connection.STATE_ACTIVE, + Call.Details.DIRECTION_INCOMING); imsConference.handleConferenceParticipantsUpdate(mConferenceHost, Arrays.asList(participant1, participant2)); assertEquals(2, imsConference.getNumberOfParticipants()); |
