diff options
Diffstat (limited to 'telecomm/java/android/telecom/Conference.java')
| -rw-r--r-- | telecomm/java/android/telecom/Conference.java | 85 |
1 files changed, 68 insertions, 17 deletions
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 33bbb29..bab60fe 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -16,27 +16,26 @@ package android.telecom; -import android.annotation.SystemApi; +import android.telecom.Connection.VideoProvider; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; /** * Represents a conference call which can contain any number of {@link Connection} objects. - * @hide */ -@SystemApi -public abstract class Conference implements IConferenceable { +public abstract class Conference implements Conferenceable { /** * Used to indicate that the conference connection time is not specified. If not specified, * Telecom will set the connect time. */ - public static long CONNECT_TIME_NOT_SPECIFIED = 0; + public static final long CONNECT_TIME_NOT_SPECIFIED = 0; /** @hide */ public abstract static class Listener { @@ -49,6 +48,8 @@ public abstract class Conference implements IConferenceable { public void onDestroyed(Conference conference) {} public void onConnectionCapabilitiesChanged( Conference conference, int connectionCapabilities) {} + public void onVideoStateChanged(Conference c, int videoState) { } + public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {} } private final Set<Listener> mListeners = new CopyOnWriteArraySet<>(); @@ -59,7 +60,7 @@ public abstract class Conference implements IConferenceable { private final List<Connection> mUnmodifiableConferenceableConnections = Collections.unmodifiableList(mConferenceableConnections); - protected PhoneAccountHandle mPhoneAccount; + private PhoneAccountHandle mPhoneAccount; private AudioState mAudioState; private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; @@ -112,11 +113,6 @@ public abstract class Conference implements IConferenceable { return mState; } - /** @hide */ - @Deprecated public final int getCapabilities() { - return getConnectionCapabilities(); - } - /** * Returns the capabilities of a conference. See {@code CAPABILITY_*} constants in class * {@link Connection} for valid values. @@ -180,6 +176,22 @@ public abstract class Conference implements IConferenceable { } /** + * Returns VideoProvider of the primary call. This can be null. + * @hide + */ + public VideoProvider getVideoProvider() { + return null; + } + + /** + * Returns video state of the primary call. + * @hide + */ + public int getVideoState() { + return VideoProfile.VideoState.AUDIO_ONLY; + } + + /** * Invoked when the Conference and all it's {@link Connection}s should be disconnected. */ public void onDisconnect() {} @@ -281,11 +293,6 @@ public abstract class Conference implements IConferenceable { return mDisconnectCause; } - /** @hide */ - @Deprecated public final void setCapabilities(int connectionCapabilities) { - setConnectionCapabilities(connectionCapabilities); - } - /** * Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class * {@link Connection} for valid values. @@ -309,6 +316,7 @@ public abstract class Conference implements IConferenceable { * @return True if the connection was successfully added. */ public final boolean addConnection(Connection connection) { + Log.d(this, "Connection=%s, connection=", connection); if (connection != null && !mChildConnections.contains(connection)) { if (connection.setConference(this)) { mChildConnections.add(connection); @@ -355,6 +363,38 @@ public abstract class Conference implements IConferenceable { fireOnConferenceableConnectionsChanged(); } + /** + * Set the video state for the conference. + * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, + * {@link VideoProfile.VideoState#BIDIRECTIONAL}, + * {@link VideoProfile.VideoState#TX_ENABLED}, + * {@link VideoProfile.VideoState#RX_ENABLED}. + * + * @param videoState The new video state. + * @hide + */ + public final void setVideoState(Connection c, int videoState) { + Log.d(this, "setVideoState Conference: %s Connection: %s VideoState: %s", + this, c, videoState); + for (Listener l : mListeners) { + l.onVideoStateChanged(this, videoState); + } + } + + /** + * Sets the video connection provider. + * + * @param videoProvider The video provider. + * @hide + */ + public final void setVideoProvider(Connection c, Connection.VideoProvider videoProvider) { + Log.d(this, "setVideoProvider Conference: %s Connection: %s VideoState: %s", + this, c, videoProvider); + for (Listener l : mListeners) { + l.onVideoProviderChanged(this, videoProvider); + } + } + private final void fireOnConferenceableConnectionsChanged() { for (Listener l : mListeners) { l.onConferenceableConnectionsChanged(this, getConferenceableConnections()); @@ -444,7 +484,7 @@ public abstract class Conference implements IConferenceable { * * @return The time the {@code Conference} has been connected. */ - public long getConnectTimeMillis() { + public final long getConnectTimeMillis() { return mConnectTimeMillis; } @@ -484,4 +524,15 @@ public abstract class Conference implements IConferenceable { } mConferenceableConnections.clear(); } + + @Override + public String toString() { + return String.format(Locale.US, + "[State: %s,Capabilites: %s, VideoState: %s, VideoProvider: %s, ThisObject %s]", + Connection.stateToString(mState), + Call.Details.capabilitiesToString(mConnectionCapabilities), + getVideoState(), + getVideoProvider(), + super.toString()); + } } |
