diff options
Diffstat (limited to 'telecomm')
6 files changed, 56 insertions, 2 deletions
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. */ diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl index 23d70d5..26e2008 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl @@ -75,4 +75,6 @@ oneway interface IConnectionService { void setLocalCallHold(String callId, boolean lchState); void addParticipantWithConference(String callId, String recipients); + + void explicitTransfer(String callId); } diff --git a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl index ee51efa..6ef8eda 100644 --- a/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl +++ b/telecomm/java/com/android/internal/telecom/IInCallAdapter.aidl @@ -62,4 +62,6 @@ oneway interface IInCallAdapter { void turnOffProximitySensor(boolean screenOnImmediately); void switchToOtherActiveSub(String subId); + + void transferCall(String callId); } |