From c63f9082a6458d42d38a844616d45b4b6443beac Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 15 Oct 2019 13:19:26 -0700 Subject: Telecom API updates for mainline support. Moving some Telecom APIs into public since they are harmless to expose. Moving some other Telecom APIs into the System API space since they're API details specific to the TelephonyConnectionService so don't need to be exposed in the public API. Bug: 141576016 Test: Manual smoke test. Test: Run unit tests. Test: Run CTS tests. Change-Id: Iaf75b9d671712d791f501c11536e73436908f7de Merged-In: Iaf75b9d671712d791f501c11536e73436908f7de --- api/current.txt | 12 + api/system-current.txt | 19 ++ telecomm/java/android/telecom/Connection.java | 334 +++++++++++--------------- 3 files changed, 174 insertions(+), 191 deletions(-) diff --git a/api/current.txt b/api/current.txt index c396d74116b6..de4fe4c37a64 100644 --- a/api/current.txt +++ b/api/current.txt @@ -43284,8 +43284,10 @@ package android.telecom { method public final int getState(); method public final android.telecom.StatusHints getStatusHints(); method public final android.telecom.Connection.VideoProvider getVideoProvider(); + method public final int getVideoState(); method public void handleRttUpgradeResponse(@Nullable android.telecom.Connection.RttTextStream); method public final boolean isRingbackRequested(); + method public final void notifyConferenceMergeFailed(); method public void onAbort(); method public void onAnswer(int); method public void onAnswer(); @@ -43364,8 +43366,15 @@ package android.telecom { field public static final int CAPABILITY_SUPPORT_DEFLECT = 33554432; // 0x2000000 field public static final int CAPABILITY_SUPPORT_HOLD = 2; // 0x2 field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8 + field public static final String EVENT_CALL_HOLD_FAILED = "android.telecom.event.CALL_HOLD_FAILED"; field public static final String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED"; field public static final String EVENT_CALL_PULL_FAILED = "android.telecom.event.CALL_PULL_FAILED"; + field public static final String EVENT_CALL_REMOTELY_HELD = "android.telecom.event.CALL_REMOTELY_HELD"; + field public static final String EVENT_CALL_REMOTELY_UNHELD = "android.telecom.event.CALL_REMOTELY_UNHELD"; + field public static final String EVENT_MERGE_COMPLETE = "android.telecom.event.MERGE_COMPLETE"; + field public static final String EVENT_MERGE_START = "android.telecom.event.MERGE_START"; + field public static final String EVENT_ON_HOLD_TONE_END = "android.telecom.event.ON_HOLD_TONE_END"; + field public static final String EVENT_ON_HOLD_TONE_START = "android.telecom.event.ON_HOLD_TONE_START"; field public static final String EVENT_RTT_AUDIO_INDICATION_CHANGED = "android.telecom.event.RTT_AUDIO_INDICATION_CHANGED"; field public static final String EXTRA_ANSWERING_DROPS_FG_CALL = "android.telecom.extra.ANSWERING_DROPS_FG_CALL"; field public static final String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME = "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME"; @@ -43375,9 +43384,12 @@ package android.telecom { field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER"; field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE"; field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20 + field public static final int PROPERTY_HIGH_DEF_AUDIO = 4; // 0x4 field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10 field public static final int PROPERTY_IS_RTT = 256; // 0x100 + field public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 1024; // 0x400 field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80 + field public static final int PROPERTY_WIFI = 8; // 0x8 field public static final int STATE_ACTIVE = 4; // 0x4 field public static final int STATE_DIALING = 3; // 0x3 field public static final int STATE_DISCONNECTED = 6; // 0x6 diff --git a/api/system-current.txt b/api/system-current.txt index b674e928bd6f..36c7fc4bc98e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6917,7 +6917,26 @@ package android.telecom { public abstract class Connection extends android.telecom.Conferenceable { method @Deprecated public final android.telecom.AudioState getAudioState(); + method public final int getCallRadioTech(); + method public final long getConnectElapsedTimeMillis(); + method public final long getConnectTimeMillis(); + method @Nullable public android.telecom.PhoneAccountHandle getPhoneAccountHandle(); + method @Nullable public final String getTelecomCallId(); method @Deprecated public void onAudioStateChanged(android.telecom.AudioState); + method public final void resetConnectionTime(); + method public void setCallDirection(int); + method public final void setCallRadioTech(int); + method public final void setConnectTimeMillis(long); + method public final void setConnectionStartElapsedRealTime(long); + method public void setPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle); + method public void setTelecomCallId(@NonNull String); + field public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 2097152; // 0x200000 + field public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 262144; // 0x40000 + field public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL"; + field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1; // 0x1 + field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2 + field public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 64; // 0x40 + field public static final int PROPERTY_REMOTELY_HOSTED = 2048; // 0x800 } public abstract class InCallService extends android.app.Service { diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 0983eea8e819..2ce84fbc0dc7 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -266,8 +266,13 @@ public abstract class Connection extends Conferenceable { /** * Speed up audio setup for MT call. + *

+ * Used for IMS calls to indicate that mobile-terminated (incoming) call audio setup should take + * place as soon as the device answers the call, but prior to it being connected. This is an + * optimization some IMS stacks depend on to ensure prompt setup of call audio. * @hide */ + @SystemApi public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000; /** @@ -304,6 +309,7 @@ public abstract class Connection extends Conferenceable { * device. * @hide */ + @SystemApi public static final int CAPABILITY_CONFERENCE_HAS_NO_CHILDREN = 0x00200000; /** @@ -345,28 +351,40 @@ public abstract class Connection extends Conferenceable { /** * Indicates that the current device callback number should be shown. - * + *

+ * Supports Telephony calls where CDMA emergency callback mode is active. * @hide */ + @SystemApi public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1<<0; /** * Whether the call is a generic conference, where we do not know the precise state of * participants in the conference (eg. on CDMA). - * + *

+ * Supports legacy telephony CDMA calls. * @hide */ + @SystemApi public static final int PROPERTY_GENERIC_CONFERENCE = 1<<1; /** * Connection is using high definition audio. - * @hide + *

+ * Indicates that the {@link Connection} is using a "high definition" audio codec. This usually + * implies something like AMR wideband, but the interpretation of when a call is considered high + * definition is left to the {@link ConnectionService} to decide. + *

+ * Translates to {@link android.telecom.Call.Details#PROPERTY_HIGH_DEF_AUDIO}. */ public static final int PROPERTY_HIGH_DEF_AUDIO = 1<<2; /** * Connection is using WIFI. - * @hide + *

+ * Used to indicate that a call is taking place over WIFI versus a carrier network. + *

+ * Translates to {@link android.telecom.Call.Details#PROPERTY_WIFI}. */ public static final int PROPERTY_WIFI = 1<<3; @@ -393,8 +411,12 @@ public abstract class Connection extends Conferenceable { /** * Indicates that the connection represents a downgraded IMS conference. + *

+ * This property is set when an IMS conference undergoes SRVCC and is re-added to Telecom as a + * new entity to indicate that the new connection was a conference. * @hide */ + @SystemApi public static final int PROPERTY_IS_DOWNGRADED_CONFERENCE = 1<<6; /** @@ -420,7 +442,9 @@ public abstract class Connection extends Conferenceable { /** * Set by the framework to indicate that the network has identified a Connection as an emergency * call. - * @hide + *

+ * This is used for incoming (mobile-terminated) calls to indicate the call is from emergency + * services. */ public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 1 << 10; @@ -428,8 +452,11 @@ public abstract class Connection extends Conferenceable { * Set by the framework to indicate that a Conference or Connection is hosted by a device other * than the current one. Used in scenarios where the conference originator is the remote device * and the current device is a participant of that conference. + *

+ * This property is specific to IMS conference calls originating in Telephony. * @hide */ + @SystemApi public static final int PROPERTY_REMOTELY_HOSTED = 1 << 11; //********************************************************************************************** @@ -482,8 +509,12 @@ public abstract class Connection extends Conferenceable { /** * Boolean connection extra key on a {@link Connection} which indicates that adding an * additional call is disallowed. + *

+ * Used for mobile-network calls to identify scenarios where carrier requirements preclude + * adding another call at the current time. * @hide */ + @SystemApi public static final String EXTRA_DISABLE_ADD_CALL = "android.telecom.extra.DISABLE_ADD_CALL"; @@ -507,6 +538,9 @@ public abstract class Connection extends Conferenceable { * The TelephonyCS will ALSO try to add the existing connection to Telecom, except with the * ID it originally referred to the connection as. Thus Telecom needs to know that the * Connection with ID {@code ConnMan@1} is really the same as {@code TelephonyCS@1}. + *

+ * This is an internal Telecom framework concept and is not exposed outside of the Telecom + * framework. * @hide */ public static final String EXTRA_ORIGINAL_CONNECTION_ID = @@ -524,7 +558,6 @@ public abstract class Connection extends Conferenceable { * Connection event used to inform Telecom that it should play the on hold tone. This is used * to play a tone when the peer puts the current call on hold. Sent to Telecom via * {@link #sendConnectionEvent(String, Bundle)}. - * @hide */ public static final String EVENT_ON_HOLD_TONE_START = "android.telecom.event.ON_HOLD_TONE_START"; @@ -533,7 +566,6 @@ public abstract class Connection extends Conferenceable { * Connection event used to inform Telecom that it should stop the on hold tone. This is used * to stop a tone when the peer puts the current call on hold. Sent to Telecom via * {@link #sendConnectionEvent(String, Bundle)}. - * @hide */ public static final String EVENT_ON_HOLD_TONE_END = "android.telecom.event.ON_HOLD_TONE_END"; @@ -564,10 +596,9 @@ public abstract class Connection extends Conferenceable { /** * Connection event used to inform Telecom when a hold operation on a call has failed. - * Not intended for use by the UI at this time. + *

* Sent via {@link #sendConnectionEvent(String, Bundle)}. The {@link Bundle} parameter is * expected to be null when this connection event is used. - * @hide */ public static final String EVENT_CALL_HOLD_FAILED = "android.telecom.event.CALL_HOLD_FAILED"; @@ -577,7 +608,6 @@ public abstract class Connection extends Conferenceable { *

* Sent via {@link #sendConnectionEvent(String, Bundle)}. The {@link Bundle} parameter is * expected to be null when this connection event is used. - * @hide */ public static final String EVENT_MERGE_START = "android.telecom.event.MERGE_START"; @@ -587,7 +617,6 @@ public abstract class Connection extends Conferenceable { *

* Sent via {@link #sendConnectionEvent(String, Bundle)}. The {@link Bundle} parameter is * expected to be null when this connection event is used. - * @hide */ public static final String EVENT_MERGE_COMPLETE = "android.telecom.event.MERGE_COMPLETE"; @@ -599,7 +628,6 @@ public abstract class Connection extends Conferenceable { * call is being held locally on the device. When a capable {@link ConnectionService} receives * signalling to indicate that the remote party has put the call on hold, it can send this * connection event. - * @hide */ public static final String EVENT_CALL_REMOTELY_HELD = "android.telecom.event.CALL_REMOTELY_HELD"; @@ -612,7 +640,6 @@ public abstract class Connection extends Conferenceable { * call is being held locally on the device. When a capable {@link ConnectionService} receives * signalling to indicate that the remote party has taken the call off hold, it can send this * connection event. - * @hide */ public static final String EVENT_CALL_REMOTELY_UNHELD = "android.telecom.event.CALL_REMOTELY_UNHELD"; @@ -654,49 +681,6 @@ public abstract class Connection extends Conferenceable { // Flag controlling whether PII is emitted into the logs private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG); - /** - * Whether the given capabilities support the specified capability. - * - * @param capabilities A capability bit field. - * @param capability The capability to check capabilities for. - * @return Whether the specified capability is supported. - * @hide - */ - public static boolean can(int capabilities, int capability) { - return (capabilities & capability) == capability; - } - - /** - * Whether the capabilities of this {@code Connection} supports the specified capability. - * - * @param capability The capability to check capabilities for. - * @return Whether the specified capability is supported. - * @hide - */ - public boolean can(int capability) { - return can(mConnectionCapabilities, capability); - } - - /** - * Removes the specified capability from the set of capabilities of this {@code Connection}. - * - * @param capability The capability to remove from the set. - * @hide - */ - public void removeCapability(int capability) { - mConnectionCapabilities &= ~capability; - } - - /** - * Adds the specified capability to the set of capabilities of this {@code Connection}. - * - * @param capability The capability to add to the set. - * @hide - */ - public void addCapability(int capability) { - mConnectionCapabilities |= capability; - } - /** * Renders a set of capability bits ({@code CAPABILITY_*}) as a human readable string. * @@ -726,67 +710,72 @@ public abstract class Connection extends Conferenceable { builder.append("Capabilities:"); } - if (can(capabilities, CAPABILITY_HOLD)) { + if ((capabilities & CAPABILITY_HOLD) == CAPABILITY_HOLD) { builder.append(isLong ? " CAPABILITY_HOLD" : " hld"); } - if (can(capabilities, CAPABILITY_SUPPORT_HOLD)) { + if ((capabilities & CAPABILITY_SUPPORT_HOLD) == CAPABILITY_SUPPORT_HOLD) { builder.append(isLong ? " CAPABILITY_SUPPORT_HOLD" : " sup_hld"); } - if (can(capabilities, CAPABILITY_MERGE_CONFERENCE)) { + if ((capabilities & CAPABILITY_MERGE_CONFERENCE) == CAPABILITY_MERGE_CONFERENCE) { builder.append(isLong ? " CAPABILITY_MERGE_CONFERENCE" : " mrg_cnf"); } - if (can(capabilities, CAPABILITY_SWAP_CONFERENCE)) { + if ((capabilities & CAPABILITY_SWAP_CONFERENCE) == CAPABILITY_SWAP_CONFERENCE) { builder.append(isLong ? " CAPABILITY_SWAP_CONFERENCE" : " swp_cnf"); } - if (can(capabilities, CAPABILITY_RESPOND_VIA_TEXT)) { + if ((capabilities & CAPABILITY_RESPOND_VIA_TEXT) == CAPABILITY_RESPOND_VIA_TEXT) { builder.append(isLong ? " CAPABILITY_RESPOND_VIA_TEXT" : " txt"); } - if (can(capabilities, CAPABILITY_MUTE)) { + if ((capabilities & CAPABILITY_MUTE) == CAPABILITY_MUTE) { builder.append(isLong ? " CAPABILITY_MUTE" : " mut"); } - if (can(capabilities, CAPABILITY_MANAGE_CONFERENCE)) { + if ((capabilities & CAPABILITY_MANAGE_CONFERENCE) == CAPABILITY_MANAGE_CONFERENCE) { builder.append(isLong ? " CAPABILITY_MANAGE_CONFERENCE" : " mng_cnf"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_RX)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_LOCAL_RX) == CAPABILITY_SUPPORTS_VT_LOCAL_RX) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_LOCAL_RX" : " VTlrx"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_LOCAL_TX) == CAPABILITY_SUPPORTS_VT_LOCAL_TX) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_LOCAL_TX" : " VTltx"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL) + == CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL" : " VTlbi"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_REMOTE_RX) == CAPABILITY_SUPPORTS_VT_REMOTE_RX) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_REMOTE_RX" : " VTrrx"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_TX)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_REMOTE_TX) == CAPABILITY_SUPPORTS_VT_REMOTE_TX) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_REMOTE_TX" : " VTrtx"); } - if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) { + if ((capabilities & CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL) + == CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL) { builder.append(isLong ? " CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL" : " VTrbi"); } - if (can(capabilities, CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO)) { + if ((capabilities & CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO) + == CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO) { builder.append(isLong ? " CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO" : " !v2a"); } - if (can(capabilities, CAPABILITY_SPEED_UP_MT_AUDIO)) { + if ((capabilities & CAPABILITY_SPEED_UP_MT_AUDIO) == CAPABILITY_SPEED_UP_MT_AUDIO) { builder.append(isLong ? " CAPABILITY_SPEED_UP_MT_AUDIO" : " spd_aud"); } - if (can(capabilities, CAPABILITY_CAN_UPGRADE_TO_VIDEO)) { + if ((capabilities & CAPABILITY_CAN_UPGRADE_TO_VIDEO) == CAPABILITY_CAN_UPGRADE_TO_VIDEO) { builder.append(isLong ? " CAPABILITY_CAN_UPGRADE_TO_VIDEO" : " a2v"); } - if (can(capabilities, CAPABILITY_CAN_PAUSE_VIDEO)) { + if ((capabilities & CAPABILITY_CAN_PAUSE_VIDEO) == CAPABILITY_CAN_PAUSE_VIDEO) { builder.append(isLong ? " CAPABILITY_CAN_PAUSE_VIDEO" : " paus_VT"); } - if (can(capabilities, CAPABILITY_CONFERENCE_HAS_NO_CHILDREN)) { + if ((capabilities & CAPABILITY_CONFERENCE_HAS_NO_CHILDREN) + == CAPABILITY_CONFERENCE_HAS_NO_CHILDREN) { builder.append(isLong ? " CAPABILITY_SINGLE_PARTY_CONFERENCE" : " 1p_cnf"); } - if (can(capabilities, CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION)) { + if ((capabilities & CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION) + == CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION) { builder.append(isLong ? " CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION" : " rsp_by_con"); } - if (can(capabilities, CAPABILITY_CAN_PULL_CALL)) { + if ((capabilities & CAPABILITY_CAN_PULL_CALL) == CAPABILITY_CAN_PULL_CALL) { builder.append(isLong ? " CAPABILITY_CAN_PULL_CALL" : " pull"); } - if (can(capabilities, CAPABILITY_SUPPORT_DEFLECT)) { + if ((capabilities & CAPABILITY_SUPPORT_DEFLECT) == CAPABILITY_SUPPORT_DEFLECT) { builder.append(isLong ? " CAPABILITY_SUPPORT_DEFLECT" : " sup_def"); } @@ -822,43 +811,44 @@ public abstract class Connection extends Conferenceable { builder.append("Properties:"); } - if (can(properties, PROPERTY_SELF_MANAGED)) { + if ((properties & PROPERTY_SELF_MANAGED) == PROPERTY_SELF_MANAGED) { builder.append(isLong ? " PROPERTY_SELF_MANAGED" : " self_mng"); } - if (can(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) { + if ((properties & PROPERTY_EMERGENCY_CALLBACK_MODE) == PROPERTY_EMERGENCY_CALLBACK_MODE) { builder.append(isLong ? " PROPERTY_EMERGENCY_CALLBACK_MODE" : " ecbm"); } - if (can(properties, PROPERTY_HIGH_DEF_AUDIO)) { + if ((properties & PROPERTY_HIGH_DEF_AUDIO) == PROPERTY_HIGH_DEF_AUDIO) { builder.append(isLong ? " PROPERTY_HIGH_DEF_AUDIO" : " HD"); } - if (can(properties, PROPERTY_WIFI)) { + if ((properties & PROPERTY_WIFI) == PROPERTY_WIFI) { builder.append(isLong ? " PROPERTY_WIFI" : " wifi"); } - if (can(properties, PROPERTY_GENERIC_CONFERENCE)) { + if ((properties & PROPERTY_GENERIC_CONFERENCE) == PROPERTY_GENERIC_CONFERENCE) { builder.append(isLong ? " PROPERTY_GENERIC_CONFERENCE" : " gen_conf"); } - if (can(properties, PROPERTY_IS_EXTERNAL_CALL)) { + if ((properties & PROPERTY_IS_EXTERNAL_CALL) == PROPERTY_IS_EXTERNAL_CALL) { builder.append(isLong ? " PROPERTY_IS_EXTERNAL_CALL" : " xtrnl"); } - if (can(properties, PROPERTY_HAS_CDMA_VOICE_PRIVACY)) { + if ((properties & PROPERTY_HAS_CDMA_VOICE_PRIVACY) == PROPERTY_HAS_CDMA_VOICE_PRIVACY) { builder.append(isLong ? " PROPERTY_HAS_CDMA_VOICE_PRIVACY" : " priv"); } - if (can(properties, PROPERTY_IS_RTT)) { + if ((properties & PROPERTY_IS_RTT) == PROPERTY_IS_RTT) { builder.append(isLong ? " PROPERTY_IS_RTT" : " rtt"); } - if (can(properties, PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL)) { + if ((properties & PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL) + == PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL) { builder.append(isLong ? " PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL" : " ecall"); } - if (can(properties, PROPERTY_REMOTELY_HOSTED)) { + if ((properties & PROPERTY_REMOTELY_HOSTED) == PROPERTY_REMOTELY_HOSTED) { builder.append(isLong ? " PROPERTY_REMOTELY_HOSTED" : " remote_hst"); } @@ -888,16 +878,10 @@ public abstract class Connection extends Conferenceable { public void onConferenceablesChanged( Connection c, List conferenceables) {} public void onConferenceChanged(Connection c, Conference conference) {} - /** @hide */ - public void onConferenceParticipantsChanged(Connection c, - List participants) {} - public void onConferenceStarted() {} public void onConferenceMergeFailed(Connection c) {} public void onExtrasChanged(Connection c, Bundle extras) {} public void onExtrasRemoved(Connection c, List keys) {} public void onConnectionEvent(Connection c, String event, Bundle extras) {} - /** @hide */ - public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {} public void onAudioRouteChanged(Connection c, int audioRoute, String bluetoothAddress) {} public void onRttInitiationSuccess(Connection c) {} public void onRttInitiationFailure(Connection c, int reason) {} @@ -1814,11 +1798,15 @@ public abstract class Connection extends Conferenceable { /** * Returns the Telecom internal call ID associated with this connection. Should only be used * for debugging and tracing purposes. + *

+ * Note: Access to the Telecom internal call ID is used for logging purposes only; this API is + * provided to facilitate debugging of the Telephony stack only. * - * @return The Telecom call ID. + * @return The Telecom call ID, or {@code null} if it was not set. * @hide */ - public final String getTelecomCallId() { + @SystemApi + public final @Nullable String getTelecomCallId() { return mTelecomCallId; } @@ -1867,9 +1855,8 @@ public abstract class Connection extends Conferenceable { * {@link VideoProfile#STATE_RX_ENABLED}. * * @return The video state of the connection. - * @hide */ - public final int getVideoState() { + public final @VideoProfile.VideoState int getVideoState() { return mVideoState; } @@ -1925,11 +1912,16 @@ public abstract class Connection extends Conferenceable { * Retrieves the connection start time of the {@code Connnection}, if specified. A value of * {@link Conference#CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the * start time of the conference. + *

+ * Note: This is an implementation detail specific to IMS conference calls over a mobile + * network. * - * @return The time at which the {@code Connnection} was connected. + * @return The time at which the {@code Connnection} was connected. Will be a value as retrieved + * from {@link System#currentTimeMillis()}. * * @hide */ + @SystemApi public final long getConnectTimeMillis() { return mConnectTimeMillis; } @@ -1938,26 +1930,32 @@ public abstract class Connection extends Conferenceable { * Retrieves the connection start time of the {@link Connection}, if specified. A value of * {@link Conference#CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the * start time of the conference. - * + *

* Based on the value of {@link SystemClock#elapsedRealtime()}, which ensures that wall-clock * changes do not impact the call duration. + *

+ * Used internally in Telephony when migrating conference participant data for IMS conferences. * * @return The time at which the {@link Connection} was connected. * * @hide */ + @SystemApi public final long getConnectElapsedTimeMillis() { return mConnectElapsedTimeMillis; } /** * Returns RIL voice radio technology used for current connection. + *

+ * Used by the Telephony {@link ConnectionService}. * * @return the RIL voice radio technology used for current connection, * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. * * @hide */ + @SystemApi public final @ServiceState.RilRadioTechnology int getCallRadioTech() { int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; Bundle extras = getExtras(); @@ -2037,11 +2035,16 @@ public abstract class Connection extends Conferenceable { /** * Sets the telecom call ID associated with this Connection. The Telecom Call ID should be used * ONLY for debugging purposes. + *

+ * Note: Access to the Telecom internal call ID is used for logging purposes only; this API is + * provided to facilitate debugging of the Telephony stack only. Changing the ID via this + * method does NOT change any functionality in Telephony or Telecom and impacts only logging. * * @param callId The telecom call ID. * @hide */ - public void setTelecomCallId(String callId) { + @SystemApi + public void setTelecomCallId(@NonNull String callId) { mTelecomCallId = callId; } @@ -2378,12 +2381,15 @@ public abstract class Connection extends Conferenceable { /** * Sets the time at which a call became active on this Connection. This is set only * when a conference call becomes active on this connection. + *

+ * Used by telephony to maintain calls associated with an IMS Conference. * * @param connectTimeMillis The connection time, in milliseconds. Should be set using a value * obtained from {@link System#currentTimeMillis()}. * * @hide */ + @SystemApi public final void setConnectTimeMillis(long connectTimeMillis) { mConnectTimeMillis = connectTimeMillis; } @@ -2391,27 +2397,37 @@ public abstract class Connection extends Conferenceable { /** * Sets the time at which a call became active on this Connection. This is set only * when a conference call becomes active on this connection. - * + *

+ * Used by telephony to maintain calls associated with an IMS Conference. * @param connectElapsedTimeMillis The connection time, in milliseconds. Stored in the format * {@link SystemClock#elapsedRealtime()}. * * @hide */ + @SystemApi public final void setConnectionStartElapsedRealTime(long connectElapsedTimeMillis) { mConnectElapsedTimeMillis = connectElapsedTimeMillis; } /** * Sets RIL voice radio technology used for current connection. + *

+ * This property is set by the Telephony {@link ConnectionService}. * * @param vrat the RIL Voice Radio Technology used for current connection, * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. * * @hide */ + @SystemApi public final void setCallRadioTech(@ServiceState.RilRadioTechnology int vrat) { - putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE, + Bundle extras = getExtras(); + if (extras == null) { + extras = new Bundle(); + } + extras.putInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE, ServiceState.rilRadioTechnologyToNetworkType(vrat)); + putExtras(extras); // Propagates the call radio technology to its parent {@link android.telecom.Conference} // This action only covers non-IMS CS conference calls. // For IMS PS call conference call, it can be updated via its host connection @@ -2479,9 +2495,12 @@ public abstract class Connection extends Conferenceable { } /** + * Resets the CDMA connection time. + *

+ * This is an implementation detail specific to legacy CDMA calls on mobile networks. * @hide - * Resets the cdma connection time. */ + @SystemApi public final void resetConnectionTime() { for (Listener l : mListeners) { l.onConnectionTimeReset(this); @@ -2520,13 +2539,6 @@ public abstract class Connection extends Conferenceable { } } - /** - * @hide - */ - public final ConnectionService getConnectionService() { - return mConnectionService; - } - /** * Sets the conference that this connection is a part of. This will fail if the connection is * already part of a conference. {@link #resetConference} to un-set the conference first. @@ -2636,45 +2648,6 @@ public abstract class Connection extends Conferenceable { } } - /** - * Adds a boolean extra to this {@code Connection}. - * - * @param key The extra key. - * @param value The value. - * @hide - */ - public final void putExtra(String key, boolean value) { - Bundle newExtras = new Bundle(); - newExtras.putBoolean(key, value); - putExtras(newExtras); - } - - /** - * Adds an integer extra to this {@code Connection}. - * - * @param key The extra key. - * @param value The value. - * @hide - */ - public final void putExtra(String key, int value) { - Bundle newExtras = new Bundle(); - newExtras.putInt(key, value); - putExtras(newExtras); - } - - /** - * Adds a string extra to this {@code Connection}. - * - * @param key The extra key. - * @param value The value. - * @hide - */ - public final void putExtra(String key, String value) { - Bundle newExtras = new Bundle(); - newExtras.putString(key, value); - putExtras(newExtras); - } - /** * Removes extras from this {@code Connection}. * @@ -3241,52 +3214,15 @@ public abstract class Connection extends Conferenceable { } /** - * Notifies listeners that the merge request failed. - * - * @hide + * Called by a {@link ConnectionService} to notify Telecom that a {@link Conference#onMerge()} + * request failed. */ - protected final void notifyConferenceMergeFailed() { + public final void notifyConferenceMergeFailed() { for (Listener l : mListeners) { l.onConferenceMergeFailed(this); } } - /** - * Notifies listeners of a change to conference participant(s). - * - * @param conferenceParticipants The participants. - * @hide - */ - protected final void updateConferenceParticipants( - List conferenceParticipants) { - for (Listener l : mListeners) { - l.onConferenceParticipantsChanged(this, conferenceParticipants); - } - } - - /** - * Notifies listeners that a conference call has been started. - * @hide - */ - protected void notifyConferenceStarted() { - for (Listener l : mListeners) { - l.onConferenceStarted(); - } - } - - /** - * Notifies listeners when a change has occurred to the Connection which impacts its ability to - * be a part of a conference call. - * @param isConferenceSupported {@code true} if the connection supports being part of a - * conference call, {@code false} otherwise. - * @hide - */ - protected void notifyConferenceSupportedChanged(boolean isConferenceSupported) { - for (Listener l : mListeners) { - l.onConferenceSupportedChanged(this, isConferenceSupported); - } - } - /** * Notifies listeners when phone account is changed. For example, when the PhoneAccount is * changed due to an emergency call being redialed. @@ -3301,10 +3237,15 @@ public abstract class Connection extends Conferenceable { /** * Sets the {@link PhoneAccountHandle} associated with this connection. + *

+ * Used by the Telephony {@link ConnectionService} to handle changes to the {@link PhoneAccount} + * which take place after call initiation (important for emergency calling scenarios). * + * @param phoneAccountHandle the phone account handle to set. * @hide */ - public void setPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) { + @SystemApi + public void setPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) { if (mPhoneAccountHandle != phoneAccountHandle) { mPhoneAccountHandle = phoneAccountHandle; notifyPhoneAccountChanged(phoneAccountHandle); @@ -3313,10 +3254,16 @@ public abstract class Connection extends Conferenceable { /** * Returns the {@link PhoneAccountHandle} associated with this connection. + *

+ * Used by the Telephony {@link ConnectionService} to handle changes to the {@link PhoneAccount} + * which take place after call initiation (important for emergency calling scenarios). * + * @return the phone account handle specified via + * {@link #setPhoneAccountHandle(PhoneAccountHandle)}, or {@code null} if none was set. * @hide */ - public PhoneAccountHandle getPhoneAccountHandle() { + @SystemApi + public @Nullable PhoneAccountHandle getPhoneAccountHandle() { return mPhoneAccountHandle; } @@ -3373,9 +3320,14 @@ public abstract class Connection extends Conferenceable { /** * Sets the direction of this connection. + *

+ * Used when calling {@link ConnectionService#addExistingConnection} to specify the existing + * call direction. + * * @param callDirection The direction of this connection. * @hide */ + @SystemApi public void setCallDirection(@Call.Details.CallDirection int callDirection) { mCallDirection = callDirection; } -- cgit v1.2.3-59-g8ed1b