summaryrefslogtreecommitdiff
path: root/telecomm
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/OWNERS5
-rw-r--r--telecomm/TEST_MAPPING8
-rwxr-xr-xtelecomm/java/android/telecom/Call.java61
-rw-r--r--telecomm/java/android/telecom/CallScreeningService.java57
-rw-r--r--telecomm/java/android/telecom/CallerInfo.java12
-rw-r--r--telecomm/java/android/telecom/CallerInfoAsyncQuery.java4
-rw-r--r--telecomm/java/android/telecom/Conference.java16
-rw-r--r--[-rwxr-xr-x]telecomm/java/android/telecom/Connection.java32
-rw-r--r--telecomm/java/android/telecom/ConnectionRequest.java1
-rwxr-xr-xtelecomm/java/android/telecom/ConnectionService.java53
-rw-r--r--telecomm/java/android/telecom/DisconnectCause.java10
-rwxr-xr-xtelecomm/java/android/telecom/InCallAdapter.java4
-rw-r--r--telecomm/java/android/telecom/Log.java4
-rw-r--r--telecomm/java/android/telecom/PhoneAccount.java32
-rw-r--r--telecomm/java/android/telecom/PhoneAccountSuggestionService.java2
-rw-r--r--telecomm/java/android/telecom/RemoteConference.java24
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java25
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionManager.java31
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java34
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java79
-rw-r--r--telecomm/java/com/android/internal/telecom/ITelecomService.aidl4
21 files changed, 360 insertions, 138 deletions
diff --git a/telecomm/OWNERS b/telecomm/OWNERS
index 673a0a9b558e..9969ee965fbd 100644
--- a/telecomm/OWNERS
+++ b/telecomm/OWNERS
@@ -1,7 +1,8 @@
set noparent
-tgunn@google.com
breadley@google.com
hallliu@google.com
+tgunn@google.com
+xiaotonj@google.com
+shuoq@google.com
rgreenwalt@google.com
-paulye@google.com
diff --git a/telecomm/TEST_MAPPING b/telecomm/TEST_MAPPING
index d58566673eec..c9903f9fa901 100644
--- a/telecomm/TEST_MAPPING
+++ b/telecomm/TEST_MAPPING
@@ -23,6 +23,14 @@
"exclude-annotation": "androidx.test.filters.FlakyTest"
}
]
+ },
+ {
+ "name": "CtsTelecomTestCases",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ }
+ ]
}
]
}
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 3365ab740cde..1238e7b69a87 100755
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -462,15 +462,15 @@ public final class Call {
/**
* Call supports adding participants to the call via
- * {@link #addConferenceParticipants(List)}.
- * @hide
+ * {@link #addConferenceParticipants(List)}. Once participants are added, the call becomes
+ * an adhoc conference call ({@link #PROPERTY_IS_ADHOC_CONFERENCE}).
*/
public static final int CAPABILITY_ADD_PARTICIPANT = 0x02000000;
/**
* When set for a call, indicates that this {@code Call} can be transferred to another
* number.
- * Call supports the blind and assured call transfer feature.
+ * Call supports the confirmed and unconfirmed call transfer feature.
*
* @hide
*/
@@ -599,8 +599,11 @@ public final class Call {
/**
* Indicates that the call is an adhoc conference call. This property can be set for both
- * incoming and outgoing calls.
- * @hide
+ * incoming and outgoing calls. An adhoc conference call is formed using
+ * {@link #addConferenceParticipants(List)},
+ * {@link TelecomManager#addNewIncomingConference(PhoneAccountHandle, Bundle)}, or
+ * {@link TelecomManager#startConference(List, Bundle)}, rather than by merging existing
+ * call using {@link #conference(Call)}.
*/
public static final int PROPERTY_IS_ADHOC_CONFERENCE = 0x00002000;
@@ -963,6 +966,32 @@ public final class Call {
/**
* Gets the verification status for the phone number of an incoming call as identified in
* ATIS-1000082.
+ * <p>
+ * For incoming calls, the number verification status indicates whether the device was
+ * able to verify the authenticity of the calling number using the STIR process outlined
+ * in ATIS-1000082. {@link Connection#VERIFICATION_STATUS_NOT_VERIFIED} indicates that
+ * the network was not able to use STIR to verify the caller's number (i.e. nothing is
+ * known regarding the authenticity of the number.
+ * {@link Connection#VERIFICATION_STATUS_PASSED} indicates that the network was able to
+ * use STIR to verify the caller's number. This indicates that the network has a high
+ * degree of confidence that the incoming call actually originated from the indicated
+ * number. {@link Connection#VERIFICATION_STATUS_FAILED} indicates that the network's
+ * STIR verification did not pass. This indicates that the incoming call may not
+ * actually be from the indicated number. This could occur if, for example, the caller
+ * is using an impersonated phone number.
+ * <p>
+ * A {@link CallScreeningService} can use this information to help determine if an
+ * incoming call is potentially an unwanted call. A verification status of
+ * {@link Connection#VERIFICATION_STATUS_FAILED} indicates that an incoming call may not
+ * actually be from the number indicated on the call (i.e. impersonated number) and that it
+ * should potentially be blocked. Likewise,
+ * {@link Connection#VERIFICATION_STATUS_PASSED} can be used as a positive signal to
+ * help clarify that the incoming call is originating from the indicated number and it
+ * is less likely to be an undesirable call.
+ * <p>
+ * An {@link InCallService} can use this information to provide a visual indicator to the
+ * user regarding the verification status of a call and to help identify calls from
+ * potentially impersonated numbers.
* @return the verification status.
*/
public @Connection.VerificationStatus int getCallerNumberVerificationStatus() {
@@ -1439,8 +1468,11 @@ public final class Call {
/**
* Writes the string {@param input} into the outgoing text stream for this RTT call. Since
- * RTT transmits text in real-time, this method should be called once for each character
- * the user enters into the device.
+ * RTT transmits text in real-time, this method should be called once for each user action.
+ * For example, when the user enters text as discrete characters using the keyboard, this
+ * method should be called once for each character. However, if the user enters text by
+ * pasting or autocomplete, the entire contents of the pasted or autocompleted text should
+ * be sent in one call to this method.
*
* This method is not thread-safe -- calling it from multiple threads simultaneously may
* lead to interleaved text.
@@ -1593,8 +1625,8 @@ public final class Call {
* Instructs this {@code Call} to be transferred to another number.
*
* @param targetNumber The address to which the call will be transferred.
- * @param isConfirmationRequired if {@code true} it will initiate ASSURED transfer,
- * if {@code false}, it will initiate BLIND transfer.
+ * @param isConfirmationRequired if {@code true} it will initiate a confirmed transfer,
+ * if {@code false}, it will initiate an unconfirmed transfer.
*
* @hide
*/
@@ -1654,7 +1686,6 @@ public final class Call {
* @hide
*/
@SystemApi
- @TestApi
public void enterBackgroundAudioProcessing() {
if (mState != STATE_ACTIVE && mState != STATE_RINGING) {
throw new IllegalStateException("Call must be active or ringing");
@@ -1675,7 +1706,6 @@ public final class Call {
* @hide
*/
@SystemApi
- @TestApi
public void exitBackgroundAudioProcessing(boolean shouldRing) {
if (mState != STATE_AUDIO_PROCESSING) {
throw new IllegalStateException("Call must in the audio processing state");
@@ -1775,7 +1805,6 @@ public final class Call {
* See {@link Details#CAPABILITY_ADD_PARTICIPANT}.
*
* @param participants participants to be pulled to existing call.
- * @hide
*/
public void addConferenceParticipants(@NonNull List<Uri> participants) {
mInCallAdapter.addConferenceParticipants(mTelecomCallId, participants);
@@ -2109,7 +2138,13 @@ public final class Call {
/**
* Obtains a list of canned, pre-configured message responses to present to the user as
- * ways of rejecting this {@code Call} using via a text message.
+ * ways of rejecting an incoming {@code Call} using via a text message.
+ * <p>
+ * <em>Note:</em> Since canned responses may be loaded from the file system, they are not
+ * guaranteed to be present when this {@link Call} is first added to the {@link InCallService}
+ * via {@link InCallService#onCallAdded(Call)}. The callback
+ * {@link Call.Callback#onCannedTextResponsesLoaded(Call, List)} will be called when/if canned
+ * responses for the call become available.
*
* @see #reject(boolean, String)
*
diff --git a/telecomm/java/android/telecom/CallScreeningService.java b/telecomm/java/android/telecom/CallScreeningService.java
index 8abab90f775f..7988b036ccd3 100644
--- a/telecomm/java/android/telecom/CallScreeningService.java
+++ b/telecomm/java/android/telecom/CallScreeningService.java
@@ -16,10 +16,11 @@
package android.telecom;
+import android.Manifest;
import android.annotation.NonNull;
+import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
-import android.annotation.TestApi;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
@@ -62,7 +63,7 @@ import com.android.internal.telecom.ICallScreeningService;
* </li>
* </ol>
* <p>
- * <h2>Becoming the {@link CallScreeningService}</h2>
+ * <h2>Becoming the CallScreeningService</h2>
* Telecom will bind to a single app chosen by the user which implements the
* {@link CallScreeningService} API when there are new incoming and outgoing calls.
* <p>
@@ -88,7 +89,27 @@ import com.android.internal.telecom.ICallScreeningService;
* }
* }
* }
+ * }
* </pre>
+ *
+ * <h2>CallScreeningService Lifecycle</h2>
+ *
+ * The framework binds to the {@link CallScreeningService} implemented by the user-chosen app
+ * filling the {@link android.app.role.RoleManager#ROLE_CALL_SCREENING} role when incoming calls are
+ * received (prior to ringing) and when outgoing calls are placed. The platform calls the
+ * {@link #onScreenCall(Call.Details)} method to provide your service with details about the call.
+ * <p>
+ * For incoming calls, the {@link CallScreeningService} must call
+ * {@link #respondToCall(Call.Details, CallResponse)} within 5 seconds of being bound to indicate to
+ * the platform whether the call should be blocked or not. Your app must do this even if it is
+ * primarily performing caller ID operations and not screening calls. It is important to perform
+ * screening operations in a timely matter as the user's device will not begin ringing until the
+ * response is received (or the timeout is hit). A {@link CallScreeningService} may choose to
+ * perform local database lookups to help determine if a call should be screened or not; care should
+ * be taken to ensure the timeout is not repeatedly hit, causing delays in the incoming call flow.
+ * <p>
+ * If your app provides a caller ID experience, it should launch an activity to show the caller ID
+ * information from {@link #onScreenCall(Call.Details)}.
*/
public abstract class CallScreeningService extends Service {
/**
@@ -301,7 +322,7 @@ public abstract class CallScreeningService extends Service {
* @hide
*/
@SystemApi
- @TestApi
+ @RequiresPermission(Manifest.permission.CAPTURE_AUDIO_OUTPUT)
public @NonNull Builder setShouldScreenCallViaAudioProcessing(
boolean shouldScreenCallViaAudioProcessing) {
mShouldScreenCallViaAudioProcessing = shouldScreenCallViaAudioProcessing;
@@ -336,7 +357,7 @@ public abstract class CallScreeningService extends Service {
}
/**
- * Called when a new incoming or outgoing call is added which is not in the user's contact list.
+ * Called when a new incoming or outgoing call is added.
* <p>
* A {@link CallScreeningService} must indicate whether an incoming call is allowed or not by
* calling
@@ -344,21 +365,32 @@ public abstract class CallScreeningService extends Service {
* Your app can tell if a call is an incoming call by checking to see if
* {@link Call.Details#getCallDirection()} is {@link Call.Details#DIRECTION_INCOMING}.
* <p>
- * Note: The {@link Call.Details} instance provided to a call screening service will only have
- * the following properties set. The rest of the {@link Call.Details} properties will be set to
- * their default value or {@code null}.
+ * <em>Note:</em> A {@link CallScreeningService} must respond to a call within 5 seconds. After
+ * this time, the framework will unbind from the {@link CallScreeningService} and ignore its
+ * response.
+ * <p>
+ * <em>Note:</em> The {@link Call.Details} instance provided to a call screening service will
+ * only have the following properties set. The rest of the {@link Call.Details} properties will
+ * be set to their default value or {@code null}.
* <ul>
* <li>{@link Call.Details#getCallDirection()}</li>
+ * <li>{@link Call.Details#getCallerNumberVerificationStatus()}</li>
* <li>{@link Call.Details#getConnectTimeMillis()}</li>
* <li>{@link Call.Details#getCreationTimeMillis()}</li>
* <li>{@link Call.Details#getHandle()}</li>
- * <li>{@link Call.Details#getHandlePresentation()}</li>
* </ul>
* <p>
* Only calls where the {@link Call.Details#getHandle() handle} {@link Uri#getScheme() scheme}
* is {@link PhoneAccount#SCHEME_TEL} are passed for call
* screening. Further, only calls which are not in the user's contacts are passed for
- * screening. For outgoing calls, no post-dial digits are passed.
+ * screening, unless the {@link CallScreeningService} has been granted
+ * {@link Manifest.permission#READ_CONTACTS} permission by the user. For outgoing calls, no
+ * post-dial digits are passed.
+ * <p>
+ * Calls with a {@link Call.Details#getHandlePresentation()} of
+ * {@link TelecomManager#PRESENTATION_RESTRICTED}, {@link TelecomManager#PRESENTATION_UNKNOWN}
+ * or {@link TelecomManager#PRESENTATION_PAYPHONE} presentation are not provided to the
+ * {@link CallScreeningService}.
*
* @param callDetails Information about a new call, see {@link Call.Details}.
*/
@@ -373,6 +405,13 @@ public abstract class CallScreeningService extends Service {
* <p>
* Calls to this method are ignored unless the {@link Call.Details#getCallDirection()} is
* {@link Call.Details#DIRECTION_INCOMING}.
+ * <p>
+ * For incoming calls, a {@link CallScreeningService} MUST call this method within 5 seconds of
+ * {@link #onScreenCall(Call.Details)} being invoked by the platform.
+ * <p>
+ * Calls which are blocked/rejected will be logged to the system call log with a call type of
+ * {@link android.provider.CallLog.Calls#BLOCKED_TYPE} and
+ * {@link android.provider.CallLog.Calls#BLOCK_REASON_CALL_SCREENING_SERVICE} block reason.
*
* @param callDetails The call to allow.
* <p>
diff --git a/telecomm/java/android/telecom/CallerInfo.java b/telecomm/java/android/telecom/CallerInfo.java
index fb6f99405759..2983e6339d4b 100644
--- a/telecomm/java/android/telecom/CallerInfo.java
+++ b/telecomm/java/android/telecom/CallerInfo.java
@@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable;
import android.location.Country;
import android.location.CountryDetector;
import android.net.Uri;
+import android.os.Build;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
@@ -186,7 +187,7 @@ public class CallerInfo {
private boolean mIsVoiceMail;
/** @hide */
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public CallerInfo() {
// TODO: Move all the basic initialization here?
mIsEmergency = false;
@@ -347,7 +348,7 @@ public class CallerInfo {
*
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static CallerInfo getCallerInfo(Context context, Uri contactRef) {
CallerInfo info = null;
ContentResolver cr = CallerInfoAsyncQuery.getCurrentProfileContentResolver(context);
@@ -374,7 +375,7 @@ public class CallerInfo {
*
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static CallerInfo getCallerInfo(Context context, String number) {
if (VDBG) Log.v(TAG, "getCallerInfo() based on number...");
@@ -395,7 +396,7 @@ public class CallerInfo {
*
* @hide
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static CallerInfo getCallerInfo(Context context, String number, int subId) {
if (TextUtils.isEmpty(number)) {
@@ -405,7 +406,8 @@ public class CallerInfo {
// Change the callerInfo number ONLY if it is an emergency number
// or if it is the voicemail number. If it is either, take a
// shortcut and skip the query.
- if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
+ TelephonyManager tm = context.getSystemService(TelephonyManager.class);
+ if (tm.isEmergencyNumber(number)) {
return new CallerInfo().markAsEmergency(context);
} else if (PhoneNumberUtils.isVoiceMailNumber(null, subId, number)) {
return new CallerInfo().markAsVoiceMail(context, subId);
diff --git a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
index 4a81a8eea5cf..a9e1a8fc1952 100644
--- a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
+++ b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
@@ -34,6 +34,7 @@ import android.os.UserManager;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.util.ArrayList;
@@ -481,7 +482,8 @@ public class CallerInfoAsyncQuery {
cw.subId = subId;
// check to see if these are recognized numbers, and use shortcuts if we can.
- if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
+ TelephonyManager tm = context.getSystemService(TelephonyManager.class);
+ if (tm.isEmergencyNumber(number)) {
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (PhoneNumberUtils.isVoiceMailNumber(context, subId, number)) {
cw.event = EVENT_VOICEMAIL_NUMBER;
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index d9605522b3b0..dc2fb948fdbe 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -24,7 +24,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
-import android.annotation.TestApi;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -137,7 +136,6 @@ public abstract class Conference extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final @NonNull String getTelecomCallId() {
return mTelecomCallId;
}
@@ -181,8 +179,8 @@ public abstract class Conference extends Conferenceable {
/**
* Returns whether this conference is requesting that the system play a ringback tone
- * on its behalf.
- * @hide
+ * on its behalf. A ringback tone may be played when an outgoing conference is in the process of
+ * connecting to give the user an audible indication of that process.
*/
public final boolean isRingbackRequested() {
return mRingbackRequested;
@@ -329,7 +327,6 @@ public abstract class Conference extends Conferenceable {
/**
* Notifies the {@link Conference} of a request to add a new participants to the conference call
* @param participants that will be added to this conference call
- * @hide
*/
public void onAddConferenceParticipants(@NonNull List<Uri> participants) {}
@@ -340,7 +337,6 @@ public abstract class Conference extends Conferenceable {
* the default dialer's {@link InCallService}.
*
* @param videoState The video state in which to answer the connection.
- * @hide
*/
public void onAnswer(int videoState) {}
@@ -360,7 +356,6 @@ public abstract class Conference extends Conferenceable {
* a request to reject.
* For managed {@link ConnectionService}s, this will be called when the user rejects a call via
* the default dialer's {@link InCallService}.
- * @hide
*/
public void onReject() {}
@@ -380,7 +375,6 @@ public abstract class Conference extends Conferenceable {
/**
* Sets state to be ringing.
- * @hide
*/
public final void setRinging() {
setState(Connection.STATE_RINGING);
@@ -506,7 +500,6 @@ public abstract class Conference extends Conferenceable {
* that do not play a ringback tone themselves in the conference's audio stream.
*
* @param ringback Whether the ringback tone is to be played.
- * @hide
*/
public final void setRingbackRequested(boolean ringback) {
if (mRingbackRequested != ringback) {
@@ -614,7 +607,6 @@ public abstract class Conference extends Conferenceable {
* @return The primary connection.
* @hide
*/
- @TestApi
@SystemApi
public Connection getPrimaryConnection() {
if (mUnmodifiableChildConnections == null || mUnmodifiableChildConnections.isEmpty()) {
@@ -773,7 +765,6 @@ public abstract class Conference extends Conferenceable {
*
* @param disconnectCause The disconnect cause, ({@see android.telecomm.DisconnectCause}).
* @return A {@code Conference} which indicates failure.
- * @hide
*/
public @NonNull static Conference createFailedConference(
@NonNull DisconnectCause disconnectCause, @NonNull PhoneAccountHandle phoneAccount) {
@@ -1018,7 +1009,6 @@ public abstract class Conference extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(MODIFY_PHONE_STATE)
public void setConferenceState(boolean isConference) {
mIsMultiparty = isConference;
@@ -1073,7 +1063,6 @@ public abstract class Conference extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(MODIFY_PHONE_STATE)
public final void setAddress(@NonNull Uri address,
@TelecomManager.Presentation int presentation) {
@@ -1161,7 +1150,6 @@ public abstract class Conference extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final void setCallerDisplayName(@NonNull String callerDisplayName,
@TelecomManager.Presentation int presentation) {
Log.d(this, "setCallerDisplayName %s", callerDisplayName);
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index fa9909547fc4..bbf34df8fe84 100755..100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -25,7 +25,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
-import android.annotation.TestApi;
import android.app.Notification;
import android.bluetooth.BluetoothDevice;
import android.compat.annotation.UnsupportedAppUsage;
@@ -307,7 +306,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000;
/**
@@ -345,7 +343,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 0x00200000;
/**
@@ -383,15 +380,17 @@ public abstract class Connection extends Conferenceable {
/**
* When set, indicates that this {@link Connection} supports initiation of a conference call
- * by directly adding participants using {@link #onAddConferenceParticipants(List)}.
- * @hide
+ * by directly adding participants using {@link #onAddConferenceParticipants(List)}. When
+ * participants are added to a {@link Connection}, it will be replaced by a {@link Conference}
+ * instance with {@link #PROPERTY_IS_ADHOC_CONFERENCE} set to indicate that it is an adhoc
+ * conference call.
*/
public static final int CAPABILITY_ADD_PARTICIPANT = 0x04000000;
/**
* Indicates that this {@code Connection} can be transferred to another
* number.
- * Connection supports the blind and assured call transfer feature.
+ * Connection supports the confirmed and unconfirmed call transfer feature.
* @hide
*/
public static final int CAPABILITY_TRANSFER = 0x08000000;
@@ -415,7 +414,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1<<0;
/**
@@ -426,7 +424,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int PROPERTY_GENERIC_CONFERENCE = 1<<1;
/**
@@ -478,7 +475,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6;
/**
@@ -522,14 +518,12 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final int PROPERTY_REMOTELY_HOSTED = 1 << 11;
/**
- * Set by the framework to indicate that it is an adhoc conference call.
+ * Set by the framework to indicate that a call is an adhoc conference call.
* <p>
- * This is used for Outgoing and incoming conference calls.
- * @hide
+ * This is used for outgoing and incoming conference calls.
*/
public static final int PROPERTY_IS_ADHOC_CONFERENCE = 1 << 12;
@@ -701,7 +695,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public static final String EXTRA_DISABLE_ADD_CALL =
"android.telecom.extra.DISABLE_ADD_CALL";
@@ -2053,7 +2046,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final @Nullable String getTelecomCallId() {
return mTelecomCallId;
}
@@ -2170,7 +2162,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final @IntRange(from = 0) long getConnectTimeMillis() {
return mConnectTimeMillis;
}
@@ -2195,7 +2186,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final @ElapsedRealtimeLong long getConnectionStartElapsedRealtimeMillis() {
return mConnectElapsedTimeMillis;
}
@@ -2278,7 +2268,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public void setTelecomCallId(@NonNull String callId) {
mTelecomCallId = callId;
}
@@ -2627,7 +2616,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(MODIFY_PHONE_STATE)
public final void setConnectTimeMillis(@IntRange(from = 0) long connectTimeMillis) {
mConnectTimeMillis = connectTimeMillis;
@@ -2650,7 +2638,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(MODIFY_PHONE_STATE)
public final void setConnectionStartElapsedRealtimeMillis(
@ElapsedRealtimeLong long connectElapsedTimeMillis) {
@@ -2721,7 +2708,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public final void resetConnectionTime() {
for (Listener l : mListeners) {
l.onConnectionTimeReset(this);
@@ -3034,7 +3020,6 @@ public abstract class Connection extends Conferenceable {
* Supports initiation of a conference call by directly adding participants to an ongoing call.
*
* @param participants with which conference call will be formed.
- * @hide
*/
public void onAddConferenceParticipants(@NonNull List<Uri> participants) {}
@@ -3505,7 +3490,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public void setPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) {
if (mPhoneAccountHandle != phoneAccountHandle) {
mPhoneAccountHandle = phoneAccountHandle;
@@ -3524,7 +3508,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public @Nullable PhoneAccountHandle getPhoneAccountHandle() {
return mPhoneAccountHandle;
}
@@ -3590,7 +3573,6 @@ public abstract class Connection extends Conferenceable {
* @hide
*/
@SystemApi
- @TestApi
public void setCallDirection(@Call.Details.CallDirection int callDirection) {
mCallDirection = callDirection;
}
diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java
index 6d7ceca0a2cd..b73ef9b794e4 100644
--- a/telecomm/java/android/telecom/ConnectionRequest.java
+++ b/telecomm/java/android/telecom/ConnectionRequest.java
@@ -327,7 +327,6 @@ public final class ConnectionRequest implements Parcelable {
* @hide
*/
@SystemApi
- @TestApi
public @Nullable String getTelecomCallId() {
return mTelecomCallId;
}
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 56cba1d3f913..6288bc1698e9 100755
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -1880,6 +1880,7 @@ public abstract class ConnectionService extends Service {
mConferenceById.put(callId, conference);
mIdByConference.put(conference, callId);
+
conference.addListener(mConferenceListener);
ParcelableConference parcelableConference = new ParcelableConference.Builder(
request.getAccountHandle(), conference.getState())
@@ -2487,6 +2488,42 @@ public abstract class ConnectionService extends Service {
}
/**
+ * Ask some other {@code ConnectionService} to create a {@code RemoteConference} given an
+ * incoming request. This is used by {@code ConnectionService}s that are registered with
+ * {@link PhoneAccount#CAPABILITY_ADHOC_CONFERENCE_CALLING}.
+ *
+ * @param connectionManagerPhoneAccount See description at
+ * {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
+ * @param request Details about the incoming conference call.
+ * @return The {@code RemoteConference} object to satisfy this call, or {@code null} to not
+ * handle the call.
+ */
+ public final @Nullable RemoteConference createRemoteIncomingConference(
+ @Nullable PhoneAccountHandle connectionManagerPhoneAccount,
+ @Nullable ConnectionRequest request) {
+ return mRemoteConnectionManager.createRemoteConference(connectionManagerPhoneAccount,
+ request, true);
+ }
+
+ /**
+ * Ask some other {@code ConnectionService} to create a {@code RemoteConference} given an
+ * outgoing request. This is used by {@code ConnectionService}s that are registered with
+ * {@link PhoneAccount#CAPABILITY_ADHOC_CONFERENCE_CALLING}.
+ *
+ * @param connectionManagerPhoneAccount See description at
+ * {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
+ * @param request Details about the outgoing conference call.
+ * @return The {@code RemoteConference} object to satisfy this call, or {@code null} to not
+ * handle the call.
+ */
+ public final @Nullable RemoteConference createRemoteOutgoingConference(
+ @Nullable PhoneAccountHandle connectionManagerPhoneAccount,
+ @Nullable ConnectionRequest request) {
+ return mRemoteConnectionManager.createRemoteConference(connectionManagerPhoneAccount,
+ request, false);
+ }
+
+ /**
* Indicates to the relevant {@code RemoteConnectionService} that the specified
* {@link RemoteConnection}s should be merged into a conference call.
* <p>
@@ -2678,15 +2715,15 @@ public abstract class ConnectionService extends Service {
return null;
}
/**
- * Create a {@code Connection} given an incoming request. This is used to attach to existing
- * incoming conference call.
+ * Create a {@code Conference} given an incoming request. This is used to attach to an incoming
+ * conference call initiated via
+ * {@link TelecomManager#addNewIncomingConference(PhoneAccountHandle, Bundle)}.
*
* @param connectionManagerPhoneAccount See description at
* {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
- * @param request Details about the incoming call.
- * @return The {@code Connection} object to satisfy this call, or {@code null} to
+ * @param request Details about the incoming conference call.
+ * @return The {@code Conference} object to satisfy this call, or {@code null} to
* not handle the call.
- * @hide
*/
public @Nullable Conference onCreateIncomingConference(
@Nullable PhoneAccountHandle connectionManagerPhoneAccount,
@@ -2771,7 +2808,6 @@ public abstract class ConnectionService extends Service {
* @param connectionManagerPhoneAccount See description at
* {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
* @param request The incoming connection request.
- * @hide
*/
public void onCreateIncomingConferenceFailed(
@Nullable PhoneAccountHandle connectionManagerPhoneAccount,
@@ -2792,7 +2828,6 @@ public abstract class ConnectionService extends Service {
* @param connectionManagerPhoneAccount See description at
* {@link #onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
* @param request The outgoing connection request.
- * @hide
*/
public void onCreateOutgoingConferenceFailed(
@Nullable PhoneAccountHandle connectionManagerPhoneAccount,
@@ -2841,7 +2876,8 @@ public abstract class ConnectionService extends Service {
/**
* Create a {@code Conference} given an outgoing request. This is used to initiate new
- * outgoing conference call.
+ * outgoing conference call requested via
+ * {@link TelecomManager#startConference(List, Bundle)}.
*
* @param connectionManagerPhoneAccount The connection manager account to use for managing
* this call.
@@ -2861,7 +2897,6 @@ public abstract class ConnectionService extends Service {
* @param request Details about the outgoing call.
* @return The {@code Conference} object to satisfy this call, or the result of an invocation
* of {@link Connection#createFailedConnection(DisconnectCause)} to not handle the call.
- * @hide
*/
public @Nullable Conference onCreateOutgoingConference(
@Nullable PhoneAccountHandle connectionManagerPhoneAccount,
diff --git a/telecomm/java/android/telecom/DisconnectCause.java b/telecomm/java/android/telecom/DisconnectCause.java
index bebbbd01fd88..1472a4ac27bc 100644
--- a/telecomm/java/android/telecom/DisconnectCause.java
+++ b/telecomm/java/android/telecom/DisconnectCause.java
@@ -80,20 +80,22 @@ public final class DisconnectCause implements Parcelable {
* Reason code (returned via {@link #getReason()}) which indicates that a call could not be
* completed because the cellular radio is off or out of service, the device is connected to
* a wifi network, but the user has not enabled wifi calling.
- * @hide
*/
public static final String REASON_WIFI_ON_BUT_WFC_OFF = "REASON_WIFI_ON_BUT_WFC_OFF";
/**
* Reason code (returned via {@link #getReason()}), which indicates that the video telephony
* call was disconnected because IMS access is blocked.
- * @hide
*/
public static final String REASON_IMS_ACCESS_BLOCKED = "REASON_IMS_ACCESS_BLOCKED";
/**
- * Reason code, which indicates that the conference call is simulating single party conference.
- * @hide
+ * Reason code (returned via {@link #getReason()}), which indicates that the connection service
+ * is setting the call's state to {@link Call#STATE_DISCONNECTED} because it is internally
+ * changing the representation of an IMS conference call to simulate a single-party call.
+ *
+ * This reason code is only used for communication between a {@link ConnectionService} and
+ * Telecom and should not be surfaced to the user.
*/
public static final String REASON_EMULATING_SINGLE_CALL = "EMULATING_SINGLE_CALL";
diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java
index dd6c15311651..ab35affe9099 100755
--- a/telecomm/java/android/telecom/InCallAdapter.java
+++ b/telecomm/java/android/telecom/InCallAdapter.java
@@ -107,8 +107,8 @@ public final class InCallAdapter {
*
* @param callId The identifier of the call to transfer.
* @param targetNumber The address to transfer to.
- * @param isConfirmationRequired if {@code true} it will initiate ASSURED transfer,
- * if {@code false}, it will initiate BLIND transfer.
+ * @param isConfirmationRequired if {@code true} it will initiate a confirmed transfer,
+ * if {@code false}, it will initiate unconfirmed transfer.
*/
public void transferCall(@NonNull String callId, @NonNull Uri targetNumber,
boolean isConfirmationRequired) {
diff --git a/telecomm/java/android/telecom/Log.java b/telecomm/java/android/telecom/Log.java
index a90d0532b721..2a4fdcb1475d 100644
--- a/telecomm/java/android/telecom/Log.java
+++ b/telecomm/java/android/telecom/Log.java
@@ -102,7 +102,7 @@ public class Log {
}
}
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static void i(String prefix, String format, Object... args) {
if (INFO) {
android.util.Slog.i(TAG, buildMessage(prefix, format, args));
@@ -133,7 +133,7 @@ public class Log {
}
}
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static void w(String prefix, String format, Object... args) {
if (WARN) {
android.util.Slog.w(TAG, buildMessage(prefix, format, args));
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 768c8eebf067..5024ae27ee49 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -21,13 +21,13 @@ import static android.Manifest.permission.MODIFY_PHONE_STATE;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
-import android.annotation.TestApi;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.util.ArrayList;
@@ -48,11 +48,23 @@ import java.util.Objects;
public final class PhoneAccount implements Parcelable {
/**
- * {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which determines the
- * sort order for {@link PhoneAccount}s from the same
- * {@link android.telecom.ConnectionService}.
+ * Integer extra which determines the order in which {@link PhoneAccount}s are sorted
+ *
+ * This is an extras key set via {@link Builder#setExtras} which determines the order in which
+ * {@link PhoneAccount}s from the same {@link ConnectionService} are sorted. The accounts
+ * are sorted in ascending order by this key, and this ordering is used to
+ * determine priority when a call can be placed via multiple accounts.
+ *
+ * When multiple {@link PhoneAccount}s are supplied with the same sort order key, no ordering is
+ * guaranteed between those {@link PhoneAccount}s. Additionally, no ordering is guaranteed
+ * between {@link PhoneAccount}s that do not supply this extra, and all such accounts
+ * will be sorted after the accounts that do supply this extra.
+ *
+ * An example of a sort order key is slot index (see {@link TelephonyManager#getSlotIndex()}),
+ * which is the one used by the cell Telephony stack.
* @hide
*/
+ @SystemApi
public static final String EXTRA_SORT_ORDER =
"android.telecom.extra.SORT_ORDER";
@@ -85,8 +97,7 @@ public final class PhoneAccount implements Parcelable {
/**
* Boolean {@link PhoneAccount} extras key (see {@link PhoneAccount#getExtras()}) which
* indicates that all calls from this {@link PhoneAccount} should be treated as VoIP calls
- * rather than cellular calls.
- * @hide
+ * rather than cellular calls by the Telecom audio handling logic.
*/
public static final String EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE =
"android.telecom.extra.ALWAYS_USE_VOIP_AUDIO_MODE";
@@ -160,6 +171,7 @@ public final class PhoneAccount implements Parcelable {
* in progress.
* @hide
*/
+ @SystemApi
public static final String EXTRA_PLAY_CALL_RECORDING_TONE =
"android.telecom.extra.PLAY_CALL_RECORDING_TONE";
@@ -254,6 +266,7 @@ public final class PhoneAccount implements Parcelable {
* See {@link #getCapabilities}
* @hide
*/
+ @SystemApi
public static final int CAPABILITY_EMERGENCY_CALLS_ONLY = 0x80;
/**
@@ -277,6 +290,7 @@ public final class PhoneAccount implements Parcelable {
* convert all outgoing video calls to emergency numbers to audio-only.
* @hide
*/
+ @SystemApi
public static final int CAPABILITY_EMERGENCY_VIDEO_CALLING = 0x200;
/**
@@ -323,9 +337,9 @@ public final class PhoneAccount implements Parcelable {
/**
* Flag indicating that this {@link PhoneAccount} is the preferred SIM subscription for
- * emergency calls. A {@link PhoneAccount} that sets this capabilitiy must also
+ * emergency calls. A {@link PhoneAccount} that sets this capability must also
* set the {@link #CAPABILITY_SIM_SUBSCRIPTION} and {@link #CAPABILITY_PLACE_EMERGENCY_CALLS}
- * capabilities. There should only be one emergency preferred {@link PhoneAccount}.
+ * capabilities. There must only be one emergency preferred {@link PhoneAccount} on the device.
* <p>
* When set, Telecom will prefer this {@link PhoneAccount} over others for emergency calling,
* even if the emergency call was placed with a specific {@link PhoneAccount} set using the
@@ -334,6 +348,7 @@ public final class PhoneAccount implements Parcelable {
*
* @hide
*/
+ @SystemApi
public static final int CAPABILITY_EMERGENCY_PREFERRED = 0x2000;
/**
@@ -619,7 +634,6 @@ public final class PhoneAccount implements Parcelable {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(MODIFY_PHONE_STATE)
public @NonNull Builder setGroupId(@NonNull String groupId) {
if (groupId != null) {
diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestionService.java b/telecomm/java/android/telecom/PhoneAccountSuggestionService.java
index ba3822cb9951..8a91b9e9ee81 100644
--- a/telecomm/java/android/telecom/PhoneAccountSuggestionService.java
+++ b/telecomm/java/android/telecom/PhoneAccountSuggestionService.java
@@ -19,7 +19,6 @@ package android.telecom;
import android.annotation.NonNull;
import android.annotation.SdkConstant;
import android.annotation.SystemApi;
-import android.annotation.TestApi;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
@@ -57,7 +56,6 @@ import java.util.Map;
* @hide
*/
@SystemApi
-@TestApi
public class PhoneAccountSuggestionService extends Service {
/**
* The {@link Intent} that must be declared in the {@code intent-filter} element of the
diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java
index 502b7c01b0c0..e024e6186519 100644
--- a/telecomm/java/android/telecom/RemoteConference.java
+++ b/telecomm/java/android/telecom/RemoteConference.java
@@ -16,14 +16,14 @@
package android.telecom;
-import com.android.internal.telecom.IConnectionService;
-
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
+import com.android.internal.telecom.IConnectionService;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -155,6 +155,14 @@ public final class RemoteConference {
}
/** @hide */
+ RemoteConference(DisconnectCause disconnectCause) {
+ mId = "NULL";
+ mConnectionService = null;
+ mState = Connection.STATE_DISCONNECTED;
+ mDisconnectCause = disconnectCause;
+ }
+
+ /** @hide */
String getId() {
return mId;
}
@@ -583,4 +591,16 @@ public final class RemoteConference {
}
}
}
+
+ /**
+ * Create a {@link RemoteConference} represents a failure, and which will
+ * be in {@link Connection#STATE_DISCONNECTED}.
+ *
+ * @param disconnectCause The disconnect cause.
+ * @return a failed {@link RemoteConference}
+ * @hide
+ */
+ public static RemoteConference failure(DisconnectCause disconnectCause) {
+ return new RemoteConference(disconnectCause);
+ }
}
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index df3362578680..52210a55c8d0 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -16,10 +16,6 @@
package android.telecom;
-import com.android.internal.telecom.IConnectionService;
-import com.android.internal.telecom.IVideoCallback;
-import com.android.internal.telecom.IVideoProvider;
-
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
@@ -33,6 +29,10 @@ import android.os.RemoteException;
import android.telecom.Logging.Session;
import android.view.Surface;
+import com.android.internal.telecom.IConnectionService;
+import com.android.internal.telecom.IVideoCallback;
+import com.android.internal.telecom.IVideoProvider;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -1114,6 +1114,23 @@ public final class RemoteConnection {
}
/**
+ * Instructs this {@link RemoteConnection} to initiate a conference with a list of
+ * participants.
+ * <p>
+ *
+ * @param participants with which conference call will be formed.
+ */
+ public void addConferenceParticipants(@NonNull List<Uri> participants) {
+ try {
+ if (mConnected) {
+ mConnectionService.addConferenceParticipants(mConnectionId, participants,
+ null /*Session.Info*/);
+ }
+ } catch (RemoteException ignored) {
+ }
+ }
+
+ /**
* Set the audio state of this {@code RemoteConnection}.
*
* @param state The audio state of this {@code RemoteConnection}.
diff --git a/telecomm/java/android/telecom/RemoteConnectionManager.java b/telecomm/java/android/telecom/RemoteConnectionManager.java
index 0322218d75dc..f3c7bd83ed4b 100644
--- a/telecomm/java/android/telecom/RemoteConnectionManager.java
+++ b/telecomm/java/android/telecom/RemoteConnectionManager.java
@@ -73,6 +73,37 @@ public class RemoteConnectionManager {
return null;
}
+ /**
+ * Ask a {@code RemoteConnectionService} to create a {@code RemoteConference}.
+ * @param connectionManagerPhoneAccount See description at
+ * {@link ConnectionService#onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}.
+ * @param request Details about the incoming conference call.
+ * @param isIncoming {@code true} if it's an incoming conference.
+ * @return
+ */
+ public RemoteConference createRemoteConference(
+ PhoneAccountHandle connectionManagerPhoneAccount,
+ ConnectionRequest request,
+ boolean isIncoming) {
+ PhoneAccountHandle accountHandle = request.getAccountHandle();
+ if (accountHandle == null) {
+ throw new IllegalArgumentException("accountHandle must be specified.");
+ }
+
+ ComponentName componentName = request.getAccountHandle().getComponentName();
+ if (!mRemoteConnectionServices.containsKey(componentName)) {
+ throw new UnsupportedOperationException("accountHandle not supported: "
+ + componentName);
+ }
+
+ RemoteConnectionService remoteService = mRemoteConnectionServices.get(componentName);
+ if (remoteService != null) {
+ return remoteService.createRemoteConference(
+ connectionManagerPhoneAccount, request, isIncoming);
+ }
+ return null;
+ }
+
public void conferenceRemoteConnections(RemoteConnection a, RemoteConnection b) {
if (a.getConnectionService() == b.getConnectionService()) {
try {
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index a0833011715d..bf6a6ef793ff 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -31,9 +31,9 @@ import com.android.internal.telecom.RemoteServiceCallback;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.List;
import java.util.UUID;
/**
@@ -591,6 +591,38 @@ final class RemoteConnectionService {
}
}
+ RemoteConference createRemoteConference(
+ PhoneAccountHandle connectionManagerPhoneAccount,
+ ConnectionRequest request,
+ boolean isIncoming) {
+ final String id = UUID.randomUUID().toString();
+ try {
+ if (mConferenceById.isEmpty()) {
+ mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub(),
+ null /*Session.Info*/);
+ }
+ RemoteConference conference = new RemoteConference(id, mOutgoingConnectionServiceRpc);
+ mOutgoingConnectionServiceRpc.createConference(connectionManagerPhoneAccount,
+ id,
+ request,
+ isIncoming,
+ false /* isUnknownCall */,
+ null /*Session.info*/);
+ conference.registerCallback(new RemoteConference.Callback() {
+ @Override
+ public void onDestroyed(RemoteConference conference) {
+ mConferenceById.remove(id);
+ maybeDisconnectAdapter();
+ }
+ });
+ conference.putExtras(request.getExtras());
+ return conference;
+ } catch (RemoteException e) {
+ return RemoteConference.failure(
+ new DisconnectCause(DisconnectCause.ERROR, e.toString()));
+ }
+ }
+
private boolean hasConnection(String callId) {
return mConnectionById.containsKey(callId);
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 7bd5bdfaebc6..86441e78254f 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -25,7 +25,6 @@ import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
-import android.annotation.TestApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
@@ -322,6 +321,7 @@ public class TelecomManager {
* the remote handle of the new call.
* @hide
*/
+ @SystemApi
public static final String EXTRA_UNKNOWN_CALL_HANDLE =
"android.telecom.extra.UNKNOWN_CALL_HANDLE";
@@ -400,6 +400,7 @@ public class TelecomManager {
* </ul>
* @hide
*/
+ @SystemApi
public static final String EXTRA_CALL_TECHNOLOGY_TYPE =
"android.telecom.extra.CALL_TECHNOLOGY_TYPE";
@@ -699,7 +700,6 @@ public class TelecomManager {
*
* @hide
*/
- @TestApi
@SystemApi
public static final int TTY_MODE_OFF = 0;
@@ -709,7 +709,6 @@ public class TelecomManager {
*
* @hide
*/
- @TestApi
@SystemApi
public static final int TTY_MODE_FULL = 1;
@@ -720,7 +719,6 @@ public class TelecomManager {
*
* @hide
*/
- @TestApi
@SystemApi
public static final int TTY_MODE_HCO = 2;
@@ -731,22 +729,25 @@ public class TelecomManager {
*
* @hide
*/
- @TestApi
@SystemApi
public static final int TTY_MODE_VCO = 3;
/**
- * Broadcast intent action indicating that the current TTY mode has changed. An intent extra
- * provides this state as an int.
+ * Broadcast intent action indicating that the current TTY mode has changed.
*
- * @see #EXTRA_CURRENT_TTY_MODE
+ * This intent will contain {@link #EXTRA_CURRENT_TTY_MODE} as an intent extra, giving the new
+ * TTY mode.
* @hide
*/
+ @SystemApi
public static final String ACTION_CURRENT_TTY_MODE_CHANGED =
"android.telecom.action.CURRENT_TTY_MODE_CHANGED";
/**
- * The lookup key for an int that indicates the current TTY mode.
+ * Integer extra key that indicates the current TTY mode.
+ *
+ * Used with {@link #ACTION_CURRENT_TTY_MODE_CHANGED}.
+ *
* Valid modes are:
* <ul>
* <li>{@link #TTY_MODE_OFF}</li>
@@ -754,28 +755,42 @@ public class TelecomManager {
* <li>{@link #TTY_MODE_HCO}</li>
* <li>{@link #TTY_MODE_VCO}</li>
* </ul>
+ *
+ * This TTY mode is distinct from the one sent via {@link #ACTION_TTY_PREFERRED_MODE_CHANGED},
+ * since the current TTY mode will always be {@link #TTY_MODE_OFF}unless a TTY terminal is
+ * plugged into the device.
* @hide
*/
+ @SystemApi
public static final String EXTRA_CURRENT_TTY_MODE =
"android.telecom.extra.CURRENT_TTY_MODE";
/**
- * Broadcast intent action indicating that the TTY preferred operating mode has changed. An
- * intent extra provides the new mode as an int.
+ * Broadcast intent action indicating that the TTY preferred operating mode has changed.
*
- * @see #EXTRA_TTY_PREFERRED_MODE
+ * This intent will contain {@link #EXTRA_TTY_PREFERRED_MODE} as an intent extra, giving the new
+ * preferred TTY mode.
* @hide
*/
+ @SystemApi
public static final String ACTION_TTY_PREFERRED_MODE_CHANGED =
"android.telecom.action.TTY_PREFERRED_MODE_CHANGED";
/**
- * The lookup key for an int that indicates preferred TTY mode. Valid modes are: -
- * {@link #TTY_MODE_OFF} - {@link #TTY_MODE_FULL} - {@link #TTY_MODE_HCO} -
- * {@link #TTY_MODE_VCO}
+ * Integer extra key that indicates the preferred TTY mode.
+ *
+ * Used with {@link #ACTION_TTY_PREFERRED_MODE_CHANGED}.
*
+ * Valid modes are:
+ * <ul>
+ * <li>{@link #TTY_MODE_OFF}</li>
+ * <li>{@link #TTY_MODE_FULL}</li>
+ * <li>{@link #TTY_MODE_HCO}</li>
+ * <li>{@link #TTY_MODE_VCO}</li>
+ * </ul>
* @hide
*/
+ @SystemApi
public static final String EXTRA_TTY_PREFERRED_MODE =
"android.telecom.extra.TTY_PREFERRED_MODE";
@@ -851,8 +866,10 @@ public class TelecomManager {
* {@link TelecomManager#CALL_SOURCE_EMERGENCY_DIALPAD},
* {@link TelecomManager#CALL_SOURCE_EMERGENCY_SHORTCUT}.
*
+ * Intended for use with the platform emergency dialer only.
* @hide
*/
+ @SystemApi
public static final String EXTRA_CALL_SOURCE = "android.telecom.extra.CALL_SOURCE";
/**
@@ -860,6 +877,7 @@ public class TelecomManager {
*
* @hide
*/
+ @SystemApi
public static final int CALL_SOURCE_EMERGENCY_SHORTCUT = 2;
/**
@@ -867,6 +885,7 @@ public class TelecomManager {
*
* @hide
*/
+ @SystemApi
public static final int CALL_SOURCE_EMERGENCY_DIALPAD = 1;
/**
@@ -874,6 +893,7 @@ public class TelecomManager {
*
* @hide
*/
+ @SystemApi
public static final int CALL_SOURCE_UNSPECIFIED = 0;
/**
@@ -1024,7 +1044,6 @@ public class TelecomManager {
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
- @TestApi
@SystemApi
public void setUserSelectedOutgoingPhoneAccount(@Nullable PhoneAccountHandle accountHandle) {
try {
@@ -1198,7 +1217,6 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(READ_PRIVILEGED_PHONE_STATE)
public @NonNull List<PhoneAccountHandle> getCallCapablePhoneAccounts(
boolean includeDisabledAccounts) {
@@ -1429,7 +1447,6 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(READ_PRIVILEGED_PHONE_STATE)
public @Nullable String getDefaultDialerPackage(@NonNull UserHandle userHandle) {
try {
@@ -1810,7 +1827,6 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(READ_PRIVILEGED_PHONE_STATE)
public @TtyMode int getCurrentTtyMode() {
try {
@@ -1874,11 +1890,13 @@ public class TelecomManager {
/**
* Registers a new incoming conference. A {@link ConnectionService} should invoke this method
- * when it has an incoming conference. For managed {@link ConnectionService}s, the specified
- * {@link PhoneAccountHandle} must have been registered with {@link #registerPhoneAccount} and
- * the user must have enabled the corresponding {@link PhoneAccount}. This can be checked using
- * {@link #getPhoneAccount}. Self-managed {@link ConnectionService}s must have
- * {@link android.Manifest.permission#MANAGE_OWN_CALLS} to add a new incoming call.
+ * when it has an incoming conference. An incoming {@link Conference} is an adhoc conference
+ * call initiated on another device which the user is being invited to join in. For managed
+ * {@link ConnectionService}s, the specified {@link PhoneAccountHandle} must have been
+ * registered with {@link #registerPhoneAccount} and the user must have enabled the
+ * corresponding {@link PhoneAccount}. This can be checked using
+ * {@link #getPhoneAccount(PhoneAccountHandle)}. Self-managed {@link ConnectionService}s must
+ * have {@link android.Manifest.permission#MANAGE_OWN_CALLS} to add a new incoming call.
* <p>
* The incoming conference you are adding is assumed to have a video state of
* {@link VideoProfile#STATE_AUDIO_ONLY}, unless the extra value
@@ -1886,8 +1904,9 @@ public class TelecomManager {
* <p>
* Once invoked, this method will cause the system to bind to the {@link ConnectionService}
* associated with the {@link PhoneAccountHandle} and request additional information about the
- * call (See {@link ConnectionService#onCreateIncomingConference}) before starting the incoming
- * call UI.
+ * call (See
+ * {@link ConnectionService#onCreateIncomingConference(PhoneAccountHandle, ConnectionRequest)})
+ * before starting the incoming call UI.
* <p>
* For a managed {@link ConnectionService}, a {@link SecurityException} will be thrown if either
* the {@link PhoneAccountHandle} does not correspond to a registered {@link PhoneAccount} or
@@ -1897,7 +1916,6 @@ public class TelecomManager {
* {@link #registerPhoneAccount}.
* @param extras A bundle that will be passed through to
* {@link ConnectionService#onCreateIncomingConference}.
- * @hide
*/
public void addNewIncomingConference(@NonNull PhoneAccountHandle phoneAccount,
@NonNull Bundle extras) {
@@ -2118,8 +2136,8 @@ public class TelecomManager {
/**
- * Place a new conference call with the provided participants using the system telecom service
- * This method doesn't support placing of emergency calls.
+ * Place a new adhoc conference call with the provided participants using the system telecom
+ * service. This method doesn't support placing of emergency calls.
*
* An adhoc conference call is established by providing a list of addresses to
* {@code TelecomManager#startConference(List<Uri>, int videoState)} where the
@@ -2137,7 +2155,6 @@ public class TelecomManager {
*
* @param participants List of participants to start conference with
* @param extras Bundle of extras to use with the call
- * @hide
*/
@RequiresPermission(android.Manifest.permission.CALL_PHONE)
public void startConference(@NonNull List<Uri> participants,
@@ -2223,7 +2240,6 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- @TestApi
@NonNull
public Intent createLaunchEmergencyDialerIntent(@Nullable String number) {
ITelecomService service = getTelecomService();
@@ -2376,7 +2392,6 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- @TestApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public boolean isInEmergencyCall() {
try {
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index dee5a98e33e9..a28a999e8d19 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -191,7 +191,7 @@ interface ITelecomService {
/**
* @see TelecomServiceImpl#getCallState
*/
- @UnsupportedAppUsage
+ @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
int getCallState();
/**
@@ -326,6 +326,8 @@ interface ITelecomService {
*/
void handleCallIntent(in Intent intent, in String callingPackageProxy);
+ void cleanupStuckCalls();
+
void setTestDefaultCallRedirectionApp(String packageName);
void setTestPhoneAcctSuggestionComponent(String flattenedComponentName);