diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 9ced4aeda2a36..97d599b9a9cd1 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -339,6 +339,7 @@ public abstract class Connection implements IConferenceable { public void onConferenceParticipantsChanged(Connection c, List participants) {} public void onConferenceStarted() {} + public void onConferenceMergeFailed(Connection c) {} } public static abstract class VideoProvider { @@ -1546,6 +1547,17 @@ public abstract class Connection implements IConferenceable { mConferenceables.clear(); } + /** + * Notifies listeners that the merge request failed. + * + * @hide + */ + protected final void notifyConferenceMergeFailed() { + for (Listener l : mListeners) { + l.onConferenceMergeFailed(this); + } + } + /** * Notifies listeners of a change to conference participant(s). * diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index aad7fcba4797c..984382410e3b0 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -562,6 +562,14 @@ public abstract class ConnectionService extends Service { mAdapter.setIsConferenced(id, conferenceId); } } + + @Override + public void onConferenceMergeFailed(Connection connection) { + String id = mIdByConnection.get(connection); + if (id != null) { + mAdapter.onConferenceMergeFailed(id); + } + } }; /** {@inheritDoc} */ diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index d026a28f1742b..a87dbe725d632 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -202,6 +202,21 @@ final class ConnectionServiceAdapter implements DeathRecipient { } } + /** + * Indicates that the merge request on this call has failed. + * + * @param callId The unique ID of the call being conferenced. + */ + void onConferenceMergeFailed(String callId) { + for (IConnectionServiceAdapter adapter : mAdapters) { + try { + Log.d(this, "merge failed for call %s", callId); + adapter.setConferenceMergeFailed(callId); + } catch (RemoteException ignored) { + } + } + } + /** * Indicates that the call no longer exists. Can be used with either a call or a conference * call. diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java index 429f296e34d77..db815ba7a86f7 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java @@ -59,6 +59,7 @@ final class ConnectionServiceAdapterServant { private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20; private static final int MSG_ADD_EXISTING_CONNECTION = 21; private static final int MSG_ON_POST_DIAL_CHAR = 22; + private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; private final IConnectionServiceAdapter mDelegate; @@ -220,6 +221,15 @@ final class ConnectionServiceAdapterServant { } break; } + case MSG_SET_CONFERENCE_MERGE_FAILED: { + SomeArgs args = (SomeArgs) msg.obj; + try { + mDelegate.setConferenceMergeFailed((String) args.arg1); + } finally { + args.recycle(); + } + break; + } } } }; @@ -279,6 +289,13 @@ final class ConnectionServiceAdapterServant { .sendToTarget(); } + @Override + public void setConferenceMergeFailed(String callId) { + SomeArgs args = SomeArgs.obtain(); + args.arg1 = callId; + mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget(); + } + @Override public void setIsConferenced(String callId, String conferenceCallId) { SomeArgs args = SomeArgs.obtain(); diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java index 43a92cb576e72..5319793f396db 100644 --- a/telecomm/java/android/telecom/RemoteConnectionService.java +++ b/telecomm/java/android/telecom/RemoteConnectionService.java @@ -170,6 +170,13 @@ final class RemoteConnectionService { } } + @Override + public void setConferenceMergeFailed(String callId) { + // Nothing to do here. + // The event has already been handled and there is no state to update + // in the underlying connection or conference objects + } + @Override public void addConferenceCall( final String callId, diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl index 7e7e9cc4a904d..67e2edbddd01a 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl @@ -56,6 +56,8 @@ oneway interface IConnectionServiceAdapter { void setIsConferenced(String callId, String conferenceCallId); + void setConferenceMergeFailed(String callId); + void addConferenceCall(String callId, in ParcelableConference conference); void removeCall(String callId);