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-02-16 14:36:20 -08:00
parent d6b6e9c2ef
commit bd1eb1f105
7 changed files with 106 additions and 0 deletions

View File

@@ -297,6 +297,24 @@ public abstract class Connection extends Conferenceable {
*/
public static final String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
/**
* Connection event used to inform Telecom that it should play the on hold tone. This is used
* to play a tone when the peer puts the current call on hold. Sent to Telecom via
* {@link #sendConnectionEvent(String)}.
* @hide
*/
public static final String EVENT_ON_HOLD_TONE_START =
"android.telecom.event.ON_HOLD_TONE_START";
/**
* Connection event used to inform Telecom that it should stop the on hold tone. This is used
* to stop a tone when the peer puts the current call on hold. Sent to Telecom via
* {@link #sendConnectionEvent(String)}.
* @hide
*/
public static final String EVENT_ON_HOLD_TONE_END =
"android.telecom.event.ON_HOLD_TONE_END";
// Flag controlling whether PII is emitted into the logs
private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);
@@ -447,6 +465,8 @@ public abstract class Connection extends Conferenceable {
public void onConferenceStarted() {}
public void onConferenceMergeFailed(Connection c) {}
public void onExtrasChanged(Connection c, Bundle extras) {}
/** @hide */
public void onConnectionEvent(Connection c, String event) {}
}
/**
@@ -1986,4 +2006,16 @@ public abstract class Connection extends Conferenceable {
l.onConferenceStarted();
}
}
/**
* Sends a connection event to Telecom.
*
* @param event The connection event.
* @hide
*/
protected void sendConnectionEvent(String event) {
for (Listener l : mListeners) {
l.onConnectionEvent(this, event);
}
}
}