From 8d4de13c37fc4a69153c6acce7b5fc1c0617f935 Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Mon, 11 Jan 2016 16:28:50 -0800 Subject: add routing for explicit call transfer Ref: CYNGNOS-1010 Change-Id: Ifd4150ce5589bdb586b3d840e967cc10be19fec4 Signed-off-by: Roman Birg --- telecomm/java/android/telecom/Call.java | 20 +++++++++++++++++++- telecomm/java/android/telecom/Connection.java | 13 ++++++++++++- telecomm/java/android/telecom/ConnectionService.java | 14 ++++++++++++++ telecomm/java/android/telecom/InCallAdapter.java | 7 +++++++ 4 files changed, 52 insertions(+), 2 deletions(-) (limited to 'telecomm/java/android') diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 36de974..128d38da 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -230,8 +230,14 @@ public final class Call { */ public static final int CAPABILITY_ADD_PARTICIPANT = 0x02000000; + /** + * Remote device supports call transfers. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000; + //****************************************************************************************** - // Next CAPABILITY value: 0x04000000 + // Next CAPABILITY value: 0x08000000 //****************************************************************************************** /** @@ -400,6 +406,9 @@ public final class Call { if (can(capabilities, CAPABILITY_ADD_PARTICIPANT)) { builder.append(" CAPABILITY_ADD_PARTICIPANT"); } + if (can(capabilities, CAPABILITY_SUPPORTS_TRANSFER)) { + builder.append(" CAPABILITY_SUPPORTS_TRANSFER"); + } builder.append("]"); return builder.toString(); } @@ -928,6 +937,15 @@ public final class Call { } /** + * Instructs this {@code Call} to connect the current active call and the call on hold. + * The current call will then disconnect. See {@link Details#CAPABILITY_SUPPORTS_TRANSFER}. + * @hide + */ + public void transferCall() { + mInCallAdapter.transferCall(mTelecomCallId); + } + + /** * Swaps the calls within this conference. See {@link Details#CAPABILITY_SWAP_CONFERENCE}. */ public void swapConference() { diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 01582a8..f7d83e8 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -272,8 +272,14 @@ public abstract class Connection extends Conferenceable { */ public static final int CAPABILITY_SUPPORTS_DOWNGRADE_TO_VOICE_REMOTE = 0x01000000; + /** + * Remote device supports call transfers. + * @hide + */ + public static final int CAPABILITY_SUPPORTS_TRANSFER = 0x04000000; + //********************************************************************************************** - // Next CAPABILITY value: 0x04000000 + // Next CAPABILITY value: 0x08000000 //********************************************************************************************** /** @@ -1945,6 +1951,11 @@ public abstract class Connection extends Conferenceable { public void onReject() {} /** + * Transfers the current call. + */ + public void onTransfer() { } + + /** * Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes. */ public void onPostDialContinue(boolean proceed) {} diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 9e4f9bb..0054be6 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -102,6 +102,7 @@ public abstract class ConnectionService extends Service { private static final int MSG_MERGE_CONFERENCE = 18; private static final int MSG_SWAP_CONFERENCE = 19; private static final int MSG_SET_LOCAL_HOLD = 20; + private static final int MSG_EXPLICIT_TRANSFER = 21; //Proprietary values starts after this. private static final int MSG_ADD_PARTICIPANT_WITH_CONFERENCE = 30; @@ -247,6 +248,11 @@ public abstract class ConnectionService extends Service { args.argi1 = proceed ? 1 : 0; mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget(); } + + @Override + public void explicitTransfer(String callId) { + mHandler.obtainMessage(MSG_EXPLICIT_TRANSFER, callId).sendToTarget(); + } }; private final Handler mHandler = new Handler(Looper.getMainLooper()) { @@ -394,6 +400,9 @@ public abstract class ConnectionService extends Service { } break; } + case MSG_EXPLICIT_TRANSFER: + transfer((String) msg.obj); + break; default: break; } @@ -766,6 +775,11 @@ public abstract class ConnectionService extends Service { } } + private void transfer(String callId) { + Log.d(this, "transfer %s", callId); + findConnectionForAction(callId, "transfer").onTransfer(); + } + private void unhold(String callId) { Log.d(this, "unhold %s", callId); if (mConnectionById.containsKey(callId)) { diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java index 7d0f5a7..8eb62ec 100644 --- a/telecomm/java/android/telecom/InCallAdapter.java +++ b/telecomm/java/android/telecom/InCallAdapter.java @@ -240,6 +240,13 @@ public final class InCallAdapter { } } + public void transferCall(String callId) { + try { + mAdapter.transferCall(callId); + } catch (RemoteException ignored) { + } + } + /** * Instructs Telecom to swap the child calls of the specified conference call. */ -- cgit v1.1