diff options
author | Tyler Gunn <tgunn@google.com> | 2016-03-14 15:18:07 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2016-03-14 23:26:34 +0000 |
commit | 876dbfb4767da4a2ba5459d5b78fb6eb55e4516f (patch) | |
tree | 163ef4c1fc05a90706df68b25d02ac51489bd6ec /telecomm/java/android/telecom/ConnectionService.java | |
parent | 791a1546484f643e98a4bb245c3b7c302b894f78 (diff) |
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
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionService.java')
-rw-r--r-- | telecomm/java/android/telecom/ConnectionService.java | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 5b62e03350b1..d18b31725aaa 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -103,6 +103,8 @@ public abstract class ConnectionService extends Service { private static final int MSG_SWAP_CONFERENCE = 19; private static final int MSG_REJECT_WITH_MESSAGE = 20; private static final int MSG_SILENCE = 21; + private static final int MSG_PULL_EXTERNAL_CALL = 22; + private static final int MSG_SEND_CALL_EVENT = 23; private static Connection sNullConnection; @@ -245,6 +247,20 @@ public abstract class ConnectionService extends Service { args.argi1 = proceed ? 1 : 0; mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget(); } + + @Override + public void pullExternalCall(String callId) { + mHandler.obtainMessage(MSG_PULL_EXTERNAL_CALL, callId).sendToTarget(); + } + + @Override + public void sendCallEvent(String callId, String event, Bundle extras) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + args.arg2 = event; + args.arg3 = extras; + mHandler.obtainMessage(MSG_SEND_CALL_EVENT, args).sendToTarget(); + } }; private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -382,6 +398,22 @@ public abstract class ConnectionService extends Service { } break; } + case MSG_PULL_EXTERNAL_CALL: { + pullExternalCall((String) msg.obj); + break; + } + case MSG_SEND_CALL_EVENT: { + SomeArgs args = (SomeArgs) msg.obj; + try { + String callId = (String) args.arg1; + String event = (String) args.arg2; + Bundle extras = (Bundle) args.arg3; + sendCallEvent(callId, event, extras); + } finally { + args.recycle(); + } + break; + } default: break; } @@ -615,10 +647,10 @@ public abstract class ConnectionService extends Service { } @Override - public void onConnectionEvent(Connection connection, String event) { + public void onConnectionEvent(Connection connection, String event, Bundle extras) { String id = mIdByConnection.get(connection); if (id != null) { - mAdapter.onConnectionEvent(id, event); + mAdapter.onConnectionEvent(id, event, extras); } } }; @@ -864,6 +896,39 @@ public abstract class ConnectionService extends Service { } } + /** + * Notifies a {@link Connection} of a request to pull an external call. + * + * See {@link Call#pullExternalCall()}. + * + * @param callId The ID of the call to pull. + */ + private void pullExternalCall(String callId) { + Log.d(this, "pullExternalCall(%s)", callId); + Connection connection = findConnectionForAction(callId, "pullExternalCall"); + if (connection != null) { + connection.onPullExternalCall(); + } + } + + /** + * Notifies a {@link Connection} of a call event. + * + * See {@link Call#sendCallEvent(String, Bundle)}. + * + * @param callId The ID of the call receiving the event. + * @param event The event. + * @param extras Extras associated with the event. + */ + private void sendCallEvent(String callId, String event, Bundle extras) { + Log.d(this, "sendCallEvent(%s, %s)", callId, event); + Connection connection = findConnectionForAction(callId, "sendCallEvent"); + if (connection != null) { + connection.onCallEvent(event, extras); + } + + } + private void onPostDialContinue(String callId, boolean proceed) { Log.d(this, "onPostDialContinue(%s)", callId); findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed); |