Merge "Added API methods for the CallVideoProvider. Cleaned up comments in CallVideoClient to match."
This commit is contained in:
@@ -27569,7 +27569,16 @@ package android.telecomm {
|
||||
|
||||
public abstract class CallVideoProvider {
|
||||
ctor protected CallVideoProvider();
|
||||
method public abstract void requestCallDataUsage();
|
||||
method public abstract void requestCameraCapabilities();
|
||||
method public abstract void sendSessionModifyRequest(android.telecomm.VideoCallProfile);
|
||||
method public abstract void sendSessionModifyResponse(android.telecomm.VideoCallProfile);
|
||||
method public abstract void setCamera(java.lang.String);
|
||||
method public abstract void setDeviceOrientation(int);
|
||||
method public abstract void setDisplaySurface(android.view.Surface);
|
||||
method public abstract void setPauseImage(java.lang.String);
|
||||
method public abstract void setPreviewSurface(android.view.Surface);
|
||||
method public abstract void setZoom(float);
|
||||
}
|
||||
|
||||
public class CallVideoProviderWrapper implements android.os.IBinder.DeathRecipient {
|
||||
|
||||
@@ -85,10 +85,10 @@ public abstract class CallVideoClient {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
try {
|
||||
int status = (int) args.arg1;
|
||||
VideoCallProfile requestedProfile = (VideoCallProfile) args.arg2;
|
||||
VideoCallProfile requestProfile = (VideoCallProfile) args.arg2;
|
||||
VideoCallProfile responseProfile = (VideoCallProfile) args.arg3;
|
||||
|
||||
onReceiveSessionModifyResponse(status, requestedProfile,
|
||||
onReceiveSessionModifyResponse(status, requestProfile,
|
||||
responseProfile);
|
||||
} finally {
|
||||
args.recycle();
|
||||
@@ -133,10 +133,10 @@ public abstract class CallVideoClient {
|
||||
|
||||
@Override
|
||||
public void onReceiveSessionModifyResponse(int status,
|
||||
VideoCallProfile requestedProfile, VideoCallProfile responseProfile) {
|
||||
VideoCallProfile requestProfile, VideoCallProfile responseProfile) {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = status;
|
||||
args.arg2 = requestedProfile;
|
||||
args.arg2 = requestProfile;
|
||||
args.arg3 = responseProfile;
|
||||
mHandler.obtainMessage(MSG_ON_RECEIVE_SESSION_MODIFY_RESPONSE, args).sendToTarget();
|
||||
}
|
||||
@@ -183,29 +183,31 @@ public abstract class CallVideoClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an incoming request is received from a remote device to modify the current
|
||||
* video call profile. This could be, for example, a remote request to upgrade from an
|
||||
* audio-only call to a video call.
|
||||
* Called when a session modification request is received from the remote device.
|
||||
* The remote request is sent via {@link CallVideoProvider#sendSessionModifyRequest}.
|
||||
* 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 CallVideoProvider#sendSessionModifyResponse} to indicate
|
||||
* the video settings the user has agreed to.
|
||||
*
|
||||
* @param videoCallProfile The requested video call profile.
|
||||
*/
|
||||
public abstract void onReceiveSessionModifyRequest(VideoCallProfile videoCallProfile);
|
||||
|
||||
/**
|
||||
* Called when a response is received to a previously sent request to modify the video call
|
||||
* profile. For example, if a request was previously sent to the other party to upgrade from an
|
||||
* audio-only call to a video call, the other party responds to indicate which profile
|
||||
* changes were accepted.
|
||||
* Called when a response to a session modification request is received from the remote device.
|
||||
* The remote InCall UI sends the response using
|
||||
* {@link CallVideoProvider#sendSessionModifyResponse}.
|
||||
*
|
||||
* @param status Status of the session modify request. Valid values are
|
||||
* {@link CallVideoClient#SESSION_MODIFY_REQUEST_SUCCESS},
|
||||
* {@link CallVideoClient#SESSION_MODIFY_REQUEST_FAIL},
|
||||
* {@link CallVideoClient#SESSION_MODIFY_REQUEST_INVALID}
|
||||
* @param requestedProfile The original request which was sent to the remote device.
|
||||
* @param requestProfile The original request which was sent to the remote device.
|
||||
* @param responseProfile The actual profile changes made by the remote device.
|
||||
*/
|
||||
public abstract void onReceiveSessionModifyResponse(int status,
|
||||
VideoCallProfile requestedProfile, VideoCallProfile responseProfile);
|
||||
VideoCallProfile requestProfile, VideoCallProfile responseProfile);
|
||||
|
||||
/**
|
||||
* Handles events related to the current session which the client may wish to handle. These
|
||||
|
||||
@@ -16,17 +16,23 @@
|
||||
|
||||
package android.telecomm;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.view.Surface;
|
||||
|
||||
import com.android.internal.telecomm.ICallVideoProvider;
|
||||
|
||||
public abstract class CallVideoProvider {
|
||||
private static final int MSG_SET_CAMERA = 1;
|
||||
private static final int MSG_SET_PREVIEW_SURFACE = 2;
|
||||
private static final int MSG_SET_DISPLAY_SURFACE = 3;
|
||||
private static final int MSG_SET_DEVICE_ORIENTATION = 4;
|
||||
private static final int MSG_SET_ZOOM = 5;
|
||||
private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 6;
|
||||
private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 7;
|
||||
private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 8;
|
||||
private static final int MSG_REQUEST_CALL_DATA_USAGE = 9;
|
||||
private static final int MSG_SET_PAUSE_IMAGE = 10;
|
||||
|
||||
/**
|
||||
* Default handler used to consolidate binder method calls onto a single thread.
|
||||
@@ -37,6 +43,34 @@ public abstract class CallVideoProvider {
|
||||
switch (msg.what) {
|
||||
case MSG_SET_CAMERA:
|
||||
setCamera((String) msg.obj);
|
||||
break;
|
||||
case MSG_SET_PREVIEW_SURFACE:
|
||||
setPreviewSurface((Surface) msg.obj);
|
||||
break;
|
||||
case MSG_SET_DISPLAY_SURFACE:
|
||||
setDisplaySurface((Surface) msg.obj);
|
||||
break;
|
||||
case MSG_SET_DEVICE_ORIENTATION:
|
||||
setDeviceOrientation(msg.arg1);
|
||||
break;
|
||||
case MSG_SET_ZOOM:
|
||||
setZoom((Float) msg.obj);
|
||||
break;
|
||||
case MSG_SEND_SESSION_MODIFY_REQUEST:
|
||||
sendSessionModifyRequest((VideoCallProfile) msg.obj);
|
||||
break;
|
||||
case MSG_SEND_SESSION_MODIFY_RESPONSE:
|
||||
sendSessionModifyResponse((VideoCallProfile) msg.obj);
|
||||
break;
|
||||
case MSG_REQUEST_CAMERA_CAPABILITIES:
|
||||
requestCameraCapabilities();
|
||||
break;
|
||||
case MSG_REQUEST_CALL_DATA_USAGE:
|
||||
requestCallDataUsage();
|
||||
break;
|
||||
case MSG_SET_PAUSE_IMAGE:
|
||||
setPauseImage((String) msg.obj);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -50,6 +84,44 @@ public abstract class CallVideoProvider {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private final CallVideoProviderHandler mMessageHandler = new CallVideoProviderHandler();
|
||||
@@ -73,4 +145,80 @@ public abstract class CallVideoProvider {
|
||||
* @param cameraId The id of the camera.
|
||||
*/
|
||||
public abstract void setCamera(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 setPreviewSurface(Surface surface);
|
||||
|
||||
/**
|
||||
* Sets the surface to be used for displaying the video received from the remote device.
|
||||
*
|
||||
* @param surface The surface.
|
||||
*/
|
||||
public abstract void setDisplaySurface(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 setDeviceOrientation(int rotation);
|
||||
|
||||
/**
|
||||
* Sets camera zoom ratio.
|
||||
*
|
||||
* @param value The camera zoom ratio.
|
||||
*/
|
||||
public abstract void setZoom(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 CallVideoClient#onReceiveSessionModifyRequest}.
|
||||
* 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 sendSessionModifyRequest(VideoCallProfile requestProfile);
|
||||
|
||||
/**
|
||||
* 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 CallVideoClient#onReceiveSessionModifyRequest}.
|
||||
* The response is handled on the remove device by
|
||||
* {@link CallVideoClient#onReceiveSessionModifyResponse}.
|
||||
*
|
||||
* @param responseProfile The response call video properties.
|
||||
*/
|
||||
public abstract void sendSessionModifyResponse(VideoCallProfile responseProfile);
|
||||
|
||||
/**
|
||||
* Issues a request to the video provider to retrieve the camera capabilities.
|
||||
* Camera capabilities are reported back to the caller via
|
||||
* {@link CallVideoClient#onCameraCapabilitiesChange(CallCameraCapabilities)}.
|
||||
*/
|
||||
public abstract void requestCameraCapabilities();
|
||||
|
||||
/**
|
||||
* 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 CallVideoClient#onUpdateCallDataUsage}.
|
||||
*/
|
||||
public abstract void requestCallDataUsage();
|
||||
|
||||
/**
|
||||
* 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 setPauseImage(String uri);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.internal.telecomm;
|
||||
|
||||
import android.view.Surface;
|
||||
import android.telecomm.VideoCallProfile;
|
||||
|
||||
/**
|
||||
* Internal remote interface for a call video provider.
|
||||
* @see android.telecomm.CallVideoProvider
|
||||
@@ -23,4 +26,22 @@ package com.android.internal.telecomm;
|
||||
*/
|
||||
oneway interface ICallVideoProvider {
|
||||
void setCamera(String cameraId);
|
||||
}
|
||||
|
||||
void setPreviewSurface(in Surface surface);
|
||||
|
||||
void setDisplaySurface(in Surface surface);
|
||||
|
||||
void setDeviceOrientation(int rotation);
|
||||
|
||||
void setZoom(float value);
|
||||
|
||||
void sendSessionModifyRequest(in VideoCallProfile reqProfile);
|
||||
|
||||
void sendSessionModifyResponse(in VideoCallProfile responseProfile);
|
||||
|
||||
void requestCameraCapabilities();
|
||||
|
||||
void requestCallDataUsage();
|
||||
|
||||
void setPauseImage(String uri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user