Add capability for a connection hand rejection text response.

Change-Id: Id90417736bed7ab8750144ccaf3c7b449ec832b8
This commit is contained in:
Bryce Lee
2015-08-28 16:38:02 -07:00
parent 65d438563a
commit 8190168077
4 changed files with 51 additions and 2 deletions

View File

@@ -101,6 +101,7 @@ public abstract class ConnectionService extends Service {
private static final int MSG_ANSWER_VIDEO = 17;
private static final int MSG_MERGE_CONFERENCE = 18;
private static final int MSG_SWAP_CONFERENCE = 19;
private static final int MSG_REJECT_WITH_MESSAGE = 20;
private static Connection sNullConnection;
@@ -165,6 +166,14 @@ public abstract class ConnectionService extends Service {
mHandler.obtainMessage(MSG_REJECT, callId).sendToTarget();
}
@Override
public void rejectWithMessage(String callId, String message) {
SomeArgs args = SomeArgs.obtain();
args.arg1 = callId;
args.arg2 = message;
mHandler.obtainMessage(MSG_REJECT_WITH_MESSAGE, args).sendToTarget();
}
@Override
public void disconnect(String callId) {
mHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget();
@@ -296,6 +305,15 @@ public abstract class ConnectionService extends Service {
case MSG_REJECT:
reject((String) msg.obj);
break;
case MSG_REJECT_WITH_MESSAGE: {
SomeArgs args = (SomeArgs) msg.obj;
try {
reject((String) args.arg1, (String) args.arg2);
} finally {
args.recycle();
}
break;
}
case MSG_DISCONNECT:
disconnect((String) msg.obj);
break;
@@ -681,6 +699,11 @@ public abstract class ConnectionService extends Service {
findConnectionForAction(callId, "reject").onReject();
}
private void reject(String callId, String rejectWithMessage) {
Log.d(this, "reject %s with message", callId);
findConnectionForAction(callId, "reject").onReject(rejectWithMessage);
}
private void disconnect(String callId) {
Log.d(this, "disconnect %s", callId);
if (mConnectionById.containsKey(callId)) {