Add API support for multi-endpoint.

This CL includes changes required to support multi-endpoint (see the
design doc linked off the bug).

Main changes include:
- support for indicating if a call/connection is "external" to the device.
- support for indicating if an external call can be pulled from the
remote device to the local device.
- API used to initiate a pull of a call external to the current device to
the current device.
- Made the "connection event" API public (was previously @hide); this will
be used to support passing some error events involving pulling calls to
the incall ui.
- Added new InCallService metadata which will be used to determine if an
InCallService wants to be informed of external calls.
- New disconnect causes which will be used to expose the fact that a
multi-endpoint call was answered elsewhere and that a call ended because
it was pulled to another device.
- New call log call types to indicate if calls were answered elsewhere
or pulled to another device.

Bug: 27458894
Change-Id: I423f64ff965b5e50194635a51868c327782db2a1
This commit is contained in:
Tyler Gunn
2016-03-14 15:18:07 -07:00
parent 791a154648
commit 876dbfb476
20 changed files with 493 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import android.app.Service;
import android.content.Intent;
import android.hardware.camera2.CameraManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -74,6 +75,7 @@ public abstract class InCallService extends Service {
private static final int MSG_BRING_TO_FOREGROUND = 6;
private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7;
private static final int MSG_SILENCE_RINGER = 8;
private static final int MSG_ON_CONNECTION_EVENT = 9;
/** Default Handler used to consolidate binder method calls onto a single thread. */
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -118,6 +120,18 @@ public abstract class InCallService extends Service {
case MSG_SILENCE_RINGER:
mPhone.internalSilenceRinger();
break;
case MSG_ON_CONNECTION_EVENT: {
SomeArgs args = (SomeArgs) msg.obj;
try {
String callId = (String) args.arg1;
String event = (String) args.arg2;
Bundle extras = (Bundle) args.arg3;
mPhone.internalOnConnectionEvent(callId, event, extras);
} finally {
args.recycle();
}
break;
}
default:
break;
}
@@ -174,6 +188,15 @@ public abstract class InCallService extends Service {
public void silenceRinger() {
mHandler.obtainMessage(MSG_SILENCE_RINGER).sendToTarget();
}
@Override
public void onConnectionEvent(String callId, String event, Bundle extras) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = event;
args.arg3 = extras;
mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
}
}
private Phone.Listener mPhoneListener = new Phone.Listener() {
@@ -425,6 +448,19 @@ public abstract class InCallService extends Service {
public void onSilenceRinger() {
}
/**
* Called when a {@link Call} has received a connection event issued by the
* {@link ConnectionService}.
* <p>
* See {@link Connection#sendConnectionEvent(String, Bundle)}.
*
* @param call The call the event is associated with.
* @param event The event.
* @param extras Any associated extras.
*/
public void onConnectionEvent(Call call, String event, Bundle extras) {
}
/**
* Used to issue commands to the {@link Connection.VideoProvider} associated with a
* {@link Call}.