diff options
Diffstat (limited to 'telecomm/java/android/telecom/RemoteConnection.java')
| -rw-r--r-- | telecomm/java/android/telecom/RemoteConnection.java | 86 |
1 files changed, 58 insertions, 28 deletions
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 1d6e15c..d62c08e 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -20,8 +20,10 @@ import com.android.internal.telecom.IConnectionService; import com.android.internal.telecom.IVideoCallback; import com.android.internal.telecom.IVideoProvider; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.Uri; +import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; @@ -150,7 +152,6 @@ public final class RemoteConnection { * * @param connection The {@code RemoteConnection} invoking this method. * @param videoState The new video state of the {@code RemoteConnection}. - * @hide */ public void onVideoStateChanged(RemoteConnection connection, int videoState) {} @@ -181,7 +182,6 @@ public final class RemoteConnection { * @param connection The {@code RemoteConnection} invoking this method. * @param videoProvider The new {@code VideoProvider} associated with this * {@code RemoteConnection}. - * @hide */ public void onVideoProviderChanged( RemoteConnection connection, VideoProvider videoProvider) {} @@ -197,23 +197,30 @@ public final class RemoteConnection { public void onConferenceChanged( RemoteConnection connection, RemoteConference conference) {} + + /** + * Handles changes to the {@code RemoteConference} extras. + * + * @param connection The {@code RemoteConnection} invoking this method. + * @param extras The extras containing other information associated with the connection. + */ + public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {} } - /** {@hide} */ public static class VideoProvider { - public abstract static class Listener { - public void onReceiveSessionModifyRequest( + public abstract static class Callback { + public void onSessionModifyRequestReceived( VideoProvider videoProvider, VideoProfile videoProfile) {} - public void onReceiveSessionModifyResponse( + public void onSessionModifyResponseReceived( VideoProvider videoProvider, int status, VideoProfile requestedProfile, VideoProfile responseProfile) {} - public void onHandleCallSessionEvent(VideoProvider videoProvider, int event) {} + public void onCallSessionEvent(VideoProvider videoProvider, int event) {} public void onPeerDimensionsChanged(VideoProvider videoProvider, int width, int height) {} @@ -229,16 +236,16 @@ public final class RemoteConnection { private final IVideoCallback mVideoCallbackDelegate = new IVideoCallback() { @Override public void receiveSessionModifyRequest(VideoProfile videoProfile) { - for (Listener l : mListeners) { - l.onReceiveSessionModifyRequest(VideoProvider.this, videoProfile); + for (Callback l : mCallbacks) { + l.onSessionModifyRequestReceived(VideoProvider.this, videoProfile); } } @Override public void receiveSessionModifyResponse(int status, VideoProfile requestedProfile, VideoProfile responseProfile) { - for (Listener l : mListeners) { - l.onReceiveSessionModifyResponse( + for (Callback l : mCallbacks) { + l.onSessionModifyResponseReceived( VideoProvider.this, status, requestedProfile, @@ -248,21 +255,21 @@ public final class RemoteConnection { @Override public void handleCallSessionEvent(int event) { - for (Listener l : mListeners) { - l.onHandleCallSessionEvent(VideoProvider.this, event); + for (Callback l : mCallbacks) { + l.onCallSessionEvent(VideoProvider.this, event); } } @Override public void changePeerDimensions(int width, int height) { - for (Listener l : mListeners) { + for (Callback l : mCallbacks) { l.onPeerDimensionsChanged(VideoProvider.this, width, height); } } @Override public void changeCallDataUsage(long dataUsage) { - for (Listener l : mListeners) { + for (Callback l : mCallbacks) { l.onCallDataUsageChanged(VideoProvider.this, dataUsage); } } @@ -270,14 +277,14 @@ public final class RemoteConnection { @Override public void changeCameraCapabilities( VideoProfile.CameraCapabilities cameraCapabilities) { - for (Listener l : mListeners) { + for (Callback l : mCallbacks) { l.onCameraCapabilitiesChanged(VideoProvider.this, cameraCapabilities); } } @Override public void changeVideoQuality(int videoQuality) { - for (Listener l : mListeners) { + for (Callback l : mCallbacks) { l.onVideoQualityChanged(VideoProvider.this, videoQuality); } } @@ -298,10 +305,10 @@ public final class RemoteConnection { * load factor before resizing, 1 means we only expect a single thread to * access the map so make only a single shard */ - private final Set<Listener> mListeners = Collections.newSetFromMap( - new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); + private final Set<Callback> mCallbacks = Collections.newSetFromMap( + new ConcurrentHashMap<Callback, Boolean>(8, 0.9f, 1)); - public VideoProvider(IVideoProvider videoProviderBinder) { + VideoProvider(IVideoProvider videoProviderBinder) { mVideoProviderBinder = videoProviderBinder; try { mVideoProviderBinder.addVideoCallback(mVideoCallbackServant.getStub().asBinder()); @@ -309,12 +316,12 @@ public final class RemoteConnection { } } - public void addListener(Listener l) { - mListeners.add(l); + public void registerCallback(Callback l) { + mCallbacks.add(l); } - public void removeListener(Listener l) { - mListeners.remove(l); + public void unregisterCallback(Callback l) { + mCallbacks.remove(l); } public void setCamera(String cameraId) { @@ -415,6 +422,7 @@ public final class RemoteConnection { private String mCallerDisplayName; private int mCallerDisplayNamePresentation; private RemoteConference mConference; + private Bundle mExtras; /** * @hide @@ -597,8 +605,7 @@ public final class RemoteConnection { /** * Obtains the video state of this {@code RemoteConnection}. * - * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}. - * @hide + * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}. */ public int getVideoState() { return mVideoState; @@ -607,20 +614,28 @@ public final class RemoteConnection { /** * Obtains the video provider of this {@code RemoteConnection}. * @return The video provider associated with this {@code RemoteConnection}. - * @hide */ public final VideoProvider getVideoProvider() { return mVideoProvider; } /** + * Obtain the extras associated with this {@code RemoteConnection}. + * + * @return The extras for this connection. + */ + public final Bundle getExtras() { + return mExtras; + } + + /** * Determines whether this {@code RemoteConnection} is requesting ringback. * * @return Whether the {@code RemoteConnection} is requesting that the framework play a * ringback tone on its behalf. */ public boolean isRingbackRequested() { - return false; + return mRingbackRequested; } /** @@ -1097,6 +1112,21 @@ public final class RemoteConnection { } } + /** @hide */ + void setExtras(final Bundle extras) { + mExtras = extras; + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onExtrasChanged(connection, extras); + } + }); + } + } + /** * Create a RemoteConnection represents a failure, and which will be in * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost |
