DO NOT MERGE Add new ConnectionEvent API (hide) to send a notification to Telecom

Connection event used to inform Telecom that it should play or stop
the on hold tone. This is used to play or stop a tone when the peer
puts the current call on hold.

BUG=25357778
Change-Id: I2669f8f5062449784a712b9dd28e576326fcc679
This commit is contained in:
Tyler Gunn
2016-03-17 18:34:27 -07:00
parent 0048acfc16
commit 7904a972e1
7 changed files with 108 additions and 0 deletions

View File

@@ -209,6 +209,15 @@ public final class RemoteConnection {
* @param extras The extras containing other information associated with the connection.
*/
public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {}
/**
* Handles a connection event propagated to this {@link RemoteConnection}.
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param event The connection event.
* @hide
*/
public void onConnectionEvent(RemoteConnection connection, String event) {}
}
/**
@@ -1291,6 +1300,20 @@ public final class RemoteConnection {
}
}
/** @hide */
void onConnectionEvent(final String event) {
for (CallbackRecord record : mCallbackRecords) {
final RemoteConnection connection = this;
final Callback callback = record.getCallback();
record.getHandler().post(new Runnable() {
@Override
public void run() {
callback.onConnectionEvent(connection, event);
}
});
}
}
/**
* Create a RemoteConnection represents a failure, and which will be in
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost