diff --git a/api/current.txt b/api/current.txt
index 713b8d5..b1b1708 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28613,7 +28613,7 @@
     method public final android.telecomm.Connection getParentConnection();
     method public final int getState();
     method public final android.telecomm.StatusHints getStatusHints();
-    method public final android.telecomm.VideoCallProvider getVideoCallProvider();
+    method public final android.telecomm.ConnectionService.VideoCallProvider getVideoCallProvider();
     method public final int getVideoState();
     method public final boolean isConferenceConnection();
     method public final boolean isRequestingRingback();
@@ -28650,7 +28650,7 @@
     method public final void setRinging();
     method public final void setSignal(android.os.Bundle);
     method public final void setStatusHints(android.telecomm.StatusHints);
-    method public final void setVideoCallProvider(android.telecomm.VideoCallProvider);
+    method public final void setVideoCallProvider(android.telecomm.ConnectionService.VideoCallProvider);
     method public final void setVideoState(int);
     method public final void startActivityFromInCall(android.app.PendingIntent);
     method public static java.lang.String stateToString(int);
@@ -28702,6 +28702,26 @@
     method public abstract void onSuccess(android.telecomm.ConnectionRequest, CONNECTION);
   }
 
+  public static abstract class ConnectionService.VideoCallProvider {
+    ctor public ConnectionService.VideoCallProvider();
+    method public void changeCallDataUsage(int);
+    method public void changeCameraCapabilities(android.telecomm.CallCameraCapabilities);
+    method public void changePeerDimensions(int, int);
+    method public void handleCallSessionEvent(int);
+    method public abstract void onRequestCallDataUsage();
+    method public abstract void onRequestCameraCapabilities();
+    method public abstract void onSendSessionModifyRequest(android.telecomm.VideoCallProfile);
+    method public abstract void onSendSessionModifyResponse(android.telecomm.VideoCallProfile);
+    method public abstract void onSetCamera(java.lang.String);
+    method public abstract void onSetDeviceOrientation(int);
+    method public abstract void onSetDisplaySurface(android.view.Surface);
+    method public abstract void onSetPauseImage(java.lang.String);
+    method public abstract void onSetPreviewSurface(android.view.Surface);
+    method public abstract void onSetZoom(float);
+    method public void receiveSessionModifyRequest(android.telecomm.VideoCallProfile);
+    method public void receiveSessionModifyResponse(int, android.telecomm.VideoCallProfile, android.telecomm.VideoCallProfile);
+  }
+
   public class GatewayInfo implements android.os.Parcelable {
     method public int describeContents();
     method public android.net.Uri getGatewayHandle();
@@ -28934,26 +28954,6 @@
     field public static final int VIDEO_STATE_TX_ENABLED = 1; // 0x1
   }
 
