Merge "Pass onPostDialChar call back from Telephony to Telecom." into lmp-mr1-dev

This commit is contained in:
Nancy Chen
2014-12-16 23:06:27 +00:00
committed by Android (Google) Code Review
7 changed files with 79 additions and 1 deletions

View File

@@ -246,6 +246,7 @@ public abstract class Connection implements IConferenceable {
public void onVideoStateChanged(Connection c, int videoState) {}
public void onDisconnected(Connection c, DisconnectCause disconnectCause) {}
public void onPostDialWait(Connection c, String remaining) {}
public void onPostDialChar(Connection c, char nextChar) {}
public void onRingbackRequested(Connection c, boolean ringback) {}
public void onDestroyed(Connection c) {}
public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {}
@@ -997,6 +998,23 @@ public abstract class Connection implements IConferenceable {
}
}
/**
* Informs listeners that this {@code Connection} has processed a character in the post-dial
* started state. This is done when (a) the {@code Connection} is issuing a DTMF sequence;
* (b) it has encountered a "wait" character; and (c) it wishes to signal Telecom to play
* the corresponding DTMF tone locally.
*
* @param nextChar The DTMF character that was just processed by the {@code Connection}.
*
* @hide
*/
public final void setNextPostDialWaitChar(char nextChar) {
checkImmutable();
for (Listener l : mListeners) {
l.onPostDialChar(this, nextChar);
}
}
/**
* Requests that the framework play a ringback tone. This is to be invoked by implementations
* that do not play a ringback tone themselves in the connection's audio stream.

View File

@@ -483,6 +483,13 @@ public abstract class ConnectionService extends Service {
mAdapter.onPostDialWait(id, remaining);
}
@Override
public void onPostDialChar(Connection c, char nextChar) {
String id = mIdByConnection.get(c);
Log.d(this, "Adapter onPostDialChar %s, %s", c, nextChar);
mAdapter.onPostDialChar(id, nextChar);
}
@Override
public void onRingbackRequested(Connection c, boolean ringback) {
String id = mIdByConnection.get(c);

View File

@@ -226,6 +226,15 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
void onPostDialChar(String callId, char nextChar) {
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
adapter.onPostDialChar(callId, nextChar);
} catch (RemoteException ignored) {
}
}
}
/**
* Indicates that a new conference call has been created.
*

View File

@@ -58,6 +58,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
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 final IConnectionServiceAdapter mDelegate;
@@ -143,6 +144,15 @@ final class ConnectionServiceAdapterServant {
}
break;
}
case MSG_ON_POST_DIAL_CHAR: {
SomeArgs args = (SomeArgs) msg.obj;
try {
mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1);
} finally {
args.recycle();
}
break;
}
case MSG_QUERY_REMOTE_CALL_SERVICES:
mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj);
break;
@@ -298,6 +308,14 @@ final class ConnectionServiceAdapterServant {
mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
}
@Override
public void onPostDialChar(String connectionId, char nextChar) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = connectionId;
args.argi1 = nextChar;
mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
}
@Override
public void queryRemoteConnectionServices(RemoteServiceCallback callback) {
mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();

View File

@@ -100,6 +100,15 @@ public final class RemoteConnection {
*/
public void onPostDialWait(RemoteConnection connection, String remainingPostDialSequence) {}
/**
* Invoked when the post-dial sequence in the outgoing {@code Connection} has processed
* a character.
*
* @param connection The {@code RemoteConnection} invoking this method.
* @param nextChar The character being processed.
*/
public void onPostDialChar(RemoteConnection connection, char nextChar) {}
/**
* Indicates that the VOIP audio status of this {@code RemoteConnection} has changed.
* See {@link #isVoipAudioMode()}.
@@ -726,7 +735,7 @@ public final class RemoteConnection {
* of time.
*
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
* {@code RemoteConnection} will pause playing the tones and notify callbackss via
* {@code RemoteConnection} will pause playing the tones and notify callbacks via
* {@link Callback#onPostDialWait(RemoteConnection, String)}. At this point, the in-call app
* should display to the user an indication of this state and an affordance to continue
* the postdial sequence. When the user decides to continue the postdial sequence, the in-call
@@ -866,6 +875,15 @@ public final class RemoteConnection {
}
}
/**
* @hide
*/
void onPostDialChar(char nextChar) {
for (Callback c : mCallbacks) {
c.onPostDialChar(this, nextChar);
}
}
/**
* @hide
*/

View File

@@ -222,6 +222,12 @@ final class RemoteConnectionService {
.setPostDialWait(remaining);
}
@Override
public void onPostDialChar(String callId, char nextChar) {
findConnectionForAction(callId, "onPostDialChar")
.onPostDialChar(nextChar);
}
@Override
public void queryRemoteConnectionServices(RemoteServiceCallback callback) {
// Not supported from remote connection service.

View File

@@ -62,6 +62,8 @@ oneway interface IConnectionServiceAdapter {
void onPostDialWait(String callId, String remaining);
void onPostDialChar(String callId, char nextChar);
void queryRemoteConnectionServices(RemoteServiceCallback callback);
void setVideoProvider(String callId, IVideoProvider videoProvider);