IMS: Add support for IMS Explicit call transfer
Test: Manual Bug: 62170207 Change-Id: I06a256adb0e1910d40809c91bcdd42c56a142842
This commit is contained in:
72
telecomm/java/android/telecom/ConnectionService.java
Normal file → Executable file
72
telecomm/java/android/telecom/ConnectionService.java
Normal file → Executable file
@@ -128,6 +128,8 @@ public abstract class ConnectionService extends Service {
|
||||
private static final String SESSION_ANSWER = "CS.an";
|
||||
private static final String SESSION_ANSWER_VIDEO = "CS.anV";
|
||||
private static final String SESSION_DEFLECT = "CS.def";
|
||||
private static final String SESSION_TRANSFER = "CS.trans";
|
||||
private static final String SESSION_CONSULTATIVE_TRANSFER = "CS.cTrans";
|
||||
private static final String SESSION_REJECT = "CS.r";
|
||||
private static final String SESSION_REJECT_MESSAGE = "CS.rWM";
|
||||
private static final String SESSION_SILENCE = "CS.s";
|
||||
@@ -196,6 +198,8 @@ public abstract class ConnectionService extends Service {
|
||||
private static final int MSG_CREATE_CONFERENCE_FAILED = 37;
|
||||
private static final int MSG_REJECT_WITH_REASON = 38;
|
||||
private static final int MSG_ADD_PARTICIPANT = 39;
|
||||
private static final int MSG_EXPLICIT_CALL_TRANSFER = 40;
|
||||
private static final int MSG_EXPLICIT_CALL_TRANSFER_CONSULTATIVE = 41;
|
||||
|
||||
private static Connection sNullConnection;
|
||||
|
||||
@@ -480,6 +484,38 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transfer(@NonNull String callId, @NonNull Uri number,
|
||||
boolean isConfirmationRequired, Session.Info sessionInfo) {
|
||||
Log.startSession(sessionInfo, SESSION_TRANSFER);
|
||||
try {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = number;
|
||||
args.argi1 = isConfirmationRequired ? 1 : 0;
|
||||
args.arg3 = Log.createSubsession();
|
||||
mHandler.obtainMessage(MSG_EXPLICIT_CALL_TRANSFER, args).sendToTarget();
|
||||
} finally {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consultativeTransfer(@NonNull String callId, @NonNull String otherCallId,
|
||||
Session.Info sessionInfo) {
|
||||
Log.startSession(sessionInfo, SESSION_CONSULTATIVE_TRANSFER);
|
||||
try {
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = callId;
|
||||
args.arg2 = otherCallId;
|
||||
args.arg3 = Log.createSubsession();
|
||||
mHandler.obtainMessage(
|
||||
MSG_EXPLICIT_CALL_TRANSFER_CONSULTATIVE, args).sendToTarget();
|
||||
} finally {
|
||||
Log.endSession();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void silence(String callId, Session.Info sessionInfo) {
|
||||
Log.startSession(sessionInfo, SESSION_SILENCE);
|
||||
@@ -1108,6 +1144,30 @@ public abstract class ConnectionService extends Service {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_EXPLICIT_CALL_TRANSFER: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
Log.continueSession((Session) args.arg3, SESSION_HANDLER + SESSION_TRANSFER);
|
||||
try {
|
||||
final boolean isConfirmationRequired = args.argi1 == 1;
|
||||
transfer((String) args.arg1, (Uri) args.arg2, isConfirmationRequired);
|
||||
} finally {
|
||||
args.recycle();
|
||||
Log.endSession();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_EXPLICIT_CALL_TRANSFER_CONSULTATIVE: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
Log.continueSession(
|
||||
(Session) args.arg3, SESSION_HANDLER + SESSION_CONSULTATIVE_TRANSFER);
|
||||
try {
|
||||
consultativeTransfer((String) args.arg1, (String) args.arg2);
|
||||
} finally {
|
||||
args.recycle();
|
||||
Log.endSession();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MSG_DISCONNECT: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
Log.continueSession((Session) args.arg2, SESSION_HANDLER + SESSION_DISCONNECT);
|
||||
@@ -2042,6 +2102,18 @@ public abstract class ConnectionService extends Service {
|
||||
findConnectionForAction(callId, "reject").onReject(rejectReason);
|
||||
}
|
||||
|
||||
private void transfer(String callId, Uri number, boolean isConfirmationRequired) {
|
||||
Log.d(this, "transfer %s", callId);
|
||||
findConnectionForAction(callId, "transfer").onTransfer(number, isConfirmationRequired);
|
||||
}
|
||||
|
||||
private void consultativeTransfer(String callId, String otherCallId) {
|
||||
Log.d(this, "consultativeTransfer %s", callId);
|
||||
Connection connection1 = findConnectionForAction(callId, "consultativeTransfer");
|
||||
Connection connection2 = findConnectionForAction(otherCallId, " consultativeTransfer");
|
||||
connection1.onTransfer(connection2);
|
||||
}
|
||||
|
||||
private void silence(String callId) {
|
||||
Log.d(this, "silence %s", callId);
|
||||
findConnectionForAction(callId, "silence").onSilence();
|
||||
|
||||
Reference in New Issue
Block a user