Self Managed CS Implementation
- Add API guide for developers giving an overview of what they need
to implement.
- Add @hide setLabel method in PhoneAccount; used when registering a
self-managed CS's phone account; we override it with their app label to
ensure they don't try to give themselves another name.
Test: Unit
Bug: 34159263
Change-Id: I0c890dc2feeb3ee438a80ed425db2aaf1f4c1fdd
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 833affa..7998359 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -436,6 +436,18 @@
"android.telecom.extra.ANSWERING_DROPS_FG_CALL";
/**
+ * String connection extra key set on a {@link Connection} in {@link Connection#STATE_RINGING}
+ * state to indicate the name of the third-party app which is responsible for the current
+ * foreground call.
+ * <p>
+ * Used when {@link #EXTRA_ANSWERING_DROPS_FG_CALL} is true to ensure that the default Phone app
+ * is able to inform the user that answering the new incoming call will cause a call owned by
+ * another app to be dropped when the incoming call is answered.
+ */
+ public static final String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME =
+ "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
+
+ /**
* Boolean connection extra key on a {@link Connection} which indicates that adding an
* additional call is disallowed.
* @hide
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java
index 3926e20..c42a835 100644
--- a/telecomm/java/android/telecom/PhoneAccount.java
+++ b/telecomm/java/android/telecom/PhoneAccount.java
@@ -310,6 +310,18 @@
}
/**
+ * Sets the label. See {@link PhoneAccount#getLabel()}.
+ *
+ * @param label The label of the phone account.
+ * @return The builder.
+ * @hide
+ */
+ public Builder setLabel(CharSequence label) {
+ this.mLabel = label;
+ return this;
+ }
+
+ /**
* Sets the address. See {@link PhoneAccount#getAddress}.
*
* @param value The address of the phone account.
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index e21b4db..5093a61 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -181,6 +181,18 @@
"android.telecom.extra.START_CALL_WITH_VIDEO_STATE";
/**
+ * Optional extra for {@link #addNewIncomingCall(PhoneAccountHandle, Bundle)} containing an
+ * integer that determines the requested video state for an incoming call.
+ * Valid options:
+ * {@link VideoProfile#STATE_AUDIO_ONLY},
+ * {@link VideoProfile#STATE_BIDIRECTIONAL},
+ * {@link VideoProfile#STATE_RX_ENABLED},
+ * {@link VideoProfile#STATE_TX_ENABLED}.
+ */
+ public static final String EXTRA_INCOMING_VIDEO_STATE =
+ "android.telecom.extra.INCOMING_VIDEO_STATE";
+
+ /**
* The extra used with an {@link android.content.Intent#ACTION_CALL} and
* {@link android.content.Intent#ACTION_DIAL} {@code Intent} to specify a
* {@link PhoneAccountHandle} to use when making the call.
@@ -383,7 +395,11 @@
* <p>
* An {@link InCallService} which receives self-managed calls is free to view and control the
* state of calls in the self-managed {@link ConnectionService}. An example use-case is
- * exposing these calls to a wearable or automotive device via its companion app.
+ * exposing these calls to an automotive device via its companion app.
+ * <p>
+ * This meta-data can only be set for an {@link InCallService} which also sets
+ * {@link #METADATA_IN_CALL_SERVICE_UI}. Only the default phone/dialer app, or a car-mode
+ * {@link InCallService} can see self-managed calls.
* <p>
* See also {@link Connection#PROPERTY_SELF_MANAGED}.
*/
@@ -1277,6 +1293,10 @@
* {@link #getPhoneAccount}. Self-managed {@link ConnectionService}s must have
* {@link android.Manifest.permission#MANAGE_OWN_CALLS} to add a new incoming call.
* <p>
+ * The incoming call you are adding is assumed to have a video state of
+ * {@link VideoProfile#STATE_AUDIO_ONLY}, unless the extra value
+ * {@link #EXTRA_INCOMING_VIDEO_STATE} is specified.
+ * <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#onCreateIncomingConnection}) before starting the incoming