-  public abstract class VideoCallProvider {
-    ctor public VideoCallProvider();
-    method public void changeCallDataUsage(int);
-    method public void changeCameraCapabilities(android.telecomm.CallCameraCapabilities);
-    method public void changePeerDimensions(int, int);
-    method public void handleCallSessionEvent(int);
-    method public abstract void onRequestCallDataUsage();
-    method public abstract void onRequestCameraCapabilities();
-    method public abstract void onSendSessionModifyRequest(android.telecomm.VideoCallProfile);
-    method public abstract void onSendSessionModifyResponse(android.telecomm.VideoCallProfile);
-    method public abstract void onSetCamera(java.lang.String);
-    method public abstract void onSetDeviceOrientation(int);
-    method public abstract void onSetDisplaySurface(android.view.Surface);
-    method public abstract void onSetPauseImage(java.lang.String);
-    method public abstract void onSetPreviewSurface(android.view.Surface);
-    method public abstract void onSetZoom(float);
-    method public void receiveSessionModifyRequest(android.telecomm.VideoCallProfile);
-    method public void receiveSessionModifyResponse(int, android.telecomm.VideoCallProfile, android.telecomm.VideoCallProfile);
-  }
-
 }
 
 package android.telephony {
@@ -39777,8 +39777,8 @@
     method public void setLogo(android.graphics.drawable.Drawable);
     method public void setLogoDescription(int);
     method public void setLogoDescription(java.lang.CharSequence);
-    method public void setNavigationContentDescription(java.lang.CharSequence);
     method public void setNavigationContentDescription(int);
+    method public void setNavigationContentDescription(java.lang.CharSequence);
     method public void setNavigationIcon(int);
     method public void setNavigationIcon(android.graphics.drawable.Drawable);
     method public void setNavigationOnClickListener(android.view.View.OnClickListener);
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index 6043232..322dafe 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -44,7 +44,8 @@
         public void onDestroyed(Connection c) {}
         public void onCallCapabilitiesChanged(Connection c, int callCapabilities) {}
         public void onParentConnectionChanged(Connection c, Connection parent) {}
-        public void onVideoCallProviderChanged(Connection c, VideoCallProvider videoCallProvider) {}
+        public void onVideoCallProviderChanged(
+                Connection c, ConnectionService.VideoCallProvider videoCallProvider) {}
         public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {}
         public void onStatusHintsChanged(Connection c, StatusHints statusHints) {}
         public void onStartActivityFromInCall(Connection c, PendingIntent intent) {}
@@ -78,7 +79,7 @@
     private boolean mRequestingRingback = false;
     private int mCallCapabilities;
     private Connection mParentConnection;
-    private VideoCallProvider mVideoCallProvider;
+    private ConnectionService.VideoCallProvider mVideoCallProvider;
     private boolean mAudioModeIsVoip;
     private StatusHints mStatusHints;
     private int mVideoState;
@@ -417,14 +418,14 @@
      * Sets the video call provider.
      * @param videoCallProvider The video call provider.
      */
-    public final void setVideoCallProvider(VideoCallProvider videoCallProvider) {
+    public final void setVideoCallProvider(ConnectionService.VideoCallProvider videoCallProvider) {
         mVideoCallProvider = videoCallProvider;
         for (Listener l : mListeners) {
             l.onVideoCallProviderChanged(this, videoCallProvider);
         }
     }
 
-    public final VideoCallProvider getVideoCallProvider() {
+    public final ConnectionService.VideoCallProvider getVideoCallProvider() {
         return mVideoCallProvider;
     }
 
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index 51876df..cefa929 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -29,9 +29,14 @@
 import android.os.Looper;
 import android.os.Message;
 import android.telephony.DisconnectCause;
+import android.os.RemoteException;
+import android.view.Surface;
+
 import com.android.internal.os.SomeArgs;
 import com.android.internal.telecomm.IConnectionService;
 import com.android.internal.telecomm.IConnectionServiceAdapter;
+import com.android.internal.telecomm.IVideoCallCallback;
+import com.android.internal.telecomm.IVideoCallProvider;
 import com.android.internal.telecomm.RemoteServiceCallback;
 
 import java.util.Collection;
@@ -758,4 +763,312 @@
         Log.w(this, "%s - Cannot find Connection %s", action, callId);
         return NULL_CONNECTION;
     }
+
+    public static abstract class VideoCallProvider {
+        private static final int MSG_SET_VIDEO_CALL_LISTENER = 1;
+        private static final int MSG_SET_CAMERA = 2;
+        private static final int MSG_SET_PREVIEW_SURFACE = 3;
+        private static final int MSG_SET_DISPLAY_SURFACE = 4;
+        private static final int MSG_SET_DEVICE_ORIENTATION = 5;
+        private static final int MSG_SET_ZOOM = 6;
+        private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7;
+        private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8;
+        private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9;
+        private static final int MSG_REQUEST_CALL_DATA_USAGE = 10;
+        private static final int MSG_SET_PAUSE_IMAGE = 11;
+
+        private final VideoCallProviderHandler mMessageHandler = new VideoCallProviderHandler();
+        private final VideoCallProviderBinder mBinder;
+        private IVideoCallCallback mVideoCallListener;
+
+        /**
+         * Default handler used to consolidate binder method calls onto a single thread.
+         */
+        private final class VideoCallProviderHandler extends Handler {
+            @Override
+            public void handleMessage(Message msg) {
+                switch (msg.what) {
+                    case MSG_SET_VIDEO_CALL_LISTENER:
+                        mVideoCallListener = IVideoCallCallback.Stub.asInterface((IBinder) msg.obj);
+                        break;
+                    case MSG_SET_CAMERA:
+                        onSetCamera((String) msg.obj);
+                        break;
+                    case MSG_SET_PREVIEW_SURFACE:
+                        onSetPreviewSurface((Surface) msg.obj);
+                        break;
+                    case MSG_SET_DISPLAY_SURFACE:
+                        onSetDisplaySurface((Surface) msg.obj);
+                        break;
+                    case MSG_SET_DEVICE_ORIENTATION:
+                        onSetDeviceOrientation(msg.arg1);
+                        break;
+                    case MSG_SET_ZOOM:
+                        onSetZoom((Float) msg.obj);
+                        break;
+                    case MSG_SEND_SESSION_MODIFY_REQUEST:
+                        onSendSessionModifyRequest((VideoCallProfile) msg.obj);
+                        break;
+                    case MSG_SEND_SESSION_MODIFY_RESPONSE:
+                        onSendSessionModifyResponse((VideoCallProfile) msg.obj);
+                        break;
+                    case MSG_REQUEST_CAMERA_CAPABILITIES:
+                        onRequestCameraCapabilities();
+                        break;
+                    case MSG_REQUEST_CALL_DATA_USAGE:
+                        onRequestCallDataUsage();
+                        break;
+                    case MSG_SET_PAUSE_IMAGE:
+                        onSetPauseImage((String) msg.obj);
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        /**
+         * IVideoCallProvider stub implementation.
+         */
+        private final class VideoCallProviderBinder extends IVideoCallProvider.Stub {
+            public void setVideoCallListener(IBinder videoCallListenerBinder) {
+                mMessageHandler.obtainMessage(
+                        MSG_SET_VIDEO_CALL_LISTENER, videoCallListenerBinder).sendToTarget();
+            }
+
+            public void setCamera(String cameraId) {
+                mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget();
+            }
+
+            public void setPreviewSurface(Surface surface) {
+                mMessageHandler.obtainMessage(MSG_SET_PREVIEW_SURFACE, surface).sendToTarget();
+            }
+
+            public void setDisplaySurface(Surface surface) {
+                mMessageHandler.obtainMessage(MSG_SET_DISPLAY_SURFACE, surface).sendToTarget();
+            }
+
+            public void setDeviceOrientation(int rotation) {
+                mMessageHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
+            }
+
+            public void setZoom(float value) {
+                mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget();
+            }
+
+            public void sendSessionModifyRequest(VideoCallProfile requestProfile) {
+                mMessageHandler.obtainMessage(
+                        MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget();
+            }
+
+            public void sendSessionModifyResponse(VideoCallProfile responseProfile) {
+                mMessageHandler.obtainMessage(
+                        MSG_SEND_SESSION_MODIFY_RESPONSE, responseProfile).sendToTarget();
+            }
+
+            public void requestCameraCapabilities() {
+                mMessageHandler.obtainMessage(MSG_REQUEST_CAMERA_CAPABILITIES).sendToTarget();
+            }
+
+            public void requestCallDataUsage() {
+                mMessageHandler.obtainMessage(MSG_REQUEST_CALL_DATA_USAGE).sendToTarget();
+            }
+
+            public void setPauseImage(String uri) {
+                mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget();
+            }
+        }
+
+        public VideoCallProvider() {
+            mBinder = new VideoCallProviderBinder();
+        }
+
+        /**
+         * Returns binder object which can be used across IPC methods.
+         * @hide
+         */
+        public final IVideoCallProvider getInterface() {
+            return mBinder;
+        }
+
+        /**
+         * Sets the camera to be used for video recording in a video call.
+         *
+         * @param cameraId The id of the camera.
+         */
+        public abstract void onSetCamera(String cameraId);
+
+        /**
+         * Sets the surface to be used for displaying a preview of what the user's camera is
+         * currently capturing.  When video transmission is enabled, this is the video signal which is
+         * sent to the remote device.
+         *
+         * @param surface The surface.
+         */
+        public abstract void onSetPreviewSurface(Surface surface);
+
+        /**
+         * Sets the surface to be used for displaying the video received from the remote device.
+         *
+         * @param surface The surface.
+         */
+        public abstract void onSetDisplaySurface(Surface surface);
+
+        /**
+         * Sets the device orientation, in degrees.  Assumes that a standard portrait orientation of the
+         * device is 0 degrees.
+         *
+         * @param rotation The device orientation, in degrees.
+         */
+        public abstract void onSetDeviceOrientation(int rotation);
+
+        /**
+         * Sets camera zoom ratio.
+         *
+         * @param value The camera zoom ratio.
+         */
+        public abstract void onSetZoom(float value);
+
+        /**
+         * Issues a request to modify the properties of the current session.  The request is sent to
+         * the remote device where it it handled by
+         * {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
+         * Some examples of session modification requests: upgrade call from audio to video, downgrade
+         * call from video to audio, pause video.
+         *
+         * @param requestProfile The requested call video properties.
+         */
+        public abstract void onSendSessionModifyRequest(VideoCallProfile requestProfile);
+
+        /**te
+         * Provides a response to a request to change the current call session video
+         * properties.
+         * This is in response to a request the InCall UI has received via
+         * {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
+         * The response is handled on the remove device by
+         * {@link InCallService.VideoCall.Listener#onSessionModifyResponseReceived}.
+         *
+         * @param responseProfile The response call video properties.
+         */
+        public abstract void onSendSessionModifyResponse(VideoCallProfile responseProfile);
+
+        /**
+         * Issues a request to the video provider to retrieve the camera capabilities.
+         * Camera capabilities are reported back to the caller via
+         * {@link InCallService.VideoCall.Listener#onCameraCapabilitiesChanged(CallCameraCapabilities)}.
+         */
+        public abstract void onRequestCameraCapabilities();
+
+        /**
+         * Issues a request to the video telephony framework to retrieve the cumulative data usage for
+         * the current call.  Data usage is reported back to the caller via
+         * {@link InCallService.VideoCall.Listener#onCallDataUsageChanged}.
+         */
+        public abstract void onRequestCallDataUsage();
+
+        /**
+         * Provides the video telephony framework with the URI of an image to be displayed to remote
+         * devices when the video signal is paused.
+         *
+         * @param uri URI of image to display.
+         */
+        public abstract void onSetPauseImage(String uri);
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * @param videoCallProfile The requested video call profile.
+         */
+        public void receiveSessionModifyRequest(VideoCallProfile videoCallProfile) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.receiveSessionModifyRequest(videoCallProfile);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * @param status Status of the session modify request.  Valid values are
+         *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_SUCCESS},
+         *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_FAIL},
+         *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_INVALID}
+         * @param requestedProfile The original request which was sent to the remote device.
+         * @param responseProfile The actual profile changes made by the remote device.
+         */
+        public void receiveSessionModifyResponse(int status,
+                                                 VideoCallProfile requestedProfile, VideoCallProfile responseProfile) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.receiveSessionModifyResponse(
+                            status, requestedProfile, responseProfile);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * Valid values are: {@link InCallService.VideoCall#SESSION_EVENT_RX_PAUSE},
+         * {@link InCallService.VideoCall#SESSION_EVENT_RX_RESUME},
+         * {@link InCallService.VideoCall#SESSION_EVENT_TX_START},
+         * {@link InCallService.VideoCall#SESSION_EVENT_TX_STOP}
+         *
+         * @param event The event.
+         */
+        public void handleCallSessionEvent(int event) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.handleCallSessionEvent(event);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * @param width  The updated peer video width.
+         * @param height The updated peer video height.
+         */
+        public void changePeerDimensions(int width, int height) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.changePeerDimensions(width, height);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * @param dataUsage The updated data usage.
+         */
+        public void changeCallDataUsage(int dataUsage) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.changeCallDataUsage(dataUsage);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+
+        /**
+         * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
+         *
+         * @param callCameraCapabilities The changed camera capabilities.
+         */
+        public void changeCameraCapabilities(CallCameraCapabilities callCameraCapabilities) {
+            if (mVideoCallListener != null) {
+                try {
+                    mVideoCallListener.changeCameraCapabilities(callCameraCapabilities);
+                } catch (RemoteException ignored) {
+                }
+            }
+        }
+    }
 }
diff --git a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
index 8f91e72..ea61362 100644
--- a/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecomm/ConnectionServiceAdapter.java
@@ -275,7 +275,8 @@
      * @param callId The unique ID of the call to set with the given call video provider.
      * @param videoCallProvider The call video provider instance to set on the call.
      */
-    void setVideoCallProvider(String callId, VideoCallProvider videoCallProvider) {
+    void setVideoCallProvider(
+            String callId, ConnectionService.VideoCallProvider videoCallProvider) {
         for (IConnectionServiceAdapter adapter : mAdapters) {
             try {
                 adapter.setVideoCallProvider(
diff --git a/telecomm/java/android/telecomm/InCallService.java b/telecomm/java/android/telecomm/InCallService.java
index 38de08e..14b25dc8 100644
--- a/telecomm/java/android/telecomm/InCallService.java
+++ b/telecomm/java/android/telecomm/InCallService.java
@@ -339,12 +339,13 @@
         public static abstract class Listener {
             /**
              * Called when a session modification request is received from the remote device.
-             * The remote request is sent via {@link VideoCallProvider#onSendSessionModifyRequest}.
-             * The InCall UI is responsible for potentially prompting the user whether they wish to
-             * accept the new call profile (e.g. prompt user if they wish to accept an upgrade from
-             * an audio to a video call) and should call
-             * {@link VideoCallProvider#onSendSessionModifyResponse} to indicate the video settings
-             * the user has agreed to.
+             * The remote request is sent via
+             * {@link ConnectionService.VideoCallProvider#onSendSessionModifyRequest}. The InCall UI
+             * is responsible for potentially prompting the user whether they wish to accept the new
+             * call profile (e.g. prompt user if they wish to accept an upgrade from an audio to a
+             * video call) and should call
+             * {@link ConnectionService.VideoCallProvider#onSendSessionModifyResponse} to indicate
+             * the video settings the user has agreed to.
              *
              * @param videoCallProfile The requested video call profile.
              */
@@ -353,7 +354,7 @@
             /**
              * Called when a response to a session modification request is received from the remote
              * device. The remote InCall UI sends the response using
-             * {@link VideoCallProvider#onSendSessionModifyResponse}.
+             * {@link ConnectionService.VideoCallProvider#onSendSessionModifyResponse}.
              *
              * @param status Status of the session modify request.  Valid values are
              *               {@link VideoCall#SESSION_MODIFY_REQUEST_SUCCESS},
diff --git a/telecomm/java/android/telecomm/VideoCallImpl.java b/telecomm/java/android/telecomm/VideoCallImpl.java
index 3e538cb..c32bcd2 100644
--- a/telecomm/java/android/telecomm/VideoCallImpl.java
+++ b/telecomm/java/android/telecomm/VideoCallImpl.java
@@ -30,8 +30,8 @@
 
 /**
  * Implementation of a Video Call, which allows InCallUi to communicate commands to the underlying
- * {@link VideoCallProvider}, and direct callbacks from the {@link VideoCallProvider} to the
- * appropriate {@link VideoCall.Listener}.
+ * {@link ConnectionService.VideoCallProvider}, and direct callbacks from the
+ * {@link ConnectionService.VideoCallProvider} to the appropriate {@link VideoCall.Listener}.
  */
 public class VideoCallImpl extends VideoCall {
     private static final int MSG_RECEIVE_SESSION_MODIFY_REQUEST = 1;
diff --git a/telecomm/java/android/telecomm/VideoCallProvider.java b/telecomm/java/android/telecomm/VideoCallProvider.java
deleted file mode 100644
index de0126d..0000000
--- a/telecomm/java/android/telecomm/VideoCallProvider.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.telecomm;
-
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.RemoteException;
-import android.view.Surface;
-
-import com.android.internal.telecomm.IVideoCallCallback;
-import com.android.internal.telecomm.IVideoCallProvider;
-
-public abstract class VideoCallProvider {
-    private static final int MSG_SET_VIDEO_CALL_LISTENER = 1;
-    private static final int MSG_SET_CAMERA = 2;
-    private static final int MSG_SET_PREVIEW_SURFACE = 3;
-    private static final int MSG_SET_DISPLAY_SURFACE = 4;
-    private static final int MSG_SET_DEVICE_ORIENTATION = 5;
-    private static final int MSG_SET_ZOOM = 6;
-    private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7;
-    private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8;
-    private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9;
-    private static final int MSG_REQUEST_CALL_DATA_USAGE = 10;
-    private static final int MSG_SET_PAUSE_IMAGE = 11;
-
-    private final VideoCallProviderHandler mMessageHandler = new VideoCallProviderHandler();
-    private final VideoCallProviderBinder mBinder;
-    private IVideoCallCallback mVideoCallListener;
-
-    /**
-     * Default handler used to consolidate binder method calls onto a single thread.
-     */
-    private final class VideoCallProviderHandler extends Handler {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MSG_SET_VIDEO_CALL_LISTENER:
-                    mVideoCallListener = IVideoCallCallback.Stub.asInterface((IBinder) msg.obj);
-                    break;
-                case MSG_SET_CAMERA:
-                    onSetCamera((String) msg.obj);
-                    break;
-                case MSG_SET_PREVIEW_SURFACE:
-                    onSetPreviewSurface((Surface) msg.obj);
-                    break;
-                case MSG_SET_DISPLAY_SURFACE:
-                    onSetDisplaySurface((Surface) msg.obj);
-                    break;
-                case MSG_SET_DEVICE_ORIENTATION:
-                    onSetDeviceOrientation(msg.arg1);
-                    break;
-                case MSG_SET_ZOOM:
-                    onSetZoom((Float) msg.obj);
-                    break;
-                case MSG_SEND_SESSION_MODIFY_REQUEST:
-                    onSendSessionModifyRequest((VideoCallProfile) msg.obj);
-                    break;
-                case MSG_SEND_SESSION_MODIFY_RESPONSE:
-                    onSendSessionModifyResponse((VideoCallProfile) msg.obj);
-                    break;
-                case MSG_REQUEST_CAMERA_CAPABILITIES:
-                    onRequestCameraCapabilities();
-                    break;
-                case MSG_REQUEST_CALL_DATA_USAGE:
-                    onRequestCallDataUsage();
-                    break;
-                case MSG_SET_PAUSE_IMAGE:
-                    onSetPauseImage((String) msg.obj);
-                    break;
-                default:
-                    break;
-            }
-        }
-    }
-
-    /**
-     * IVideoCallProvider stub implementation.
-     */
-    private final class VideoCallProviderBinder extends IVideoCallProvider.Stub {
-        public void setVideoCallListener(IBinder videoCallListenerBinder) {
-            mMessageHandler.obtainMessage(
-                    MSG_SET_VIDEO_CALL_LISTENER, videoCallListenerBinder).sendToTarget();
-        }
-
-        public void setCamera(String cameraId) {
-            mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget();
-        }
-
-        public void setPreviewSurface(Surface surface) {
-            mMessageHandler.obtainMessage(MSG_SET_PREVIEW_SURFACE, surface).sendToTarget();
-        }
-
-        public void setDisplaySurface(Surface surface) {
-            mMessageHandler.obtainMessage(MSG_SET_DISPLAY_SURFACE, surface).sendToTarget();
-        }
-
-        public void setDeviceOrientation(int rotation) {
-            mMessageHandler.obtainMessage(MSG_SET_DEVICE_ORIENTATION, rotation).sendToTarget();
-        }
-
-        public void setZoom(float value) {
-            mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget();
-        }
-
-        public void sendSessionModifyRequest(VideoCallProfile requestProfile) {
-            mMessageHandler.obtainMessage(
-                    MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget();
-        }
-
-        public void sendSessionModifyResponse(VideoCallProfile responseProfile) {
-            mMessageHandler.obtainMessage(
-                    MSG_SEND_SESSION_MODIFY_RESPONSE, responseProfile).sendToTarget();
-        }
-
-        public void requestCameraCapabilities() {
-            mMessageHandler.obtainMessage(MSG_REQUEST_CAMERA_CAPABILITIES).sendToTarget();
-        }
-
-        public void requestCallDataUsage() {
-            mMessageHandler.obtainMessage(MSG_REQUEST_CALL_DATA_USAGE).sendToTarget();
-        }
-
-        public void setPauseImage(String uri) {
-            mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget();
-        }
-    }
-
-    public VideoCallProvider() {
-        mBinder = new VideoCallProviderBinder();
-    }
-
-    /**
-     * Returns binder object which can be used across IPC methods.
-     * @hide
-     */
-    public final IVideoCallProvider getInterface() {
-        return mBinder;
-    }
-
-    /**
-     * Sets the camera to be used for video recording in a video call.
-     *
-     * @param cameraId The id of the camera.
-     */
-    public abstract void onSetCamera(String cameraId);
-
-    /**
-     * Sets the surface to be used for displaying a preview of what the user's camera is
-     * currently capturing.  When video transmission is enabled, this is the video signal which is
-     * sent to the remote device.
-     *
-     * @param surface The surface.
-     */
-    public abstract void onSetPreviewSurface(Surface surface);
-
-    /**
-     * Sets the surface to be used for displaying the video received from the remote device.
-     *
-     * @param surface The surface.
-     */
-    public abstract void onSetDisplaySurface(Surface surface);
-
-    /**
-     * Sets the device orientation, in degrees.  Assumes that a standard portrait orientation of the
-     * device is 0 degrees.
-     *
-     * @param rotation The device orientation, in degrees.
-     */
-    public abstract void onSetDeviceOrientation(int rotation);
-
-    /**
-     * Sets camera zoom ratio.
-     *
-     * @param value The camera zoom ratio.
-     */
-    public abstract void onSetZoom(float value);
-
-    /**
-     * Issues a request to modify the properties of the current session.  The request is sent to
-     * the remote device where it it handled by
-     * {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
-     * Some examples of session modification requests: upgrade call from audio to video, downgrade
-     * call from video to audio, pause video.
-     *
-     * @param requestProfile The requested call video properties.
-     */
-    public abstract void onSendSessionModifyRequest(VideoCallProfile requestProfile);
-
-    /**te
-     * Provides a response to a request to change the current call session video
-     * properties.
-     * This is in response to a request the InCall UI has received via
-     * {@link InCallService.VideoCall.Listener#onSessionModifyRequestReceived}.
-     * The response is handled on the remove device by
-     * {@link InCallService.VideoCall.Listener#onSessionModifyResponseReceived}.
-     *
-     * @param responseProfile The response call video properties.
-     */
-    public abstract void onSendSessionModifyResponse(VideoCallProfile responseProfile);
-
-    /**
-     * Issues a request to the video provider to retrieve the camera capabilities.
-     * Camera capabilities are reported back to the caller via
-     * {@link InCallService.VideoCall.Listener#onCameraCapabilitiesChanged(CallCameraCapabilities)}.
-     */
-    public abstract void onRequestCameraCapabilities();
-
-    /**
-     * Issues a request to the video telephony framework to retrieve the cumulative data usage for
-     * the current call.  Data usage is reported back to the caller via
-     * {@link InCallService.VideoCall.Listener#onCallDataUsageChanged}.
-     */
-    public abstract void onRequestCallDataUsage();
-
-    /**
-     * Provides the video telephony framework with the URI of an image to be displayed to remote
-     * devices when the video signal is paused.
-     *
-     * @param uri URI of image to display.
-     */
-    public abstract void onSetPauseImage(String uri);
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * @param videoCallProfile The requested video call profile.
-     */
-    public void receiveSessionModifyRequest(VideoCallProfile videoCallProfile) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.receiveSessionModifyRequest(videoCallProfile);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * @param status Status of the session modify request.  Valid values are
-     *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_SUCCESS},
-     *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_FAIL},
-     *               {@link InCallService.VideoCall#SESSION_MODIFY_REQUEST_INVALID}
-     * @param requestedProfile The original request which was sent to the remote device.
-     * @param responseProfile The actual profile changes made by the remote device.
-     */
-    public void receiveSessionModifyResponse(int status,
-            VideoCallProfile requestedProfile, VideoCallProfile responseProfile) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.receiveSessionModifyResponse(
-                    status, requestedProfile, responseProfile);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * Valid values are: {@link InCallService.VideoCall#SESSION_EVENT_RX_PAUSE},
-     * {@link InCallService.VideoCall#SESSION_EVENT_RX_RESUME},
-     * {@link InCallService.VideoCall#SESSION_EVENT_TX_START},
-     * {@link InCallService.VideoCall#SESSION_EVENT_TX_STOP}
-     *
-     * @param event The event.
-     */
-    public void handleCallSessionEvent(int event) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.handleCallSessionEvent(event);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * @param width  The updated peer video width.
-     * @param height The updated peer video height.
-     */
-    public void changePeerDimensions(int width, int height) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.changePeerDimensions(width, height);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * @param dataUsage The updated data usage.
-     */
-    public void changeCallDataUsage(int dataUsage) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.changeCallDataUsage(dataUsage);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-
-    /**
-     * Invokes callback method defined in {@link InCallService.VideoCall.Listener}.
-     *
-     * @param callCameraCapabilities The changed camera capabilities.
-     */
-    public void changeCameraCapabilities(CallCameraCapabilities callCameraCapabilities) {
-        if (mVideoCallListener != null) {
-            try {
-                mVideoCallListener.changeCameraCapabilities(callCameraCapabilities);
-            } catch (RemoteException ignored) {
-            }
-        }
-    }
-}
